cvs: ZendEngine2(PHP_5_1) / zend_compile.c php-src NEWS
derick Tue Nov 15 10:59:56 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src NEWS
/ZendEngine2 zend_compile.c
Log:
- Allow "= null" default for parameters with a class type-hint.
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.190&r2=1.2027.2.191&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.190 php-src/NEWS:1.2027.2.191
--- php-src/NEWS:1.2027.2.190 Tue Nov 15 08:35:20 2005
+++ php-src/NEWS Tue Nov 15 10:59:37 2005
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Nov 2005, PHP 5.1
- Allow recursive calls to __get/__set for different properties. (Dmitry)
+- Allow "= null" default for parameters with a class type-hint. (Derick)
- Upgraded PEAR to version 1.4.4. (Greg)
- Fixed bug in mysqli extension with unsigned int(11) being represented as
signed integer in PHP instead of string in 32bit systems. (Andrey)
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.647.2.10&r2=1.647.2.11&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.10 ZendEngine2/zend_compile.c:1.647.2.11
--- ZendEngine2/zend_compile.c:1.647.2.10 Mon Oct 17 03:56:58 2005
+++ ZendEngine2/zend_compile.c Tue Nov 15 10:59:49 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.10 2005/10/17 07:56:58 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.11 2005/11/15 15:59:49 derick Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1273,15 +1273,23 @@
cur_arg_info->pass_by_reference = pass_by_reference;
if (class_type->op_type != IS_UNUSED) {
+ cur_arg_info->allow_null = 0;
if (class_type->u.constant.type == IS_STRING) {
cur_arg_info->class_name = class_type->u.constant.value.str.val;
cur_arg_info->class_name_len = class_type->u.constant.value.str.len;
+
+ if (op == ZEND_RECV_INIT) {
+ if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant)
== IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
+ cur_arg_info->allow_null = 1;
+ } else {
+ zend_error(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only
be NULL");
+ }
+ }
} else {
cur_arg_info->array_type_hint = 1;
cur_arg_info->class_name = NULL;
cur_arg_info->class_name_len = 0;
}
- cur_arg_info->allow_null = 0;
} else {
cur_arg_info->class_name = NULL;
cur_arg_info->class_name_len = 0;
Thread (1 message)
- Derick Rethans