From 517d7d909da6f9773c543cf682ea71e67a3b4d66 Mon Sep 17 00:00:00 2001 From: Eric Mann Date: Wed, 12 Mar 2025 06:34:55 -0700 Subject: [PATCH 1/2] PHP-8.3 is now for PHP-8.3.20-dev --- NEWS | 4 ++-- Zend/zend.h | 2 +- configure.ac | 2 +- main/php_version.h | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index c54938982f5fa..e899b8ac86ce8 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? ????, PHP 8.3.19 +?? ??? ????, PHP 8.3.20 - DOM: . Fix weird unpack behaviour in DOM. (nielsdos) @@ -19,7 +19,7 @@ PHP NEWS - Treewide: . Fixed bug GH-17736 (Assertion failure zend_reference_destroy()). (nielsdos) -27 Feb 2025, PHP 8.3.18 +13 Feb 2025, PHP 8.3.19 - BCMath: . Fixed bug GH-17398 (bcmul memory leak). (SakiTakamachi) diff --git a/Zend/zend.h b/Zend/zend.h index e795ac967a23d..927088ea18706 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "4.3.19-dev" +#define ZEND_VERSION "4.3.20-dev" #define ZEND_ENGINE_3 diff --git a/configure.ac b/configure.ac index 0e98613854281..a94d4958492fd 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice. dnl ---------------------------------------------------------------------------- AC_PREREQ([2.68]) -AC_INIT([PHP],[8.3.19-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) +AC_INIT([PHP],[8.3.20-dev],[https://github.com/php/php-src/issues],[php],[https://www.php.net]) AC_CONFIG_SRCDIR([main/php_version.h]) AC_CONFIG_AUX_DIR([build]) AC_PRESERVE_HELP_ORDER diff --git a/main/php_version.h b/main/php_version.h index 8b508aaa33585..3dee6de933251 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.ac to change version number */ #define PHP_MAJOR_VERSION 8 #define PHP_MINOR_VERSION 3 -#define PHP_RELEASE_VERSION 19 +#define PHP_RELEASE_VERSION 20 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "8.3.19-dev" -#define PHP_VERSION_ID 80319 +#define PHP_VERSION "8.3.20-dev" +#define PHP_VERSION_ID 80320 From 8731c95b35f6838bacd12a07c50886e020aad5a6 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 3 Mar 2025 12:26:06 +0100 Subject: [PATCH 2/2] Make missing trait error recoverable We were already handling NULL as a case, but seem to have forgotten to pass the ZEND_FETCH_CLASS_EXCEPTION flag. Also make "is not a trait" error recoverable, there's no reason why it can't be. Fixes GH-17959 Closes GH-17960 --- NEWS | 2 ++ Zend/tests/traits/bugs/missing-trait.phpt | 5 ++++- Zend/tests/traits/error_002.phpt | 5 ++++- Zend/tests/traits/error_003.phpt | 5 ++++- Zend/tests/traits/error_004.phpt | 5 ++++- Zend/tests/traits/error_005.phpt | 5 ++++- Zend/tests/traits/error_006.phpt | 5 ++++- Zend/tests/traits/gh17959.phpt | 18 ++++++++++++++++++ Zend/zend_inheritance.c | 4 ++-- 9 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 Zend/tests/traits/gh17959.phpt diff --git a/NEWS b/NEWS index 18e1f76dabe2c..2268ebedc7b45 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,8 @@ PHP NEWS . Fixed bug GH-17442 (Engine UAF with reference assign and dtor). (nielsdos) . Improved error message of UnhandledMatchError for zend.exception_string_param_max_len=0. (timwolla) + . Fixed bug GH-17959 (Relax missing trait fatal error to error exception). + (ilutov) - Curl: . Added curl_multi_get_handles(). (timwolla) diff --git a/Zend/tests/traits/bugs/missing-trait.phpt b/Zend/tests/traits/bugs/missing-trait.phpt index 4bf054e889002..0b36c47e771d7 100644 --- a/Zend/tests/traits/bugs/missing-trait.phpt +++ b/Zend/tests/traits/bugs/missing-trait.phpt @@ -12,4 +12,7 @@ $test = new TraitsTest(); ?> --EXPECTF-- -Fatal error: Trait "THello" not found in %s on line %d +Fatal error: Uncaught Error: Trait "THello" not found in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/error_002.phpt b/Zend/tests/traits/error_002.phpt index 53ad403a43373..fc9cfc5884c4c 100644 --- a/Zend/tests/traits/error_002.phpt +++ b/Zend/tests/traits/error_002.phpt @@ -9,4 +9,7 @@ class A { ?> --EXPECTF-- -Fatal error: Trait "abc" not found in %s on line %d +Fatal error: Uncaught Error: Trait "abc" not found in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/error_003.phpt b/Zend/tests/traits/error_003.phpt index fdfa0ac1fe22b..6a6d2d56d6c41 100644 --- a/Zend/tests/traits/error_003.phpt +++ b/Zend/tests/traits/error_003.phpt @@ -12,4 +12,7 @@ class A { ?> --EXPECTF-- -Fatal error: A cannot use abc - it is not a trait in %s on line %d +Fatal error: Uncaught Error: A cannot use abc - it is not a trait in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/error_004.phpt b/Zend/tests/traits/error_004.phpt index d7ff695e047b3..1e339f3d6314d 100644 --- a/Zend/tests/traits/error_004.phpt +++ b/Zend/tests/traits/error_004.phpt @@ -12,4 +12,7 @@ class A { ?> --EXPECTF-- -Fatal error: A cannot use abc - it is not a trait in %s on line %d +Fatal error: Uncaught Error: A cannot use abc - it is not a trait in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/error_005.phpt b/Zend/tests/traits/error_005.phpt index 3b8cc32f97584..dae8e1893a68c 100644 --- a/Zend/tests/traits/error_005.phpt +++ b/Zend/tests/traits/error_005.phpt @@ -12,4 +12,7 @@ class A { ?> --EXPECTF-- -Fatal error: A cannot use abc - it is not a trait in %s on line %d +Fatal error: Uncaught Error: A cannot use abc - it is not a trait in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/error_006.phpt b/Zend/tests/traits/error_006.phpt index f3ed87123cf29..5d831a9da7f12 100644 --- a/Zend/tests/traits/error_006.phpt +++ b/Zend/tests/traits/error_006.phpt @@ -12,4 +12,7 @@ class A { ?> --EXPECTF-- -Fatal error: A cannot use abc - it is not a trait in %s on line %d +Fatal error: Uncaught Error: A cannot use abc - it is not a trait in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/traits/gh17959.phpt b/Zend/tests/traits/gh17959.phpt new file mode 100644 index 0000000000000..016dd7a4a4f7c --- /dev/null +++ b/Zend/tests/traits/gh17959.phpt @@ -0,0 +1,18 @@ +--TEST-- +GH-17959: Missing trait error is recoverable +--FILE-- +getMessage(), "\n"; +} + +?> +===DONE=== +--EXPECT-- +Error: Trait "MissingTrait" not found +===DONE=== diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 807c902276a24..bcccf978e2a01 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -3546,13 +3546,13 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string for (i = 0; i < ce->num_traits; i++) { zend_class_entry *trait = zend_fetch_class_by_name(ce->trait_names[i].name, - ce->trait_names[i].lc_name, ZEND_FETCH_CLASS_TRAIT); + ce->trait_names[i].lc_name, ZEND_FETCH_CLASS_TRAIT | ZEND_FETCH_CLASS_EXCEPTION); if (UNEXPECTED(trait == NULL)) { free_alloca(traits_and_interfaces, use_heap); return NULL; } if (UNEXPECTED(!(trait->ce_flags & ZEND_ACC_TRAIT))) { - zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name)); + zend_throw_error(NULL, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name)); free_alloca(traits_and_interfaces, use_heap); return NULL; }