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 2222#include "zend_enum_arginfo.h"
2323#include "zend_interfaces.h"
2424#include "zend_enum.h"
25+ #include "zend_exceptions.h"
2526
2627#define ZEND_ENUM_DISALLOW_MAGIC_METHOD (propertyName , methodName ) \
2728 do { \
@@ -190,8 +191,7 @@ void zend_enum_build_backed_enum_table(zend_class_entry *ce)
190191 ZEND_ASSERT (backing_type != IS_UNDEF );
191192
192193 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" );
195195 }
196196
197197 ce -> backed_enum_table = emalloc (sizeof (HashTable ));
You can’t perform that action at this time.
0 commit comments