<?php
/* Open a test file for reading and writing */
$fp = fopen("test.txt", "rw");
$rot13_filter = stream_filter_append($fp, "string.rot13", STREAM_FILTER_WRITE);
fwrite($fp, "This is ");
stream_filter_remove($rot13_filter);
fwrite($fp, "a test\n");
rewind($fp);
fpassthru($fp);
fclose($fp);
?>
Warning: fopen(): open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Q6usD on line 3
Warning: fopen(test.txt): Failed to open stream: Operation not permitted in /in/Q6usD on line 3
Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, false given in /in/Q6usD:5
Stack trace:
#0 /in/Q6usD(5): stream_filter_append(false, 'string.rot13', 2)
#1 {main}
thrown in /in/Q6usD on line 5
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Warning: fopen(): open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Q6usD on line 3
Warning: fopen(test.txt): Failed to open stream: Operation not permitted in /in/Q6usD on line 3
Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, false given in /in/Q6usD:5
Stack trace:
#0 /in/Q6usD(5): stream_filter_append(false, 'string.rot13', 2)
#1 {main}
thrown in /in/Q6usD on line 5
Process exited with code 255.
Warning: fopen(): open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Q6usD on line 3
Warning: fopen(test.txt): Failed to open stream: Operation not permitted in /in/Q6usD on line 3
Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/Q6usD:5
Stack trace:
#0 /in/Q6usD(5): stream_filter_append(false, 'string.rot13', 2)
#1 {main}
thrown in /in/Q6usD on line 5
Process exited with code 255.
Output for 8.0.13
Warning: fopen(test.txt): Failed to open stream: No such file or directory in /in/Q6usD on line 3
Fatal error: Uncaught TypeError: stream_filter_append(): Argument #1 ($stream) must be of type resource, bool given in /in/Q6usD:5
Stack trace:
#0 /in/Q6usD(5): stream_filter_append(false, 'string.rot13', 2)
#1 {main}
thrown in /in/Q6usD on line 5
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: fopen(test.txt): failed to open stream: No such file or directory in /in/Q6usD on line 3
Warning: stream_filter_append() expects parameter 1 to be resource, bool given in /in/Q6usD on line 5
Warning: fwrite() expects parameter 1 to be resource, bool given in /in/Q6usD on line 6
Warning: stream_filter_remove() expects parameter 1 to be resource, bool given in /in/Q6usD on line 7
Warning: fwrite() expects parameter 1 to be resource, bool given in /in/Q6usD on line 8
Warning: rewind() expects parameter 1 to be resource, bool given in /in/Q6usD on line 10
Warning: fpassthru() expects parameter 1 to be resource, bool given in /in/Q6usD on line 11
Warning: fclose() expects parameter 1 to be resource, bool given in /in/Q6usD on line 12
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
Warning: fopen(): open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Q6usD on line 3
Warning: fopen(test.txt): failed to open stream: Operation not permitted in /in/Q6usD on line 3
Warning: stream_filter_append() expects parameter 1 to be resource, bool given in /in/Q6usD on line 5
Warning: fwrite() expects parameter 1 to be resource, bool given in /in/Q6usD on line 6
Warning: stream_filter_remove() expects parameter 1 to be resource, bool given in /in/Q6usD on line 7
Warning: fwrite() expects parameter 1 to be resource, bool given in /in/Q6usD on line 8
Warning: rewind() expects parameter 1 to be resource, bool given in /in/Q6usD on line 10
Warning: fpassthru() expects parameter 1 to be resource, bool given in /in/Q6usD on line 11
Warning: fclose() expects parameter 1 to be resource, bool given in /in/Q6usD on line 12
Output for 5.6.38, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Warning: fopen(): open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Q6usD on line 3
Warning: fopen(test.txt): failed to open stream: Operation not permitted in /in/Q6usD on line 3
Warning: stream_filter_append() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 5
Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 6
Warning: stream_filter_remove() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 7
Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 8
Warning: rewind() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 10
Warning: fpassthru() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 11
Warning: fclose() expects parameter 1 to be resource, boolean given in /in/Q6usD on line 12