Annotation of embedaddon/php/ext/standard/tests/filters/filter_errors.inc, revision 1.1
1.1 ! misho 1: <?php
! 2:
! 3: function filter_errors_skipif($needle) {
! 4: if (!function_exists('fnmatch')) {
! 5: die('skip fnmatch() not available');
! 6: }
! 7: $filters = stream_get_filters();
! 8: foreach($filters as $filter) {
! 9: if (fnmatch($filter, $needle)) return;
! 10: }
! 11: die("skip $needle not available");
! 12: }
! 13:
! 14: function filter_errors_test($filter, $data) {
! 15:
! 16: echo "test filtering of buffered data\n";
! 17:
! 18: $stream = fopen('php://memory', 'wb+');
! 19:
! 20: fwrite($stream, b".\r\n$data");
! 21: fseek($stream, 0, SEEK_SET);
! 22: stream_get_line($stream, 8192, "\r\n");
! 23:
! 24: $f = stream_filter_append($stream, $filter);
! 25:
! 26: echo "test filtering of non buffered data\n";
! 27:
! 28: $stream = fopen('php://memory', 'wb+');
! 29:
! 30: fwrite($stream, b"$data");
! 31: fseek($stream, 0, SEEK_SET);
! 32:
! 33: stream_filter_append($stream, $filter);
! 34: stream_get_contents($stream);
! 35:
! 36: }
! 37:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>