ERROR_LOG_FLAG doesn't work in v. 0.4.11?

thread: 12 messages  |  last: a year ago  |  started: saturday, february 6, 2010, 6:02 am pst


#1  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Saturday, February 6, 2010, 6:02 AM PST

I am trying to set a custom error page but it seems to me that it doesn't work, the default error page appears when an error occures. If I comment the line 133 in error_dump.inc.php everything works fine.

Is this a bug or I did a mistake somewhere? Thanks.

Attila

#2  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Saturday, February 6, 2010, 7:09 AM PST

Hello again.
There is a problem with the 'var_export()' PHP function, which cannot handle recursive referencing within Objects, and trigger a Fatal Error. But since it gets fatal error there (line 133), it cannot clear the output buffer and the result is that I see error page.

Attila

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Saturday, February 6, 2010, 7:50 AM PST

Hmm... I haven't had issues there, but I am running the xdebug extension, so that might do a better job with var_dump/var_export and recursion...

Just out of curiosity, which version of PHP are you running?

Also, what happens if you run the following code?

<?php
    
class Foo {
        public 
$Foo;
    }

    for (
$intI 0$intI 10$intI++) {
        
$objFoo[$intI] = new Foo();
    }

    for (
$intI 0$intI 9$intI++) {
        
$objFoo[$intI]->Foo $objFoo[$intI 1];
    }
    
    
$objFoo[9]->Foo $objFoo[0];

    
var_dump($objFoo[0]);
?>

Please post back whenever you get a chance... thanks!

#4  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Saturday, February 6, 2010, 10:24 AM PST

Thanks for answering Mike,

My php version is: 5.2.11

The above code result is:

object(Foo)#1 (1) {
  ["Foo"]=>
  object(Foo)#2 (1) {
    ["Foo"]=>
    object(Foo)#3 (1) {
      ["Foo"]=>
      object(Foo)#4 (1) {
        ["Foo"]=>
        object(Foo)#5 (1) {
          ["Foo"]=>
          object(Foo)#6 (1) {
            ["Foo"]=>
            object(Foo)#7 (1) {
              ["Foo"]=>
              object(Foo)#8 (1) {
                ["Foo"]=>
                object(Foo)#9 (1) {
                  ["Foo"]=>
                  object(Foo)#10 (1) {
                    ["Foo"]=>
                    object(Foo)#1 (1) {
                      ["Foo"]=>
                      object(Foo)#2 (1) {
                        ["Foo"]=>
                        object(Foo)#3 (1) {
                          ["Foo"]=>
                          object(Foo)#4 (1) {
                            ["Foo"]=>
                            object(Foo)#5 (1) {
                              ["Foo"]=>
                              object(Foo)#6 (1) {
                                ["Foo"]=>
                                object(Foo)#7 (1) {
                                  ["Foo"]=>
                                  object(Foo)#8 (1) {
                                    ["Foo"]=>
                                    object(Foo)#9 (1) {
                                      ["Foo"]=>
                                      object(Foo)#10 (1) {
                                        ["Foo"]=>
                                        *RECURSION*
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

but if I change var_dump to var_export the result is:

Foo::__set_state(array(
   'Foo' => 
  Foo::__set_state(array(
     'Foo' => 
    Foo::__set_state(array(
       'Foo' => 
      Foo::__set_state(array(
         'Foo' => 
        Foo::__set_state(array(
           'Foo' => 
          Foo::__set_state(array(
             'Foo' => 
            Foo::__set_state(array(
               'Foo' => 
              Foo::__set_state(array(
                 'Foo' => 
                Foo::__set_state(array(
                   'Foo' => 
                  Foo::__set_state(array(
                     'Foo' => 
                    Foo::__set_state(array(
                       'Foo' => 
                      Foo::__set_state(array(
                         'Foo' => 
                        Foo::__set_state(array(
                           'Foo' => 
                          Foo::__set_state(array(
                             'Foo' => 
                            Foo::__set_state(array(
                               'Foo' => 
                              Foo::__set_state(array(
                                 'Foo' => 
                                Foo::__set_state(array(
                                   'Foo' => 
                                  Foo::__set_state(array(
                                     'Foo' => 
                                    Foo::__set_state(array(
                                       'Foo' => 
                                      Foo::__set_state(array(
                                         'Foo' => 
                                        Foo::__set_state(array(
                                           'Foo' => 
                                          Foo::__set_state(array(
                                             'Foo' => 
                                            Foo::__set_state(array(
                                               'Foo' => 
                                              Foo::__set_state(array(
                                                 'Foo' => 
                                                Foo::__set_state(array(
                                                   'Foo' => 
                                                  Foo::__set_state(array(
                                                     'Foo' => 
                                                    Foo::__set_state(array(
                                                       'Foo' => 
                                                      Foo::__set_state(array(
                                                         'Foo' => 
                                                        Foo::__set_state(array(
                                                           'Foo' => 
                                                          Foo::__set_state(array(
                                                             'Foo' => 
                                                            Foo::__set_state(array(

Fatal error:  Nesting level too deep - recursive dependency? in ...../test.php on line 16

Attila

#5  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Saturday, February 6, 2010, 3:34 PM PST

Thanks for the info - yeah, it looks like it's an issue specifically with var_export (even though var_dump works perfectly) -- I looked through the PHP bugs database, and unfortunately, it's a known issue but it's likely not going to be fixed or addressed any time soon.

I think the answer is to rework QForm->VarExport() so that it does a combination of var_dump to the output buffer instead of using var_export... but that definitely will take a bit of work.

For now, if commenting out the var_export line in QForm works for you, I'd suggest going with that.  And in the mean time, could you open up a new ticket for this in the issue tracker?

#6  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Sunday, February 7, 2010, 9:09 AM PST

Try to use serialization before dumping the variables with var_export(). In previous PHP versions, this was a trick used to break self and recursive references within objects before dumping their content.

<?php
$objVariable 
unserializeserialize$objVariable ) );
?>

However, this can consume a noticeable amount of memory if you are dumping a (big) lot of objects.

#7  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, February 8, 2010, 12:49 PM PST

Gasper... what happens when you try putting in Fernando's fix around the calls to var_export...?  Does that fix the issue?  If so, we can get this into the core distribution, so please let us know.

Thanks!

#8  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Monday, February 8, 2010, 2:17 PM PST

Thank you Fernando for your suggestion.

Mike, I've tested Fernando's fix in QControlBase.class.php:


<?php
return var_export(unserialize(serialize($this)), true);
?>

but it doesn't work.
The “Nesting level too deep - recursive dependency?” error appears again.

#9  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Wednesday, February 10, 2010, 3:54 PM PST

Sorry for that. It seems that in some 5.x version the PHP developers solved this dereferencing of recursive references when serializing/unserializing. As I said, it was an old trick.

#10  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Thursday, February 11, 2010, 4:19 PM PST

K... gaspar -- were you able to open a ticket for this?

If so, could you post here with the link to it?



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.