File tree Expand file tree Collapse file tree 3 files changed +12
-14
lines changed
Expand file tree Collapse file tree 3 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -3870,6 +3870,15 @@ static void preload_check_windows_restrictions(zend_class_entry *scope) {
38703870}
38713871#endif
38723872
3873+ static inline int preload_update_class_constants (zend_class_entry * ce ) {
3874+ /* This is a separate function to work around what appears to be a bug in GCC
3875+ * maybe-uninitialized analysis. */
3876+ zend_try {
3877+ return zend_update_class_constants (ce );
3878+ } zend_end_try ();
3879+ return FAILURE ;
3880+ }
3881+
38733882static zend_class_entry * preload_load_prop_type (zend_property_info * prop , zend_string * name ) {
38743883 zend_class_entry * ce ;
38753884 if (zend_string_equals_literal_ci (name , "self" )) {
@@ -3915,18 +3924,7 @@ static void preload_ensure_classes_loadable() {
39153924#endif
39163925
39173926 if (!(ce -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED )) {
3918- int result = SUCCESS ;
3919- zend_try {
3920- result = zend_update_class_constants (ce );
3921- } zend_catch {
3922- /* Provide some context for the generated error. */
3923- zend_error_noreturn (E_ERROR ,
3924- "Error generated while resolving initializers of class %s during preloading" ,
3925- ZSTR_VAL (ce -> name ));
3926- } zend_end_try ();
3927- if (result == FAILURE ) {
3928- /* Just present to be safe: We generally always throw some
3929- * other fatal error as part of update_class_constants(). */
3927+ if (preload_update_class_constants (ce ) == FAILURE ) {
39303928 zend_error_noreturn (E_ERROR ,
39313929 "Failed to resolve initializers of class %s during preloading" ,
39323930 ZSTR_VAL (ce -> name ));
Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ var_dump(class_exists('Foo'));
1414--EXPECTF--
1515Fatal error: Undefined class constant 'self::DOES_NOT_EXIST' in Unknown on line 0
1616
17- Fatal error: Error generated while resolving initializers of class Foo during preloading in Unknown on line 0
17+ Fatal error: Failed to resolve initializers of class Foo during preloading in Unknown on line 0
Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ Warning: Use of undefined constant UNDEF - assumed 'UNDEF' (this will throw an E
1414
1515Fatal error: Class 'Foo' not found in Unknown on line 0
1616
17- Fatal error: Error generated while resolving initializers of class Test during preloading in Unknown on line 0
17+ Fatal error: Failed to resolve initializers of class Test during preloading in Unknown on line 0
You can’t perform that action at this time.
0 commit comments