com php-src: Fix #69537: __debugInfo with empty strin g for key gives error: Zend/tests/bug6953 7.phpt Zend/zend_compile.c
| From: | Joe Watkins | Date: | Sun, 03 Apr 2016 11:40:29 +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-91582@lists.php.net to get a copy of this message | ||
Commit: 14e4c610e95a69b464596640e1f3996687e3d5ca
Author: Joe Watkins <krakjoe@php.net> Sun, 3 Apr 2016 12:40:29 +0100
Parents: a00c2b1bf54fb09015321e3677d89da552938306
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=14e4c610e95a69b464596640e1f3996687e3d5ca
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 d72b68a..2b35b4b 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5402,7 +5402,7 @@ ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int
le
*class_name = NULL;
- if (mangled_property[0]!=0) {
+ if (!len || mangled_property[0] != 0) {
*prop_name = mangled_property;
if (prop_len) {
*prop_len = len;