]> granicus.if.org Git - php/commitdiff
fix #69537: __debugInfo with empty string for key gives error
authorJoe Watkins <krakjoe@php.net>
Sun, 3 Apr 2016 11:38:25 +0000 (12:38 +0100)
committerJoe Watkins <krakjoe@php.net>
Sun, 3 Apr 2016 11:38:25 +0000 (12:38 +0100)
Zend/tests/bug69537.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug69537.phpt b/Zend/tests/bug69537.phpt
new file mode 100644 (file)
index 0000000..3151c35
--- /dev/null
@@ -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)
+}
+
index bc33e07d1fa034effd990dcbc6fab875fbce7acd..13e774eaba86da48d4823d5359d214257b4ccf4a 100644 (file)
@@ -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);