Skip to content

Commit

Permalink
Fixed bug #75556 (Invalid opcode 138/1/1)
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Nov 24, 2017
1 parent 0dbb327 commit c412b8b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ PHP NEWS
. Fixed bug #74862 (Unable to clone instance when private __clone defined).
(Daniel Ciochiu)

- Opcache:
. Fixed bug #75556 (Invalid opcode 138/1/1). (Laruence)

- PCRE:
. Fixed bug #74183 (preg_last_error not returning error code after error).
(Andrew Nester)
Expand Down
2 changes: 2 additions & 0 deletions ext/opcache/Optimizer/zend_optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
/* This would require a non-local change.
* zend_optimizer_replace_by_const() supports this. */
return 0;
case ZEND_INSTANCEOF:
return 0;
case ZEND_CASE:
case ZEND_FETCH_LIST:
return 0;
Expand Down
26 changes: 26 additions & 0 deletions ext/opcache/tests/bug75556.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
Bug #75556 (Invalid opcode 138/1/1)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function createFromFormat($format, $date, ?\DateTimeZone $tz = null): ?\DateTimeInterface
{
if ($tz !== null
|| ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true))
) {
$msg = 'Date objects must have UTC as their timezone';
throw new \UnexpectedValueException($msg);
}

return null;
}

var_dump(createFromFormat('m/d/Y', '12/07/2017', null));
?>
--EXPECT--
NULL

0 comments on commit c412b8b

Please sign in to comment.