From: Dmitry Stogov Date: Thu, 28 Apr 2005 17:39:56 +0000 (+0000) Subject: Fixed bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem... X-Git-Tag: php-5.0.5RC1~350 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11f5296b418e2aa6d1eedb709238ab50aa1f1d0f;p=php Fixed bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others) --- diff --git a/NEWS b/NEWS index f4f26553c6..d8922921b3 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,8 @@ PHP NEWS - Fixed bug #29210 (Function: is_callable - no support for private and protected classes). (Dmitry) - Fixed bug #29104 (Function declaration in method doesn't work). (Dmitry) +- Fixed bug #29015 (Incorrect behavior of member vars(non string ones)-numeric + mem vars und others). (Dmitry) - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)). (kameshj at fastmail dot fm) diff --git a/Zend/tests/bug29015.phpt b/Zend/tests/bug29015.phpt new file mode 100644 index 0000000000..6c18ab8a09 --- /dev/null +++ b/Zend/tests/bug29015.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others) +--FILE-- +$x = "string('')"; +var_dump($a); +?> +--EXPECTF-- +Fatal error: Cannot access empty property in %sbug29015.php on line 4 diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 78ea737273..508b1f79f1 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -199,6 +199,16 @@ static inline zend_property_info *zend_get_property_info(zend_object *zobj, zval 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, "Cannot access empty property"); + } else { + zend_error(E_ERROR, "Cannot access 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(&zobj->ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) { if (zend_verify_property_access(property_info, zobj->ce TSRMLS_CC)) {