Bug #70922 [Fbk->Opn]: php类型约束失效

From: Date: Tue, 17 Nov 2015 01:29:07 +0000
Subject: Bug #70922 [Fbk->Opn]: php类型约束失效
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-878@lists.php.net to get a copy of this message
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: Feedback +Status: Open Type: Bug Package: PHP Language Specification Operating System: Window 7 PHP Version: 5.5.30 Block user comment: N Private report: N New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [2015-11-16 14:24:10] laruence@php.net 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 ------------------------------------------------------------------------ [2015-11-16 13:12:17] no367 at vip dot qq dot com Description: ------------ <?php namespace test; function text( array $arr ){ print_r($arr); } //not working text('text'); Test script: --------------- <?php namespace test; function test( array $arr ){ print_r($arr); } //not working test('test'); <?php function test( array $arr ){ print_r($arr); } //is working test('test'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70922&edit=1

« previous php.standards (#878) next »