Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_object_handlers.c /tests bug29015.phpt
| From: | Andrey Hristov | Date: | Fri, 29 Apr 2005 09:15:15 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_object_handlers.c /tests bug29015.phpt | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-3620@lists.php.net to get a copy of this message | ||
The name of the property includes characters invalid for a
property (variable) name.
Andrey
Dmitry Stogov wrote:
Hi Andrey, What is wrong with? Resource is converted to string and then used as property name. Andy, what do you think? Thanks. Dmitry.-----Original Message----- From: Andrey Hristov [mailto:php@hristov.com] Sent: Thursday, April 28, 2005 9:55 PM To: Dmitry Stogov Cc: zend-engine-cvs@lists.php.net Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_object_handlers.c /tests bug29015.phpt Hi Dmitry, could you fix also the following php -r '$a=opendir("/tmp");var_dump($a);$b->$a=1;var_dump($b);' resource(4) of type (stream) object(stdClass)#1 (1) { ["Resource id #4"]=> int(1) } Or should I file a bug report? Andrey Dmitry Stogov wrote:dmitry Thu Apr 28 13:40:11 2005 EDThttp://cvs.php.net/diff.php/ZendEngine2/zend_object_handlers.c?r1=1.11Modified files: /ZendEngine2 zend_object_handlers.c /ZendEngine2/tests bug29015.phpt Log: Fixed bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others)9&r2=1.120&ty=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.119ZendEngine2/zend_object_handlers.c:1.120--- ZendEngine2/zend_object_handlers.c:1.119 Wed Apr27 11:45:35 2005+++ ZendEngine2/zend_object_handlers.c Thu Apr 28 13:40:11 2005 @@ -17,7 +17,7 @@+------------------------------------------------------------- ---------+*/ -/* $Id: zend_object_handlers.c,v 1.119 2005/04/27 15:45:35dmitry Exp$ */ +/* $Id: zend_object_handlers.c,v 1.120 2005/04/28 17:40:11dmitry Exp+$ */ #include "zend.h" #include "zend_globals.h" @@ -147,6 +147,16 @@ zend_property_info *scope_property_info; zend_bool denied_access = 0; + if (Z_STRVAL_P(member)[0] == '\0') { + if (!silent) { + if (Z_STRLEN_P(member) == 0) { + zend_error(E_ERROR, "Cannotaccess empty property");+ } else { + zend_error(E_ERROR, "Cannotaccess property started with '\\0'");+ } + } + return NULL; + } ulong h = zend_get_hash_value(Z_STRVAL_P(member),Z_STRLEN_P(member)+1);if (zend_hash_quick_find(&ce->properties_info,Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {if (zend_verify_property_access(property_info,ce TSRMLS_CC)) { http://cvs.php.net/diff.php/ZendEngine2/tests/bug29015.phpt?r1=1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug29015.phpt diff -u /dev/null ZendEngine2/tests/bug29015.phpt:1.2 --- /dev/null Thu Apr 28 13:40:11 2005 +++ ZendEngine2/tests/bug29015.phpt Thu Apr 28 13:40:11 2005 @@ -0,0 +1,11 @@ +--TEST-- +Bug #29015 (Incorrect behavior of member vars(non string +ones)-numeric mem vars und others) +--FILE-- +<?php +$a = new stdClass(); +$x = ""; +$a->$x = "string('')"; +var_dump($a); +?> +--EXPECTF-- +Fatal error: Cannot access empty property in%sbug29015.php on line 4