Bug #70922 [Nab]: php??????????????????
[email protected] ("no367 at vip dot qq dot com")
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=70922&edit=1 ID: 70922 User updated by: no367 at vip dot qq dot com Reported by: no367 at vip dot qq dot com Summary: php类型约束失效 Status: Not a bug Type: Bug Package: PHP Language Specification Operating System: Window 7 PHP Version: 5.5.30 Block user comment: N Private report: N New Comment: Thinks! Previous Comments: ------------------------------------------------------------------------ [2015-11-17 02:25:00] [email protected] because it's a "Catchable" fatal error ------------------------------------------------------------------------ [2015-11-17 01:35:32] no367 at vip dot qq dot com if comment the set_error_handler then get the desired results. ------------------------------------------------------------------------ [2015-11-17 01:31:52] no367 at vip dot qq dot com Sorry,The above code is wrong. <?php namespace test; function error( $type, $message, $file, $line ){ static $error; $error[] = array( 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'fatal' => false ); } set_error_handler( 'test\error' ); function test_array( array $arr ){ print_r($arr); } test_array('test'); //why is print test ok? var_dump( error_get_last() ); //why is null ? ------------------------------------------------------------------------ [2015-11-17 01:29:05] no367 at vip dot qq dot com In fact this is the case. <?php namespace test; function error( $type, $message, $file, $line ){ static $error; $error[] = array( 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'fatal' => false ); } set_error_handler( 'test\error' ); function test_array( array $arr ){ print_r($arr); } var_dump( error_get_last() ); //why is null ? test_array('test'); //why is print test ok? ------------------------------------------------------------------------ [2015-11-16 14:24:10] [email protected] I am not sure what the problem is? they behavior the same to me: PHP Catchable fatal error: Argument 1 passed to test() must be of the type array, string given, called in /tmp/1.php on line 7 and PHP Catchable fatal error: Argument 1 passed to test\test() must be of the type array, string given, called in /tmp/1.php on line 7 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=70922 -- Edit this bug report at https://bugs.php.net/bug.php?id=70922&edit=1