felipe Sat, 17 Sep 2011 00:16:11 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=316887
Log: - Fixed bug #55705 (Omitting a callable typehinted argument causes a segfault) patch by: laruence@php Bug: https://bugs.php.net/55705 (Assigned) Omitting a callable typehinted argument causes a segfault Changed paths: A php/php-src/branches/PHP_5_4/Zend/tests/bug55705.phpt U php/php-src/branches/PHP_5_4/Zend/zend_execute.c A php/php-src/trunk/Zend/tests/bug55705.phpt U php/php-src/trunk/Zend/zend_execute.c Added: php/php-src/branches/PHP_5_4/Zend/tests/bug55705.phpt =================================================================== --- php/php-src/branches/PHP_5_4/Zend/tests/bug55705.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/Zend/tests/bug55705.phpt 2011-09-17 00:16:11 UTC (rev 316887) @@ -0,0 +1,9 @@ +--TEST-- +Bug #55705 (Omitting a callable typehinted argument causes a segfault) +--FILE-- +<?php +function f(callable $c) {} +f(); +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to f() must be callable, none given, called in %s on line 3 and defined in %s on line %d Modified: php/php-src/branches/PHP_5_4/Zend/zend_execute.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_execute.c 2011-09-17 00:05:31 UTC (rev 316886) +++ php/php-src/branches/PHP_5_4/Zend/zend_execute.c 2011-09-17 00:16:11 UTC (rev 316887) @@ -639,6 +639,9 @@ break; case IS_CALLABLE: + if (!arg) { + return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC); + } if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC); } Added: php/php-src/trunk/Zend/tests/bug55705.phpt =================================================================== --- php/php-src/trunk/Zend/tests/bug55705.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/bug55705.phpt 2011-09-17 00:16:11 UTC (rev 316887) @@ -0,0 +1,9 @@ +--TEST-- +Bug #55705 (Omitting a callable typehinted argument causes a segfault) +--FILE-- +<?php +function f(callable $c) {} +f(); +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to f() must be callable, none given, called in %s on line 3 and defined in %s on line %d Modified: php/php-src/trunk/Zend/zend_execute.c =================================================================== --- php/php-src/trunk/Zend/zend_execute.c 2011-09-17 00:05:31 UTC (rev 316886) +++ php/php-src/trunk/Zend/zend_execute.c 2011-09-17 00:16:11 UTC (rev 316887) @@ -639,6 +639,9 @@ break; case IS_CALLABLE: + if (!arg) { + return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC); + } if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php