import php-7.4.6-4.module+el8.3.0+7002+2eb69d76

This commit is contained in:
CentOS Sources 2020-07-10 01:36:08 +00:00 committed by Andrew Lukoshko
parent 87f2884cc5
commit 06893ad3a7
2 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,74 @@
From df2db7fceaff4f46909f1aa8b31f0a9010631fc9 Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Mon, 8 Jun 2020 11:31:28 +0200
Subject: [PATCH] Fixed bug #79657
Throwing an exception should count as an initialization for this
purpose.
---
NEWS | 2 ++
Zend/tests/bug79657.phpt | 42 ++++++++++++++++++++++++++++++++++++++++
Zend/zend_generators.c | 1 +
3 files changed, 45 insertions(+)
create mode 100644 Zend/tests/bug79657.phpt
diff --git a/Zend/tests/bug79657.phpt b/Zend/tests/bug79657.phpt
new file mode 100644
index 000000000000..fb2ccab3e3ef
--- /dev/null
+++ b/Zend/tests/bug79657.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #79657: "yield from" hangs when invalid value encountered
+--FILE--
+<?php
+
+function throwException(): iterable
+{
+ throw new Exception();
+}
+
+function loop(): iterable
+{
+ $callbacks = [
+ function () {
+ yield 'first';
+ },
+ function () {
+ yield from throwException();
+ }
+ ];
+
+ foreach ($callbacks as $callback) {
+ yield from $callback();
+ }
+}
+
+function get(string $first, int $second): array
+{
+ return [];
+}
+
+get(...loop());
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception in %s:%d
+Stack trace:
+#0 %s(%d): throwException()
+#1 %s(%d): {closure}()
+#2 %s(%d): loop()
+#3 {main}
+ thrown in %s on line %d
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 4cd9087303a3..15bbfca1c58a 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -857,6 +857,7 @@ ZEND_API void zend_generator_resume(zend_generator *orig_generator) /* {{{ */
} else {
generator = zend_generator_get_current(orig_generator);
zend_generator_throw_exception(generator, NULL);
+ orig_generator->flags &= ~ZEND_GENERATOR_DO_INIT;
goto try_again;
}
}

View File

@ -60,7 +60,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: %{upver}%{?rcver:~%{rcver}}
Release: 3%{?dist}
Release: 4%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@ -109,6 +109,7 @@ Patch47: php-5.6.3-phpinfo.patch
# Upstream fixes (100+)
Patch100: php-bug79600.patch
Patch101: php-bug79657.patch
# Security fixes (200+)
@ -721,6 +722,7 @@ in pure PHP.
# upstream patches
%patch100 -p1 -b .bug79600
%patch101 -p1 -b .bug79657
# security patches
@ -1513,6 +1515,9 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || :
%changelog
* Mon Jun 15 2020 Remi Collet <rcollet@redhat.com> - 7.4.6-4
- fix regression in 7.4.6 with generators and exception
* Wed May 27 2020 Remi Collet <rcollet@redhat.com> - 7.4.6-3
- build phpdbg only once
- fix regression in 7.4.6 when yielding an array based generator