|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-01-04 05:12 UTC] helly@php.net
[2006-01-02 09:03 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 23:00:01 2025 UTC |
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"