From:             gynvael at coldwind dot pl
Operating system: any
PHP version:      5.4.10
Package:          Reproducible crash
Bug Type:         Bug
Bug description:zend_std_compare_objects crash on recursion

Description:
------------
The standard PHP object compare handler (zend_std_compare_objects) together
with 
the == operator (compare_function) have no limit on nesting levels nor any
anti-
recursion protection.

The array comparing function in compare_function does have this protection.
It 
would be good to add it to the object standard compare handler as well.

Test script:
---------------
<?php
class Test { public $x = 5; }

$testobj1 = new Test;
$testobj2 = new Test;
$testobj1->x = $testobj1;
$testobj2->x = $testobj2;

$testobj1 == $testobj2; // Crash (stack exhaustion)


Expected result:
----------------
PHP Fatal error:  Nesting level too deep - recursive dependency? in
test.php on 
line 9

Actual result:
--------------
segmentation fault (core dumped)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63882&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63882&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63882&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63882&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63882&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63882&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63882&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63882&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63882&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63882&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63882&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63882&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63882&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63882&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63882&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63882&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63882&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63882&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63882&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63882&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63882&r=mysqlcfg

Reply via email to