Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions ext/intl/intl_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,18 @@ void intl_error_set_custom_msg( intl_error* err, const char* msg)
return;
}

zend_string *method_or_func = get_active_function_or_method_name();
zend_string *prefixed_message = zend_string_concat3(
ZSTR_VAL(method_or_func), ZSTR_LEN(method_or_func),
ZEND_STRL("(): "),
msg, strlen(msg)
);
zend_string_release_ex(method_or_func, false);
zend_string *prefixed_message;
if (zend_is_executing()) {
zend_string *method_or_func = get_active_function_or_method_name();
prefixed_message = zend_string_concat3(
ZSTR_VAL(method_or_func), ZSTR_LEN(method_or_func),
ZEND_STRL("(): "),
msg, strlen(msg)
);
zend_string_release_ex(method_or_func, false);
} else {
prefixed_message = zend_string_init(msg, strlen(msg), false);
}

if( !err ) {
if (INTL_G(error_level)) {
Expand Down
21 changes: 21 additions & 0 deletions ext/intl/tests/uconverter_shutdown_subclass.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
UConverter subclass destroyed at request shutdown does not crash
--EXTENSIONS--
intl
--FILE--
<?php
class MyConverter extends UConverter {
public function toUCallback($reason, $source, $codeUnits, &$error): string|int|array|null {
return '?';
}

public function fromUCallback($reason, $source, $codePoint, &$error): string|int|array|null {
return '?';
}
}

$converter = new MyConverter('ascii', 'utf-8');
echo 'end of script', PHP_EOL;
?>
--EXPECT--
end of script
Loading