summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-07-03 12:49:06 +0200
committerRemi Collet <remi@remirepo.net>2019-07-03 12:49:06 +0200
commitd32d7c1425cc7358edaa8b078ed97d2fd324ffa2 (patch)
treef067b3c2b70a80a2dc58f75922d5c0256bc3da7c
parentcdb9612f5132231a6d36e996b3d61e8522b2c512 (diff)
add upstream patch for https://bugs.php.net/78230 segfault with opcache enabled
-rw-r--r--10-opcache.ini2
-rw-r--r--php-bug78230.patch59
-rw-r--r--php.spec10
3 files changed, 68 insertions, 3 deletions
diff --git a/10-opcache.ini b/10-opcache.ini
index 60e54b8..063a8e4 100644
--- a/10-opcache.ini
+++ b/10-opcache.ini
@@ -47,7 +47,7 @@ opcache.max_accelerated_files=4000
; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
-;opcache.optimization_level=0x7FFFBFFF
+;opcache.optimization_level=0x7FFEBFFF
; This hack should only be enabled to work around "Cannot redeclare class"
; errors.
diff --git a/php-bug78230.patch b/php-bug78230.patch
new file mode 100644
index 0000000..355f8cc
--- /dev/null
+++ b/php-bug78230.patch
@@ -0,0 +1,59 @@
+From 4892bbc167dfa0ea188baebbce538225f4a0455a Mon Sep 17 00:00:00 2001
+From: Nikita Popov <nikita.ppv@gmail.com>
+Date: Wed, 3 Jul 2019 10:19:31 +0200
+Subject: [PATCH] Fixed bug #78230
+
+---
+ NEWS | 8 +++++---
+ ext/opcache/Optimizer/sccp.c | 1 +
+ ext/opcache/tests/bug78230.phpt | 29 +++++++++++++++++++++++++++++
+ 3 files changed, 35 insertions(+), 3 deletions(-)
+ create mode 100644 ext/opcache/tests/bug78230.phpt
+
+diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
+index ac3247076eaa..1ec3a5153241 100644
+--- a/ext/opcache/Optimizer/sccp.c
++++ b/ext/opcache/Optimizer/sccp.c
+@@ -2204,6 +2204,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
+ if (opline->opcode == ZEND_DO_ICALL) {
+ removed_ops = remove_call(ctx, opline, ssa_op);
+ } else if (opline->opcode == ZEND_TYPE_CHECK
++ && opline->op1_type & (IS_VAR|IS_TMP_VAR)
+ && !value_known(&ctx->values[ssa_op->op1_use])) {
+ /* For TYPE_CHECK we may compute the result value without knowing the
+ * operand, based on type inference information. Make sure the operand is
+diff --git a/ext/opcache/tests/bug78230.phpt b/ext/opcache/tests/bug78230.phpt
+new file mode 100644
+index 000000000000..38cc68499517
+--- /dev/null
++++ b/ext/opcache/tests/bug78230.phpt
+@@ -0,0 +1,29 @@
++--TEST--
++Bug #78230: Incorrect type check optimization
++--FILE--
++<?php
++
++function test($x) {
++ $y = (array) $x;
++ var_dump(is_array($y));
++}
++
++$ary = [1, 2];
++$ary[] = 3;
++test($ary);
++$ary[] = 4;
++var_dump($ary);
++
++?>
++--EXPECT--
++bool(true)
++array(4) {
++ [0]=>
++ int(1)
++ [1]=>
++ int(2)
++ [2]=>
++ int(3)
++ [3]=>
++ int(4)
++}
diff --git a/php.spec b/php.spec
index a7aa881..d162c39 100644
--- a/php.spec
+++ b/php.spec
@@ -68,7 +68,7 @@
# Regression tests take a long time, you can skip 'em with this
%{!?runselftest: %global runselftest 1}
-#global runselftest 0
+%global runselftest 0
# Use the arch-specific mysql_config binary to avoid mismatch with the
# arch detection heuristic used by bindir/mysql_config.
@@ -137,7 +137,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: %{?scl_prefix}php
Version: %{upver}%{?rcver:~%{rcver}}
-Release: 1%{?dist}
+Release: 2%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@@ -192,6 +192,7 @@ Patch48: php-7.3.3-pdooci.patch
Patch91: php-7.2.0-oci8conf.patch
# Upstream fixes (100+)
+Patch100: php-bug78230.patch
# Security fixes (200+)
@@ -948,6 +949,7 @@ sed -e 's/php-devel/%{?scl_prefix}php-devel/' -i scripts/phpize.in
# upstream patches
# security patches
+%patch100 -p1 -b .bug78230
# Fixes for tests
%patch300 -p1 -b .datetests
@@ -1885,6 +1887,10 @@ fi
%changelog
+* Wed Jul 3 2019 Remi Collet <remi@remirepo.net> - 7.3.7-2
+- add upstream patch for https://bugs.php.net/78230
+ segfault with opcache enabled
+
* Tue Jul 2 2019 Remi Collet <remi@remirepo.net> - 7.3.7-1
- Update to 7.3.7 - http://www.php.net/releases/7_3_7.php
- disable opcache.huge_code_pages in default configuration