Skip to content

Commit a88a1ea

Browse files
committed
fixup! Deprecate Phar::setStub(resource $stub, int $length)
1 parent dd39ec7 commit a88a1ea

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

ext/phar/tests/phar_stub.phpt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ fclose($fp);
4040
$fp = fopen($fname2, 'rb');
4141

4242
//// 3
43+
$phar->setStub($fp);
44+
fclose($fp);
45+
46+
$fp = fopen($fname, 'rb');
47+
echo fread($fp, strlen($file)) . "\n";
48+
fclose($fp);
49+
50+
$fp = fopen($fname2, 'ab');
51+
fwrite($fp, 'booya');
52+
fclose($fp);
53+
echo file_get_contents($fname2) . "\n";
54+
55+
$fp = fopen($fname2, 'rb');
56+
57+
//// 4
4358
set_error_handler(function ($severity, $message, $file, $line) {
4459
throw new Exception($message);
4560
});
@@ -48,21 +63,16 @@ try {
4863
} catch (Exception $e) {
4964
echo $e->getMessage() . "\n";
5065
}
51-
fclose($fp);
5266
set_error_handler(null);
67+
fclose($fp);
5368

5469
$fp = fopen($fname, 'rb');
5570
echo fread($fp, strlen($file)) . "\n";
5671
fclose($fp);
5772

58-
$fp = fopen($fname2, 'ab');
59-
fwrite($fp, 'booya');
60-
fclose($fp);
61-
echo file_get_contents($fname2) . "\n";
62-
6373
$fp = fopen($fname2, 'rb');
6474

65-
//// 4
75+
//// 5
6676
$phar->setStub($fp, strlen($file));
6777
fclose($fp);
6878

@@ -92,9 +102,12 @@ __HALT_COMPILER();
92102
--EXPECTF--
93103
<?php echo "first stub\n"; __HALT_COMPILER(); ?>
94104
<?php echo "second stub\n"; __HALT_COMPILER(); ?>
95-
Calling Phar::setStub(resource $stub, int $length) is deprecated
105+
106+
Deprecated: Calling Phar::setStub(resource $stub, int $length) is deprecated in %s on line %d
96107
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
97108
<?php echo "third stub\n"; __HALT_COMPILER(); ?>booya
109+
Calling Phar::setStub(resource $stub, int $length) is deprecated
110+
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
98111

99112
Deprecated: Calling Phar::setStub(resource $stub, int $length) is deprecated in %s on line %d
100113
<?php echo "third stub\n"; __HALT_COMPILER(); ?>

0 commit comments

Comments
 (0)