Any possible reason why "$line.serialize($rs2)" refuses to execute?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rafi B.

    Any possible reason why "$line.serialize($rs2)" refuses to execute?

    I'm running this on a Linux/CentOs/cPanel server, trying to add caching
    to my PHP5 code, using ADOdb. I have two Linux servers, one of them is
    running perfect, the second one, just crashes without any error, and
    just gives a blank screen.

    I narrowed down the problem to: $line.serialize ($rs2)
    Am I missing something maybe in the PHP5 configuration?

  • Janwillem Borleffs

    #2
    Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

    Rafi B. wrote:[color=blue]
    > I narrowed down the problem to: $line.serialize ($rs2)
    > Am I missing something maybe in the PHP5 configuration?
    >[/color]

    This is probably too obvious, but when $line is an object and serialize() a
    method of this object, the call should be:

    $line->serialize($rs2 );


    JW


    Comment

    • Rafi B.

      #3
      Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

      This is the context in which it is executed:
      $line = "====1,$tt,$sql \n";
      $rs2->sql = $rs->sql;
      $rs2->oldProvider = $rs->dataProvider ;
      $rs2->InitArrayField s($rows,$flds);
      $rs2->fetchMode = $savefetch;
      return $line.serialize ($rs2);

      $rs2 is a Recordset, this code is part of ADOdb caching function, which
      tries to serialize a recordset from database, and saves it into a file.
      When I do print_r($rs2) it seems that all the data is there, the last
      line, even without the concating of $line, just crashes. Without any
      message.

      What I've been through the past days because of this is insane.
      Upgraded cPanel, upgraded Apache, all my apps and modules are identical
      to a friends' server which this code runs so smoothly on it makes me
      want to cry.

      Any help why serialize() will just crash like this?

      Janwillem Borleffs wrote:[color=blue]
      > Rafi B. wrote:[color=green]
      > > I narrowed down the problem to: $line.serialize ($rs2)
      > > Am I missing something maybe in the PHP5 configuration?
      > >[/color]
      >
      > This is probably too obvious, but when $line is an object and serialize() a
      > method of this object, the call should be:
      >
      > $line->serialize($rs2 );
      >
      >
      > JW[/color]

      Comment

      • Janwillem Borleffs

        #4
        Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

        Rafi B. wrote:[color=blue]
        > This is the context in which it is executed:
        > $line = "====1,$tt,$sql \n";
        > $rs2->sql = $rs->sql;
        > $rs2->oldProvider = $rs->dataProvider ;
        > $rs2->InitArrayField s($rows,$flds);
        > $rs2->fetchMode = $savefetch;
        > return $line.serialize ($rs2);
        >[/color]
        [...][color=blue]
        > Any help why serialize() will just crash like this?
        >[/color]

        Well, for one thing, $line.serialize () isn't valid PHP syntax for a method
        call, because of the dot. That it executes on your friend's system probably
        has to do with his error_reporting and display_errors settings. Ask him if
        queries ever get cached and the answer probably will be negative.

        When the $rs2 object contains the serialize method, you probably should do
        something like:

        return $rs2->serialize();

        When, however, you goal is to apply the native PHP serialize function, the
        call probably should be:

        return serialize($rs2) ;


        JW


        Comment

        • Rafi B.

          #5
          Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?


          Janwillem Borleffs wrote:[color=blue]
          >
          > Well, for one thing, $line.serialize () isn't valid PHP syntax for a method
          > call, because of the dot. That it executes on your friend's system probably
          > has to do with his error_reporting and display_errors settings. Ask him if
          > queries ever get cached and the answer probably will be negative.
          >[/color]
          It does. I coded his site, and the caching works like a charm.[color=blue]
          >From a 8 second heavy queried home page, to 0.5 second serverside[/color]
          loadtime,
          its cached every hour.

          What the guys in the ADOdb code are doing is concating the $line with
          the
          result of serialize($rs2) . So: return $line.serialize ($rs2); IS valid
          in PHP,
          maybe more clear would be: return $line . serialize($rs2) ;
          [color=blue]
          > When the $rs2 object contains the serialize method, you probably should do
          > something like:
          >[/color]

          Their just serializing the $rs object. That's it. When I try to execute
          the query
          without caching, I receive a return into "$myresult" lets say for
          example, this
          will contain an array of all the fields that my query returned, and
          when I do IN MY CODE:
          $sdata = serialize($myre sult);

          CRASHES. Fatal. Doesn't spit anything in the logs, or screen. Just dies
          so brutally.

          I'm pulling out hairs here.

          Comment

          • Rafi B.

            #6
            Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

            My title for this thread should be: Why serialize($rs) crashes
            brutally?
            I've narrowed it down to this. Why does it happen? On the same code,
            same ADOdb library version, both on my Friend's Linux Server, and
            another Windows Server, it SHOULD work according to ADOdb and hundreds
            of their fans. And it works for me, but on servers other than mine.
            Only I'm screwed. Dunno why.

            PHP version 5.0.5 by the way.

            Comment

            • Janwillem Borleffs

              #7
              Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

              Rafi B. wrote:[color=blue]
              > result of serialize($rs2) . So: return $line.serialize ($rs2); IS
              > valid in PHP,
              > maybe more clear would be: return $line . serialize($rs2) ;
              >[/color]

              Yep, you're right. My bad, I was sleeping.

              Regarding the version you are using (5.0.5), which version is used on the
              environments which do not have problems?

              Perhaps it would be an idea to simply update your environment to the latest
              stable release (5.1.2). What you also can do is set up a test to see at
              which point the serialize() function crashes.

              Just comment out portings of the class instantiated through the $rs2 object
              and de-comment portions up untill the moment serialize() crashes.


              JW


              Comment

              • Rafi B.

                #8
                Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

                Problem is, I'm very new to Linux, and I have a Linux/CentOs/cPanel
                server
                and the cPanel support PHP until version 5.0.5

                Janwillem Borleffs wrote:[color=blue]
                > Rafi B. wrote:[color=green]
                > > result of serialize($rs2) . So: return $line.serialize ($rs2); IS
                > > valid in PHP,
                > > maybe more clear would be: return $line . serialize($rs2) ;
                > >[/color]
                >
                > Yep, you're right. My bad, I was sleeping.
                >
                > Regarding the version you are using (5.0.5), which version is used on the
                > environments which do not have problems?
                >
                > Perhaps it would be an idea to simply update your environment to the latest
                > stable release (5.1.2). What you also can do is set up a test to see at
                > which point the serialize() function crashes.
                >
                > Just comment out portings of the class instantiated through the $rs2 object
                > and de-comment portions up untill the moment serialize() crashes.
                >
                >
                > JW[/color]

                Comment

                • Janwillem Borleffs

                  #9
                  Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

                  Rafi B. wrote:[color=blue]
                  > Problem is, I'm very new to Linux, and I have a Linux/CentOs/cPanel
                  > server
                  > and the cPanel support PHP until version 5.0.5
                  >[/color]

                  Well, then try the debugging routine I suggested. It might give you a clue
                  on what's going on.


                  JW


                  Comment

                  • Pedro Graca

                    #10
                    Re: Any possible reason why "$line.ser ialize($rs2)&qu ot; refuses to execute?

                    Rafi B. wrote:
                    <snip>[color=blue]
                    > when I do IN MY CODE:
                    > $sdata = serialize($myre sult);
                    >
                    > CRASHES. Fatal. Doesn't spit anything in the logs, or screen. Just dies
                    > so brutally.[/color]

                    What's in $myresult?
                    Do a var_dump($myres ult)

                    --
                    Mail to my "From:" address is readable by all at http://www.dodgeit.com/
                    == ** ## !! ------------------------------------------------ !! ## ** ==
                    TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
                    may bypass my spam filter. If it does, I may reply from another address!

                    Comment

                    • Rafi B.

                      #11
                      Re: Any possible reason why &quot;$line.ser ialize($rs2)&qu ot; refuses to execute?

                      FIXED !!!
                      It was apprently a PHP 5.0.5 overflow bug, or something like it.
                      Looking through the BUG FIXES of PHP 5.1.2 I saw some fixes for
                      serialize/deserialize, thanks for Dimitry and Ilia, the bug fixers, and
                      the fact that I've upgraded PHP to 5.1.2, everything works like a charm.

                      Comment

                      Working...