Skip to content

Commit c412b8b

Browse files
committed
Fixed bug #75556 (Invalid opcode 138/1/1)
1 parent 0dbb327 commit c412b8b

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PHP NEWS
99
. Fixed bug #74862 (Unable to clone instance when private __clone defined).
1010
(Daniel Ciochiu)
1111

12+
- Opcache:
13+
. Fixed bug #75556 (Invalid opcode 138/1/1). (Laruence)
14+
1215
- PCRE:
1316
. Fixed bug #74183 (preg_last_error not returning error code after error).
1417
(Andrew Nester)

ext/opcache/Optimizer/zend_optimizer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
306306
/* This would require a non-local change.
307307
* zend_optimizer_replace_by_const() supports this. */
308308
return 0;
309+
case ZEND_INSTANCEOF:
310+
return 0;
309311
case ZEND_CASE:
310312
case ZEND_FETCH_LIST:
311313
return 0;

ext/opcache/tests/bug75556.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #75556 (Invalid opcode 138/1/1)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
<?php
11+
function createFromFormat($format, $date, ?\DateTimeZone $tz = null): ?\DateTimeInterface
12+
{
13+
if ($tz !== null
14+
|| ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true))
15+
) {
16+
$msg = 'Date objects must have UTC as their timezone';
17+
throw new \UnexpectedValueException($msg);
18+
}
19+
20+
return null;
21+
}
22+
23+
var_dump(createFromFormat('m/d/Y', '12/07/2017', null));
24+
?>
25+
--EXPECT--
26+
NULL

0 commit comments

Comments
 (0)