@@ -323,8 +323,9 @@ function _installFile($file, $atts, $tmp_path, $options)
323
323
}
324
324
325
325
if (!@copy ($ orig_file , $ dest_file )) {
326
- return $ this ->raiseError ("failed to write $ dest_file: $ php_errormsg " ,
327
- PEAR_INSTALLER_FAILED );
326
+ return $ this ->raiseError (
327
+ "failed to write $ dest_file: " . error_get_last ()["message " ],
328
+ PEAR_INSTALLER_FAILED );
328
329
}
329
330
330
331
$ this ->log (3 , "+ cp $ orig_file $ dest_file " );
@@ -399,13 +400,15 @@ function _installFile($file, $atts, $tmp_path, $options)
399
400
400
401
$ wp = @fopen ($ dest_file , "wb " );
401
402
if (!is_resource ($ wp )) {
402
- return $ this ->raiseError ("failed to create $ dest_file: $ php_errormsg " ,
403
- PEAR_INSTALLER_FAILED );
403
+ return $ this ->raiseError (
404
+ "failed to create $ dest_file: " . error_get_last ()["message " ],
405
+ PEAR_INSTALLER_FAILED );
404
406
}
405
407
406
408
if (@fwrite ($ wp , $ contents ) === false ) {
407
- return $ this ->raiseError ("failed writing to $ dest_file: $ php_errormsg " ,
408
- PEAR_INSTALLER_FAILED );
409
+ return $ this ->raiseError (
410
+ "failed writing to $ dest_file: " . error_get_last ()["message " ],
411
+ PEAR_INSTALLER_FAILED );
409
412
}
410
413
411
414
fclose ($ wp );
@@ -452,7 +455,8 @@ function _installFile($file, $atts, $tmp_path, $options)
452
455
$ this ->addFileOperation ("chmod " , array ($ mode , $ dest_file ));
453
456
if (!@chmod ($ dest_file , $ mode )) {
454
457
if (!isset ($ options ['soft ' ])) {
455
- $ this ->log (0 , "failed to change mode of $ dest_file: $ php_errormsg " );
458
+ $ this ->log (0 , "failed to change mode of $ dest_file: " .
459
+ error_get_last ()["message " ]);
456
460
}
457
461
}
458
462
}
@@ -562,8 +566,9 @@ function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options)
562
566
}
563
567
564
568
if (!@copy ($ orig_file , $ dest_file )) {
565
- return $ this ->raiseError ("failed to write $ dest_file: $ php_errormsg " ,
566
- PEAR_INSTALLER_FAILED );
569
+ return $ this ->raiseError (
570
+ "failed to write $ dest_file: " . error_get_last ()["message " ],
571
+ PEAR_INSTALLER_FAILED );
567
572
}
568
573
569
574
$ this ->log (3 , "+ cp $ orig_file $ dest_file " );
@@ -605,13 +610,15 @@ function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options)
605
610
606
611
$ wp = @fopen ($ dest_file , "wb " );
607
612
if (!is_resource ($ wp )) {
608
- return $ this ->raiseError ("failed to create $ dest_file: $ php_errormsg " ,
609
- PEAR_INSTALLER_FAILED );
613
+ return $ this ->raiseError (
614
+ "failed to create $ dest_file: " . error_get_last ()["message " ],
615
+ PEAR_INSTALLER_FAILED );
610
616
}
611
617
612
618
if (fwrite ($ wp , $ contents ) === false ) {
613
- return $ this ->raiseError ("failed writing to $ dest_file: $ php_errormsg " ,
614
- PEAR_INSTALLER_FAILED );
619
+ return $ this ->raiseError (
620
+ "failed writing to $ dest_file: " . error_get_last ()["message " ],
621
+ PEAR_INSTALLER_FAILED );
615
622
}
616
623
617
624
fclose ($ wp );
@@ -667,7 +674,8 @@ function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options)
667
674
$ this ->addFileOperation ("chmod " , array ($ mode , $ dest_file ));
668
675
if (!@chmod ($ dest_file , $ mode )) {
669
676
if (!isset ($ options ['soft ' ])) {
670
- $ this ->log (0 , "failed to change mode of $ dest_file: $ php_errormsg " );
677
+ $ this ->log (0 , "failed to change mode of $ dest_file: " .
678
+ error_get_last ()["message " ]);
671
679
}
672
680
}
673
681
}
@@ -854,7 +862,7 @@ function commitFileTransaction()
854
862
855
863
if (!@copy ($ data [0 ], $ data [0 ] . '.bak ' )) {
856
864
$ this ->log (1 , 'Could not copy ' . $ data [0 ] . ' to ' . $ data [0 ] .
857
- '.bak ' . $ php_errormsg );
865
+ '.bak ' . error_get_last ()[ " message " ] );
858
866
return false ;
859
867
}
860
868
$ this ->log (3 , "+ backup $ data [0 ] to $ data [0 ].bak " );
@@ -889,7 +897,7 @@ function commitFileTransaction()
889
897
$ perms = @fileperms ($ data [0 ]);
890
898
if (!@copy ($ data [0 ], $ data [1 ])) {
891
899
$ this ->log (1 , 'Could not rename ' . $ data [0 ] . ' to ' . $ data [1 ] .
892
- ' ' . $ php_errormsg );
900
+ ' ' . error_get_last ()[ " message " ] );
893
901
return false ;
894
902
}
895
903
@@ -901,7 +909,7 @@ function commitFileTransaction()
901
909
case 'chmod ' :
902
910
if (!@chmod ($ data [1 ], $ data [0 ])) {
903
911
$ this ->log (1 , 'Could not chmod ' . $ data [1 ] . ' to ' .
904
- decoct ($ data [0 ]) . ' ' . $ php_errormsg );
912
+ decoct ($ data [0 ]) . ' ' . error_get_last ()[ " message " ] );
905
913
return false ;
906
914
}
907
915
@@ -912,7 +920,7 @@ function commitFileTransaction()
912
920
if (file_exists ($ data [0 ])) {
913
921
if (!@unlink ($ data [0 ])) {
914
922
$ this ->log (1 , 'Could not delete ' . $ data [0 ] . ' ' .
915
- $ php_errormsg );
923
+ error_get_last ()[ " message " ] );
916
924
return false ;
917
925
}
918
926
$ this ->log (3 , "+ rm $ data [0 ]" );
@@ -934,7 +942,7 @@ function commitFileTransaction()
934
942
closedir ($ testme );
935
943
if (!@rmdir ($ data [0 ])) {
936
944
$ this ->log (1 , 'Could not rmdir ' . $ data [0 ] . ' ' .
937
- $ php_errormsg );
945
+ error_get_last ()[ " message " ] );
938
946
return false ;
939
947
}
940
948
$ this ->log (3 , "+ rmdir $ data [0 ]" );
@@ -1553,7 +1561,9 @@ function _compileSourceFiles($savechannel, &$filelist)
1553
1561
}
1554
1562
1555
1563
if (!@copy ($ ext ['file ' ], $ copyto )) {
1556
- return $ this ->raiseError ("failed to write $ copyto ( $ php_errormsg) " , PEAR_INSTALLER_FAILED );
1564
+ return $ this ->raiseError (
1565
+ "failed to write $ copyto ( " . error_get_last ()["message " ] . ") " ,
1566
+ PEAR_INSTALLER_FAILED );
1557
1567
}
1558
1568
1559
1569
$ this ->log (3 , "+ cp $ ext [file] $ copyto " );
@@ -1562,7 +1572,8 @@ function _compileSourceFiles($savechannel, &$filelist)
1562
1572
$ mode = 0666 & ~(int )octdec ($ this ->config ->get ('umask ' ));
1563
1573
$ this ->addFileOperation ('chmod ' , array ($ mode , $ copyto ));
1564
1574
if (!@chmod ($ copyto , $ mode )) {
1565
- $ this ->log (0 , "failed to change mode of $ copyto ( $ php_errormsg) " );
1575
+ $ this ->log (0 , "failed to change mode of $ copyto ( " .
1576
+ error_get_last ()["message " ] . ") " );
1566
1577
}
1567
1578
}
1568
1579
}
0 commit comments