Skip to content

Commit

Permalink
Fixed bug #60613 (Segmentation fault with $cls->{expr}() syntax)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Dec 28, 2011
1 parent 503540a commit c058385
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Jan 2012, PHP 5.4.0 RC5
- Core:
. Fixed bug #60613 (Segmentation fault with $cls->{expr}() syntax). (Dmitry)
. Fixed bug #60611 (Segmentation fault with Cls::{expr}() syntax). (Laruence)

- CLI SAPI:
Expand Down
19 changes: 19 additions & 0 deletions Zend/tests/bug60613.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Bug #60613 (Segmentation fault with $cls->{expr}() syntax)
--FILE--
<?php
class Cls {
function __call($name, $arg) {
}
}

$cls = new Cls();
$cls->{0}();
$cls->{1.0}();
$cls->{true}();
$cls->{false}();
$cls->{null}();
echo "ok\n";
--EXPECT--
ok

3 changes: 2 additions & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
} while (0)

#define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \
if (CG(active_op_array)->literals[literal].cache_slot == \
if (CG(active_op_array)->literals[literal].cache_slot != -1 && \
CG(active_op_array)->literals[literal].cache_slot == \
CG(active_op_array)->last_cache_slot - POLYMORPHIC_CACHE_SLOT_SIZE) { \
CG(active_op_array)->literals[literal].cache_slot = -1; \
CG(active_op_array)->last_cache_slot -= POLYMORPHIC_CACHE_SLOT_SIZE; \
Expand Down

0 comments on commit c058385

Please sign in to comment.