com php-src: fix #69537: __debugInfo with empty strin g for key gives error: Zend/tests/bug6953 7.phpt Zend/zend_compile.c

From: Date: Sun, 03 Apr 2016 11:38:25 +0000
Subject: com php-src: fix #69537: __debugInfo with empty strin g for key gives error: Zend/tests/bug6953 7.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91584@lists.php.net to get a copy of this message
Commit: 91c10662c887c0e0a80844b1655cf329c5c58352 Author: Joe Watkins <krakjoe@php.net> Sun, 3 Apr 2016 12:38:25 +0100 Parents: 034e8ec02e263f5908b469bba1285e26c0a67bc4 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=91c10662c887c0e0a80844b1655cf329c5c58352 Log: fix #69537: __debugInfo with empty string for key gives error Bugs: https://bugs.php.net/69537 Changed paths: A Zend/tests/bug69537.phpt M Zend/zend_compile.c Diff: diff --git a/Zend/tests/bug69537.phpt b/Zend/tests/bug69537.phpt new file mode 100644 index 0000000..3151c35 --- /dev/null +++ b/Zend/tests/bug69537.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #69537 (__debugInfo with empty string for key gives error) +--FILE-- +<?php +class Foo { + + public function __debugInfo(){ + return ['' => 1]; + } +} + +var_dump(new Foo); +?> +--EXPECTF-- +object(Foo)#%d (%d) { + [""]=> + int(1) +} + diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index bc33e07..13e774e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1216,7 +1216,7 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char *class_name = NULL; - if (ZSTR_VAL(name)[0] != '\0') { + if (!ZSTR_LEN(name) || ZSTR_VAL(name)[0] != '\0') { *prop_name = ZSTR_VAL(name); if (prop_len) { *prop_len = ZSTR_LEN(name);

« previous php.cvs (#91584) next »