Skip to content

Commit 7c1316e

Browse files
committed
Fixed bug #79535
We did not allocate a cache slot for FETCH_CLASS. This is already fixed on newer PHP versions.
1 parent d950969 commit 7c1316e

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.19
44

5+
- Opcache:
6+
. Fixed bug #79535 (PHP crashes with specific opcache.optimization_level).
7+
(Nikita)
8+
59
- SimpleXML:
610
. Fixed bug #79528 (Different object of the same xml between 7.4.5 and
711
7.4.4). (cmb)

ext/opcache/Optimizer/zend_optimizer.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,19 +391,20 @@ int zend_optimizer_update_op2_const(zend_op_array *op_array,
391391
(opline + 1)->op2.var == opline->result.var) {
392392
return 0;
393393
}
394-
case ZEND_ADD_INTERFACE:
395-
case ZEND_ADD_TRAIT:
394+
/* break missing intentionally */
395+
case ZEND_INSTANCEOF:
396396
REQUIRES_STRING(val);
397397
drop_leading_backslash(val);
398398
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
399399
zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val)));
400+
opline->extended_value = alloc_cache_slots(op_array, 1);
400401
break;
401-
case ZEND_INSTANCEOF:
402+
case ZEND_ADD_INTERFACE:
403+
case ZEND_ADD_TRAIT:
402404
REQUIRES_STRING(val);
403405
drop_leading_backslash(val);
404406
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
405407
zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val)));
406-
opline->extended_value = alloc_cache_slots(op_array, 1);
407408
break;
408409
case ZEND_INIT_FCALL_BY_NAME:
409410
REQUIRES_STRING(val);

ext/opcache/tests/bug79535.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #79535: PHP crashes with specific opcache.optimization_level
3+
--INI--
4+
opcache.optimization_level=0x000000a0
5+
--FILE--
6+
<?php
7+
function create() {
8+
$name = stdClass::class;
9+
return new $name;
10+
}
11+
var_dump(create());
12+
?>
13+
--EXPECT--
14+
object(stdClass)#1 (0) {
15+
}

0 commit comments

Comments
 (0)