Menu

#1588 (ok 4.0.10.8) recursive function too deep - operator change suggestion

Next_minor_version
fixed
None
1
2015-01-07
2015-01-05
No

Fix for 4.0 branch.

class Node {
public function hasSiblings() {
....
foreach ($this->parent->children as $child) {
if ($child !== $this
&& ($child->type == Node::OBJECT || $child->hasChildren(false))
....

The use of !== rather than != prevents a recursion too deep in early versions of PHP5.2. This fatal error occours at least in PHP 5.2.0-8+etch16

I appreciate this is an old version of PHP however there is little reason not to make this fix within 4.0.10.7 as it's aim is to support 5.2.

Discussion

  • sudshekhar

    sudshekhar - 2015-01-06

    !== also matches the type of the two variables being compared. That might have been one of the reasons for using !== instead of simply !=.

    I am not too familiar with the codebase yet but it does seem as if the types of the two variables should always match. If that is the case, I would like to volunteer for making this (trivial :P) change :)

     
    • Marc Delisle

      Marc Delisle - 2015-01-06

      sudshekhar,
      thanks but Ian P. Christian should be credited with this patch; no need to submit a pull request.

       
  • Marc Delisle

    Marc Delisle - 2015-01-06
    • assigned_to: Marc Delisle
     
  • Marc Delisle

    Marc Delisle - 2015-01-06

    Thanks Ian. Are you the author of this patch? Do you agree with our DCO? (see https://github.com/phpmyadmin/phpmyadmin/blob/master/DCO)

     
  • Ian P. Christian

    I am and I do!

    Thanks a lot Marc

     
  • Marc Delisle

    Marc Delisle - 2015-01-07
    • summary: recursive function too deep - operator change suggestion --> (ok 4.0.10.8) recursive function too deep - operator change suggestion
    • status: open --> resolved
    • Priority: 9 --> 1
     
  • Marc Delisle

    Marc Delisle - 2015-01-07
    • status: resolved --> fixed