const mbfl_encoding *enc;
enum mbfl_no_encoding no_enc;
+ ZEND_ASSERT(str_len > 0);
+
enc = php_mb_get_encoding(enc_name, enc_name_arg_num);
if (!enc) {
return -2;
return -2;
}
- if (str_len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty string");
- return -1;
- }
-
{
mbfl_wchar_device dev;
mbfl_convert_filter *filter;
Z_PARAM_STR(enc)
ZEND_PARSE_PARAMETERS_END();
+ if (str_len == 0) {
+ zend_argument_value_error(1, "must not be empty");
+ RETURN_THROWS();
+ }
+
cp = php_mb_ord(str, str_len, enc, 2);
if (0 > cp) {
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
-;
+
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
bool(true)
-
-Warning: mb_ord(): Empty string in %s on line %d
-bool(false)
+mb_ord(): Argument #1 ($str) must not be empty
mb_ord(): Argument #2 ($encoding) must be a valid encoding, "typo" given
mb_ord() does not support the "pass" encoding
mb_ord() does not support the "JIS" encoding