Announcement

Collapse
No announcement yet.

array_merge() problem in functions.php (bug?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • array_merge() problem in functions.php (bug?)

    A user on my board had requested a password reset, and then forgotten to click on the emailed validation link (see message below) within 24 hours.
    You have requested to reset your password on Etusivun Viestitaulu forums because you have forgotten your password. If you did not request this, please ignore it.
    It will expire and become useless in 24 hours time.

    To reset your password, please visit the following

    page:
    http://viestit.etusivu.net/login.php?a=pwd&u=27&i=99739641
    (Note that my board no longer produces the mentioned error because I have fixed the problem on my system)

    When he then (after 24+ hours had passed) clicked on the link, the following error message was displayed (I was able to [and still am able to] duplicate it by clicking on the link of which the user sent me a copy):
    Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/web/etusivu.net/htdocs/viestit/includes/functions.php on line 3615
    Also, if the user should click on the link provided on the page (below the error message) in the message that states: "The request to reset your password was made more than 24 hours ago, so it has expired. To resubmit the request, please use this form.", the resulting page is a broken, incomplete form.

    I'm running vBulletin 3.0.3 on Apache 1.3.31 with PHP 5.0.2, MySQL 4.0.21 on a FreeBSD 4.10 system. No hacks have been applied to the vBulletin code and everything else seems to be working smoothly.

    Let me know if you need further info to debug this problem.
    Last edited by Ville; Sat 9 Oct '04, 8:45am.
    Come to visit My Galagzee!

  • #2
    I have this too with php5. I have re-install all in one time (apache and php) and it was resolved.

    vBulletin QA - vBulletin Support French - Lead Project Tools developer

    Next release? Soon(tm)

    Comment


    • #3
      Thanks for the note. I've reinstalled PHP5 and Apache number of times in last few days as I've been optimizing their configuration (mostly PHP5's as I upgraded from the latest 4.x two weeks ago. I also tried reverting to the bare-bones configuration, but it did not seem to fix the problem. I'm using PHP5 as a compiled-in Apache module (i.e. not shared).

      Apparently this is some kind of PHP5-compatibility issue; maybe vBulletin team can look into it and maybe address it in the next release.

      Jelsoft folks: if you need configuration info or if it would be useful for me to run some debug PHP-file on my system, let me know.
      Come to visit My Galagzee!

      Comment


      • #4
        Are these problem reports picked up automagically by the developers, or should I enter this issue somewhere else as a [potential] bug?
        Come to visit My Galagzee!

        Comment


        • #5
          At this time we do not consider PHP5 ready for prime time. The Devs do not currently consider incompatibilities with PHP5 to be bugs.
          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
          Change CKEditor Colors to Match Style (for 4.1.4 and above)

          Steve Machol Photography


          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


          Comment


          • #6
            Ok ... Do you have an estimate at what point you will start considering PHP5 production quality?
            Come to visit My Galagzee!

            Comment


            • #7
              No, sorry I don't. That'll be up to the Developers.
              Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
              Change CKEditor Colors to Match Style (for 4.1.4 and above)

              Steve Machol Photography


              Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


              Comment


              • #8
                I abandoned PHP5 for the time being (back to 4.3.9 and everything's working smootly). Have to deal with SOAP/WSDL not being built in, and there not being decent OOP functionality for some time longer .
                Come to visit My Galagzee!

                Comment


                • #9
                  resolved

                  Whether or not the developers are interested, here's the cause of this problem (and it's not going to go away in a future release of PHP5):

                  (PHP) Re: array_merge changed behaviour in Php5??

                  The offending line (line# 3615) in functions.php uses array_merge (line numbers added):
                  Code:
                  // ...
                  3612 // populate the $vbphrase array with phrase groups
                  3613 foreach ($phrasegroups AS $phrasegroup)
                  3614 {
                  3615 $vbphrase = [b]array_merge[/b]($vbphrase, unserialize($bbuserinfo["phrasegroup_$phrasegroup"]));
                  3616 unset($bbuserinfo["phrasegroup_$phrasegroup"]);
                  3617 }
                  // ...
                  Since the error message says "Argument #2 is not an array", one can assume unserialize($bbuserinfo["phrasegroup_$phrasegroup"]) doesn't return an array when 24 hours have passed and the ticket number has been purged from the database (likely it returns an empty set), and so the whole array_merge statement fails. A quick fix, then, to remedy this particular problem is to augment the previous code to check whether the unserialized data in fact is an array and if not, initialize the value to an empty array. In other words..
                  Code:
                  // ...
                  // populate the $vbphrase array with phrase groups
                  foreach ($phrasegroups AS $phrasegroup)
                  {
                  $temp_bbuserinfo = unserialize($bbuserinfo["phrasegroup_$phrasegroup"]);
                  if (!is_array($temp_bbuserinfo)) 
                  {
                  $temp_bbuserinfo = array();
                  }
                  $vbphrase = array_merge($vbphrase, $temp_bbuserinfo);
                  unset($bbuserinfo["phrasegroup_$phrasegroup"]);
                  }
                  // ...
                  Maybe the developers could add this (or something similar) to the next version of vB. Granted it may be a quick fix, but so far it's the only thing I've encountered that hasn't worked properly with PHP5.

                  Also, a note to PitchouneN64ngc: reinstalling PHP5 and Apache would not fix this problem, as it's cause is on the official "incompatibilities list". Maybe you accidentally enabled php4 while reinstalling, or maybe the ticket you tested it with the second time around hadn't yet expired as the problem did not appear if the ticket number was still valid.

                  (Added: unlike I mentioned in the previous message, I couldn't stay away from PHP5 for more than couple of hours... too many things I'm working on utilize it's new features .)
                  Come to visit My Galagzee!

                  Comment


                  • #10
                    Ok, I understand, but when i've removed apache 2.0.52 and php 5.0.2 and re-installing them (on Windows system), these problems didn't show again.

                    I add the incompatibilities list in my favorites to read this later

                    vBulletin QA - vBulletin Support French - Lead Project Tools developer

                    Next release? Soon(tm)

                    Comment


                    • #11
                      If you really want the developers to take a note of it make a bug report, or update your current one.

                      Comment

                      Related Topics

                      Collapse

                      Working...
                      X