Skip to content

Commit 87b6740

Browse files
committed
Fix spacing with nested enum in var_dump
1 parent b6ee4b2 commit 87b6740

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Zend/tests/enum/var_dump-nested.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Enum var_dump nested
3+
--FILE--
4+
<?php
5+
6+
enum Foo {
7+
case Bar;
8+
}
9+
10+
var_dump([[Foo::Bar]]);
11+
12+
?>
13+
--EXPECT--
14+
array(1) {
15+
[0]=>
16+
array(1) {
17+
[0]=>
18+
enum(Foo::Bar)
19+
}
20+
}

ext/standard/var.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf) /* {{{ */
605605
if (myht) {
606606
zend_release_properties(myht);
607607
}
608-
if (level > 1) {
608+
if (level > 1 && !is_enum) {
609609
buffer_append_spaces(buf, level - 1);
610610
}
611611
if (ce == zend_standard_class_def) {

0 commit comments

Comments
 (0)