From: jebmc at iprimus dot com dot au Operating system: Windows XP Pro w/SP1 PHP version: 5.0.0b3 (beta3) PHP Bug Type: Zend Engine 2 problem Bug description: Undefined variables cause type hints to become useless
Description: ------------ If you pass an undefined variable as the value of a type-hinted argument, the type-hint checking appears to be skipped. Rather, a notice error is printed for the undefined variable (as it should be) and the function or method happily continues on. Reproduce code: --------------- <?php class Foo { } function myFunc($param1, Foo $bar) { echo $param1; } myFunc('This is a test',$badVariable); ?> Expected result: ---------------- "Notice: Undefined variable: badVariable in foo.php on line 11 Fatal error: Argument 2 must be an object of class foo in foo.php on line 6" Actual result: -------------- "Notice: Undefined variable: badVariable in foo.php on line 11 This is a test" -- Edit bug report at http://bugs.php.net/?id=26780&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26780&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26780&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26780&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26780&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26780&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=26780&r=needscript Try newer version: http://bugs.php.net/fix.php?id=26780&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26780&r=support Expected behavior: http://bugs.php.net/fix.php?id=26780&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26780&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26780&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26780&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26780&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26780&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26780&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26780&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26780&r=float