Skip to content

Commit

Permalink
Merge branch 'PHP-7.1'
Browse files Browse the repository at this point in the history
* PHP-7.1:
  Fixed bug #73583 (Segfaults when conditionally declared class and function have the same name)
  • Loading branch information
laruence committed Nov 23, 2016
2 parents ae38b9e + a0b2843 commit d98cc74
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/opcache/Optimizer/compact_literals.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
case ZEND_DECLARE_CLASS:
case ZEND_DECLARE_INHERITED_CLASS:
case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1, 0, 2);
LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 0, 0, 2);
break;
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
Expand Down
19 changes: 19 additions & 0 deletions ext/opcache/tests/bug73583.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Bug #73583 (Segfaults when conditionally declared class and function have the same name)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=0x4ff
opcache.file_update_protection=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
if (true) {
class A { }
function A() { }
function A() { }
}
?>
--EXPECTF--
Fatal error: Cannot redeclare A() (previously declared in %sbug73583.php:4) in %sbug73583.php on line 5

0 comments on commit d98cc74

Please sign in to comment.