File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed
src/Symfony/Component/String Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -507,23 +507,14 @@ public function toByteString(string $toEncoding = null): ByteString
507507 return $ b ;
508508 }
509509
510- set_error_handler (static fn ($ t , $ m ) => throw new InvalidArgumentException ($ m ));
511-
512510 try {
513- try {
514- $ b ->string = mb_convert_encoding ($ this ->string , $ toEncoding , 'UTF-8 ' );
515- } catch (InvalidArgumentException |\ValueError $ e ) {
516- if (!\function_exists ('iconv ' )) {
517- if ($ e instanceof \ValueError) {
518- throw new InvalidArgumentException ($ e ->getMessage (), $ e ->getCode (), $ e );
519- }
520- throw $ e ;
521- }
522-
523- $ b ->string = iconv ('UTF-8 ' , $ toEncoding , $ this ->string );
511+ $ b ->string = mb_convert_encoding ($ this ->string , $ toEncoding , 'UTF-8 ' );
512+ } catch (\ValueError $ e ) {
513+ if (!\function_exists ('iconv ' )) {
514+ throw new InvalidArgumentException ($ e ->getMessage (), $ e ->getCode (), $ e );
524515 }
525- } finally {
526- restore_error_handler ( );
516+
517+ $ b -> string = iconv ( ' UTF-8 ' , $ toEncoding , $ this -> string );
527518 }
528519
529520 return $ b ;
You can’t perform that action at this time.
0 commit comments