File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test failure of updating class constants
3
+ --FILE--
4
+ <?php
5
+
6
+ enum Foo: string {
7
+ const Bar = NONEXISTENT ;
8
+ }
9
+
10
+ ?>
11
+ --EXPECTF--
12
+ Fatal error: During updating of class constants: Uncaught Error: Undefined constant "NONEXISTENT" in %s:%d
13
+ Stack trace:
14
+ #0 {main} in %s on line %d
Original file line number Diff line number Diff line change 22
22
#include "zend_enum_arginfo.h"
23
23
#include "zend_interfaces.h"
24
24
#include "zend_enum.h"
25
+ #include "zend_exceptions.h"
25
26
26
27
#define ZEND_ENUM_DISALLOW_MAGIC_METHOD (propertyName , methodName ) \
27
28
do { \
@@ -190,8 +191,7 @@ void zend_enum_build_backed_enum_table(zend_class_entry *ce)
190
191
ZEND_ASSERT (backing_type != IS_UNDEF );
191
192
192
193
if (zend_update_class_constants (ce ) == FAILURE ) {
193
- // FIXME: What's the right way to error here?
194
- zend_error_noreturn (E_COMPILE_ERROR , "Could not update class constants" );
194
+ zend_exception_uncaught_error ("During updating of class constants" );
195
195
}
196
196
197
197
ce -> backed_enum_table = emalloc (sizeof (HashTable ));
You can’t perform that action at this time.
0 commit comments