1--TEST-- 2bzread() tests with invalid files 3--SKIPIF-- 4<?php if (!extension_loaded("bz2")) print "skip"; ?> 5--FILE-- 6<?php 7 8$fd = bzopen(__DIR__."/004_1.txt.bz2","r"); 9var_dump(bzerror($fd)); 10var_dump(bzerrstr($fd)); 11var_dump(bzerrno($fd)); 12 13$fd2 = bzopen(__DIR__."/004_2.txt.bz2","r"); 14var_dump(bzerror($fd2)); 15var_dump(bzerrstr($fd2)); 16var_dump(bzerrno($fd2)); 17 18var_dump(bzread($fd, 10)); 19var_dump(bzerror($fd)); 20var_dump(bzerrstr($fd)); 21var_dump(bzerrno($fd)); 22 23var_dump(bzread($fd2, 10)); 24var_dump(bzerror($fd2)); 25var_dump(bzerrstr($fd2)); 26var_dump(bzerrno($fd2)); 27 28var_dump(bzread($fd)); 29var_dump(bzerror($fd)); 30var_dump(bzerrstr($fd)); 31var_dump(bzerrno($fd)); 32 33var_dump(bzread($fd2)); 34var_dump(bzerror($fd2)); 35var_dump(bzerrstr($fd2)); 36var_dump(bzerrno($fd2)); 37 38bzclose($fd2); 39var_dump(bzread($fd2)); 40var_dump(bzerror($fd2)); 41var_dump(bzerrstr($fd2)); 42var_dump(bzerrno($fd2)); 43 44echo "Done\n"; 45?> 46--EXPECTF-- 47array(2) { 48 ["errno"]=> 49 int(0) 50 ["errstr"]=> 51 string(2) "OK" 52} 53string(2) "OK" 54int(0) 55array(2) { 56 ["errno"]=> 57 int(0) 58 ["errstr"]=> 59 string(2) "OK" 60} 61string(2) "OK" 62int(0) 63bool(false) 64array(2) { 65 ["errno"]=> 66 int(-5) 67 ["errstr"]=> 68 string(16) "DATA_ERROR_MAGIC" 69} 70string(16) "DATA_ERROR_MAGIC" 71int(-5) 72bool(false) 73array(2) { 74 ["errno"]=> 75 int(-4) 76 ["errstr"]=> 77 string(10) "DATA_ERROR" 78} 79string(10) "DATA_ERROR" 80int(-4) 81bool(false) 82array(2) { 83 ["errno"]=> 84 int(-5) 85 ["errstr"]=> 86 string(16) "DATA_ERROR_MAGIC" 87} 88string(16) "DATA_ERROR_MAGIC" 89int(-5) 90bool(false) 91array(2) { 92 ["errno"]=> 93 int(-4) 94 ["errstr"]=> 95 string(10) "DATA_ERROR" 96} 97string(10) "DATA_ERROR" 98int(-4) 99 100Warning: bzread(): supplied resource is not a valid stream resource in %s on line %d 101bool(false) 102 103Warning: bzerror(): supplied resource is not a valid stream resource in %s on line %d 104bool(false) 105 106Warning: bzerrstr(): supplied resource is not a valid stream resource in %s on line %d 107bool(false) 108 109Warning: bzerrno(): supplied resource is not a valid stream resource in %s on line %d 110bool(false) 111Done 112