]> granicus.if.org Git - php/commitdiff
Fixed bug #75556 (Invalid opcode 138/1/1)
authorXinchen Hui <laruence@gmail.com>
Fri, 24 Nov 2017 16:54:15 +0000 (00:54 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 24 Nov 2017 16:54:15 +0000 (00:54 +0800)
NEWS
ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/tests/bug75556.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 1c081b4b63a4fe583bae91f4f51dd246538dc2ff..9ed3c42d1a1a9db06d7fd454a6244fc8e4e86520 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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)
index f55aa41428ce94066e5b1fb594a9d1fbb3e3fdee..d50503d4c565d6eeb51ec27b52918539fda0161b 100644 (file)
@@ -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;
diff --git a/ext/opcache/tests/bug75556.phpt b/ext/opcache/tests/bug75556.phpt
new file mode 100644 (file)
index 0000000..1b2511c
--- /dev/null
@@ -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