From: portfolio at gmx dot co dot uk Operating system: XP PHP version: 5.0.1 PHP Bug Type: Reproducible crash Bug description: Passing array or non array of objects
Description: ------------ When I pass an array of objects without first initializing them with a variable, I get either a crash or error (Depends on whether if its array). Reproduce code: --------------- class A { function A($arrayobj) { while(list($key, $value) = each($arrayobj)) { echo $value->spit(); } } } class B { function spit() { return 'This is class B' . "\n"; } } class C { function spit() { return 'This is class C' . "\n"; } } new A( array( new B(), new C())); Expected result: ---------------- I got this error: This is class B Fatal error: Call to a member function spit() on a non-object in If I do: $b = new B; $c = new C; new A( array($b, $c)); It works but very long winded. Another bug here causes Apache to crash: class A { function A($value) { echo $value->spit(); } } class B { function spit() { return 'This is class B' . "\n"; } } new A( new B()); -- Edit bug report at http://bugs.php.net/?id=30080&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30080&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30080&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30080&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30080&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30080&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30080&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30080&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30080&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30080&r=support Expected behavior: http://bugs.php.net/fix.php?id=30080&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30080&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30080&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30080&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30080&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30080&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30080&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30080&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30080&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30080&r=mysqlcfg