From 1a98bc95d31f709e9c4a7ff7e1541980f03a7d32 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 14 Sep 2022 14:02:41 +0200
Subject: update to 8.2.0RC2 (new tag)

add patch from https://github.com/php/php-src/pull/9537
---
 failed.txt             | 19 ++++++------
 php-8.2.0-parser.patch |  2 +-
 php-pr9537.patch       | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
 php82.spec             | 16 ++++++++--
 4 files changed, 104 insertions(+), 14 deletions(-)
 create mode 100644 php-pr9537.patch

diff --git a/failed.txt b/failed.txt
index 7a31675..6be36f5 100644
--- a/failed.txt
+++ b/failed.txt
@@ -1,20 +1,19 @@
-===== 8.2.0RC1 (2022-09-01)
+===== 8.2.0RC2 (2022-09-15)
 
 $ grep -ar 'Tests failed' /var/lib/mock/*/build.log
 
-/var/lib/mock/el7x81/build.log:Tests failed   :    2
-/var/lib/mock/el8x81/build.log:Tests failed   :    3
-/var/lib/mock/el9x81/build.log:Tests failed   :    2
-/var/lib/mock/fc35x81/build.log:Tests failed  :    2
-/var/lib/mock/fc36x81/build.log:Tests failed  :    2
-/var/lib/mock/fc37x81/build.log:Tests failed  :    2
+/var/lib/mock/el7x82/build.log:Tests failed   :    0
+/var/lib/mock/el8x82/build.log:Tests failed   :    2
+/var/lib/mock/el9x82/build.log:Tests failed   :    1
+/var/lib/mock/fc35x82/build.log:Tests failed  :    1
+/var/lib/mock/fc36x82/build.log:Tests failed  :    1
+/var/lib/mock/fc37x82/build.log:Tests failed  :    1
 
 
 all:
-        2       FPM: GH-8885 - access.log with stderr begins to write logs to error_log after daemon reload [sapi/fpm/tests/gh8885-stderr-fd-reload-usr2.phpt]
-        2       FPM: GH-8885 - access.log with stderr begins to write logs to error_log after daemon reload [sapi/fpm/tests/gh8885-stderr-fd-reload-usr1.phpt]
+	3	Compatibility of values of same name trait constants is checked after their constant expressions are evaluated [Zend/tests/traits/constant_016.phpt]
 el8x:
-        5       ext/standard/tests/strings/setlocale_variation2.phpt
+	3	ext/standard/tests/strings/setlocale_variation2.phpt
 
 
 1	proc_open give erratic test results :(
diff --git a/php-8.2.0-parser.patch b/php-8.2.0-parser.patch
index 1b4cdaa..dcfe617 100644
--- a/php-8.2.0-parser.patch
+++ b/php-8.2.0-parser.patch
@@ -11,6 +11,6 @@ diff -up ./build/gen_stub.php.syslib ./build/gen_stub.php
 +        return;
 +    }
 +
-     $version = "4.14.0";
+     $version = "4.15.1";
      $phpParserDir = __DIR__ . "/PHP-Parser-$version";
      if (!is_dir($phpParserDir)) {
diff --git a/php-pr9537.patch b/php-pr9537.patch
new file mode 100644
index 0000000..f03c49a
--- /dev/null
+++ b/php-pr9537.patch
@@ -0,0 +1,81 @@
+From 46a32f76549ae7c1399751d64b3cfdee54105833 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 14 Sep 2022 11:08:44 +0200
+Subject: [PATCH] fix tests on systemd enabled build
+
+---
+ .../tests/gh8885-stderr-fd-reload-usr1.phpt   | 16 ++++++++++++----
+ .../tests/gh8885-stderr-fd-reload-usr2.phpt   | 19 ++++++++++++++-----
+ 2 files changed, 26 insertions(+), 9 deletions(-)
+
+diff --git a/sapi/fpm/tests/gh8885-stderr-fd-reload-usr1.phpt b/sapi/fpm/tests/gh8885-stderr-fd-reload-usr1.phpt
+index 4ff8d0660936..c03994ce513d 100644
+--- a/sapi/fpm/tests/gh8885-stderr-fd-reload-usr1.phpt
++++ b/sapi/fpm/tests/gh8885-stderr-fd-reload-usr1.phpt
+@@ -40,7 +40,11 @@ assert($content !== false && strlen($content) > 0, 'File must not be empty');
+ $errorLogLines = explode("\n", $content);
+ array_pop($errorLogLines);
+ 
+-assert(count($errorLogLines) === 2, 'Expected 2 records in the error_log file');
++if (count($errorLogLines) === 3) {
++    assert(strpos($errorLogLines[2], 'systemd'));
++} else {
++    assert(count($errorLogLines) === 2, 'Expected 2 records in the error_log file:' . print_r($errorLogLines, true));
++}
+ assert(strpos($errorLogLines[0], 'NOTICE: fpm is running, pid'));
+ assert(strpos($errorLogLines[1], 'NOTICE: ready to handle connections'));
+ 
+@@ -61,9 +65,13 @@ array_pop($errorLogLines);
+ assert(count($errorLogLines) >= 4, 'Expected at least 4 records in the error_log file');
+ assert(strpos($errorLogLines[0], 'NOTICE: fpm is running, pid'));
+ assert(strpos($errorLogLines[1], 'NOTICE: ready to handle connections'));
+-assert(strpos($errorLogLines[2], 'NOTICE: error log file re-opened'));
+-assert(strpos($errorLogLines[3], 'NOTICE: access log file re-opened'));
+-
++if (strpos($errorLogLines[2], 'systemd')) {
++    assert(strpos($errorLogLines[3], 'NOTICE: error log file re-opened'));
++    assert(strpos($errorLogLines[4], 'NOTICE: access log file re-opened'));
++} else {
++    assert(strpos($errorLogLines[2], 'NOTICE: error log file re-opened'));
++    assert(strpos($errorLogLines[3], 'NOTICE: access log file re-opened'));
++}
+ 
+ $tester->ping('{{ADDR}}');
+ $stderrLines = $tester->getLogLines(-1);
+diff --git a/sapi/fpm/tests/gh8885-stderr-fd-reload-usr2.phpt b/sapi/fpm/tests/gh8885-stderr-fd-reload-usr2.phpt
+index 68d9f6fa68b6..e337c83e89f0 100644
+--- a/sapi/fpm/tests/gh8885-stderr-fd-reload-usr2.phpt
++++ b/sapi/fpm/tests/gh8885-stderr-fd-reload-usr2.phpt
+@@ -40,7 +40,11 @@ assert($content !== false && strlen($content) > 0, 'File must not be empty');
+ $errorLogLines = explode("\n", $content);
+ array_pop($errorLogLines);
+ 
+-assert(count($errorLogLines) === 2, 'Expected 2 records in the error_log file');
++if (count($errorLogLines) === 3) {
++    assert(strpos($errorLogLines[2], 'systemd'));
++} else {
++    assert(count($errorLogLines) === 2, 'Expected 2 records in the error_log file:' . print_r($errorLogLines, true));
++}
+ assert(strpos($errorLogLines[0], 'NOTICE: fpm is running, pid'));
+ assert(strpos($errorLogLines[1], 'NOTICE: ready to handle connections'));
+ 
+@@ -61,10 +65,15 @@ array_pop($errorLogLines);
+ assert(count($errorLogLines) >= 5, 'Expected at least 5 records in the error_log file');
+ assert(strpos($errorLogLines[0], 'NOTICE: fpm is running, pid'));
+ assert(strpos($errorLogLines[1], 'NOTICE: ready to handle connections'));
+-assert(strpos($errorLogLines[2], 'NOTICE: Reloading in progress'));
+-assert(strpos($errorLogLines[3], 'NOTICE: reloading: execvp'));
+-assert(strpos($errorLogLines[4], 'NOTICE: using inherited socket'));
+-
++if (strpos($errorLogLines[2], 'systemd')) {
++    assert(strpos($errorLogLines[3], 'NOTICE: Reloading in progress'));
++    assert(strpos($errorLogLines[4], 'NOTICE: reloading: execvp'));
++    assert(strpos($errorLogLines[5], 'NOTICE: using inherited socket'));
++} else {
++    assert(strpos($errorLogLines[2], 'NOTICE: Reloading in progress'));
++    assert(strpos($errorLogLines[3], 'NOTICE: reloading: execvp'));
++    assert(strpos($errorLogLines[4], 'NOTICE: using inherited socket'));
++}
+ $tester->ping('{{ADDR}}');
+ $stderrLines = $tester->getLogLines(-1);
+ assert(count($stderrLines) === 1, 'Must be only 1 record in the access.log');
diff --git a/php82.spec b/php82.spec
index 9cb36c2..aa06b7d 100644
--- a/php82.spec
+++ b/php82.spec
@@ -108,13 +108,13 @@
 %bcond_with            zip
 
 %global upver          8.2.0
-%global rcver          RC1
-%global lower          RC1
+%global rcver          RC2
+%global lower          RC2
 
 Summary: PHP scripting language for creating dynamic web sites
 Name: php
 Version: %{upver}%{?rcver:~%{lower}}
-Release: 1%{?dist}
+Release: 3%{?dist}
 # All files licensed under PHP version 3.01, except
 # Zend is licensed under Zend
 # TSRM is licensed under BSD
@@ -175,6 +175,7 @@ Patch47: php-8.1.0-phpinfo.patch
 Patch91: php-7.2.0-oci8conf.patch
 
 # Upstream fixes (100+)
+Patch100: php-pr9537.patch
 
 # Security fixes (200+)
 
@@ -1185,6 +1186,7 @@ in pure PHP.
 %patch91 -p1 -b .remi-oci8
 
 # upstream patches
+%patch100 -p1 -b .pr9537
 
 # security patches
 
@@ -1235,6 +1237,7 @@ rm Zend/tests/bug68412.phpt
 rm sapi/cli/tests/upload_2G.phpt
 # tar issue
 rm ext/zlib/tests/004-mb.phpt
+
 # avoid issue when 2 builds run simultaneously (keep 64321 for the SCL)
 %ifarch x86_64
 sed -e 's/64321/64322/' -i ext/openssl/tests/*.phpt
@@ -2180,6 +2183,13 @@ fi
 
 
 %changelog
+* Wed Sep 14 2022 Remi Collet <remi@remirepo.net> - 8.2.0~RC2-3
+- update to 8.2.0RC2 (new tag)
+- add patch from https://github.com/php/php-src/pull/9537
+
+* Wed Sep 14 2022 Remi Collet <remi@remirepo.net> - 8.2.0~RC2-2
+- update to 8.2.0RC2
+
 * Fri Sep  2 2022 Remi Collet <remi@remirepo.net> - 8.2.0~RC1-1
 - update to 8.2.0RC1
 - bump API/ABI
-- 
cgit