Looks like prior to 7.3 this just passed the original string
through. Since 7.3 it returns false. Let's stick with that
behavior.
if (output_len) {
*output_len = 0;
}
- if (!input) {
- return NULL;
- }
/* pre-conversion encoding */
ZEND_ASSERT(num_from_encodings >= 1);
&string, from_encodings, num_from_encodings, MBSTRG(strict_detection));
if (!from_encoding) {
php_error_docref(NULL, E_WARNING, "Unable to detect character encoding");
- from_encoding = &mbfl_encoding_pass;
+ return NULL;
}
}
--- /dev/null
+--TEST--
+mb_convert_encoding() when encoding detection fails
+--FILE--
+<?php
+
+var_dump(mb_convert_encoding("\xff", "ASCII", ["UTF-8", "UTF-16"]));
+
+?>
+--EXPECTF--
+Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
+bool(false)