File tree 1 file changed +6
-15
lines changed
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
507
507
return $ b ;
508
508
}
509
509
510
- set_error_handler (static fn ($ t , $ m ) => throw new InvalidArgumentException ($ m ));
511
-
512
510
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 );
524
515
}
525
- } finally {
526
- restore_error_handler ( );
516
+
517
+ $ b -> string = iconv ( ' UTF-8 ' , $ toEncoding , $ this -> string );
527
518
}
528
519
529
520
return $ b ;
You can’t perform that action at this time.
0 commit comments