Skip to content

Commit 3ce472d

Browse files
committed
Fix message for some string offset uses as object
Even if the object property is incremented afterwards, the immediate error is the use as object, not the increment. Also consolidate tests for this error message. Previously they were spread across a number of bug-specific tests.
1 parent da0d246 commit 3ce472d

File tree

5 files changed

+5
-58
lines changed

5 files changed

+5
-58
lines changed

Zend/tests/bug41813.phpt

Lines changed: 0 additions & 15 deletions
This file was deleted.

Zend/tests/bug41919.phpt

Lines changed: 0 additions & 14 deletions
This file was deleted.

Zend/tests/bug47704.phpt

Lines changed: 0 additions & 12 deletions
This file was deleted.

Zend/tests/bug79779.phpt

Lines changed: 0 additions & 12 deletions
This file was deleted.

Zend/zend_execute.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,11 @@ ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void)
15621562
case ZEND_ASSIGN_OBJ:
15631563
case ZEND_ASSIGN_OBJ_OP:
15641564
case ZEND_ASSIGN_OBJ_REF:
1565+
case ZEND_PRE_INC_OBJ:
1566+
case ZEND_PRE_DEC_OBJ:
1567+
case ZEND_POST_INC_OBJ:
1568+
case ZEND_POST_DEC_OBJ:
1569+
case ZEND_UNSET_OBJ:
15651570
msg = "Cannot use string offset as an object";
15661571
break;
15671572
case ZEND_FETCH_DIM_W:
@@ -1577,10 +1582,6 @@ ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void)
15771582
case ZEND_ASSIGN_OP:
15781583
msg = "Cannot use assign-op operators with string offsets";
15791584
break;
1580-
case ZEND_PRE_INC_OBJ:
1581-
case ZEND_PRE_DEC_OBJ:
1582-
case ZEND_POST_INC_OBJ:
1583-
case ZEND_POST_DEC_OBJ:
15841585
case ZEND_PRE_INC:
15851586
case ZEND_PRE_DEC:
15861587
case ZEND_POST_INC:
@@ -1598,7 +1599,6 @@ ZEND_API ZEND_COLD void zend_wrong_string_offset_error(void)
15981599
msg = "Cannot return string offsets by reference";
15991600
break;
16001601
case ZEND_UNSET_DIM:
1601-
case ZEND_UNSET_OBJ:
16021602
msg = "Cannot unset string offsets";
16031603
break;
16041604
case ZEND_YIELD:

0 commit comments

Comments
 (0)