summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/bug69537.phpt19
-rw-r--r--Zend/zend_compile.c2
2 files changed, 20 insertions, 1 deletions
diff --git a/Zend/tests/bug69537.phpt b/Zend/tests/bug69537.phpt
new file mode 100644
index 0000000000..3151c35081
--- /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 1401a6e051..5f3114d10e 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1314,7 +1314,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);