mirror of
https://github.com/php/php-src.git
synced 2026-04-17 13:01:02 +02:00
PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
119 lines
2.1 KiB
PHP
119 lines
2.1 KiB
PHP
--TEST--
|
|
Test function gzfile() by substituting argument 2 with emptyUnsetUndefNull values.
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
|
|
$filename = dirname(__FILE__)."/004.txt.gz";
|
|
|
|
|
|
$unset_var = 10;
|
|
unset($unset_var);
|
|
|
|
$variation = array(
|
|
'unset var' => @$unset_var,
|
|
'undefined var' => @$undefined_var,
|
|
'empty string DQ' => "",
|
|
'empty string SQ' => '',
|
|
'uppercase NULL' => NULL,
|
|
'lowercase null' => null,
|
|
);
|
|
|
|
|
|
foreach ( $variation as $var ) {
|
|
var_dump(gzfile( $filename, $var ) );
|
|
}
|
|
?>
|
|
===DONE===
|
|
--EXPECTF--
|
|
array(6) {
|
|
[0]=>
|
|
string(36) "When you're taught through feelings
|
|
"
|
|
[1]=>
|
|
string(26) "Destiny flying high above
|
|
"
|
|
[2]=>
|
|
string(38) "all I know is that you can realize it
|
|
"
|
|
[3]=>
|
|
string(18) "Destiny who cares
|
|
"
|
|
[4]=>
|
|
string(19) "as it turns around
|
|
"
|
|
[5]=>
|
|
string(39) "and I know that it descends down on me
|
|
"
|
|
}
|
|
array(6) {
|
|
[0]=>
|
|
string(36) "When you're taught through feelings
|
|
"
|
|
[1]=>
|
|
string(26) "Destiny flying high above
|
|
"
|
|
[2]=>
|
|
string(38) "all I know is that you can realize it
|
|
"
|
|
[3]=>
|
|
string(18) "Destiny who cares
|
|
"
|
|
[4]=>
|
|
string(19) "as it turns around
|
|
"
|
|
[5]=>
|
|
string(39) "and I know that it descends down on me
|
|
"
|
|
}
|
|
|
|
Warning: gzfile() expects parameter 2 to be int, string given in %s on line %d
|
|
NULL
|
|
|
|
Warning: gzfile() expects parameter 2 to be int, string given in %s on line %d
|
|
NULL
|
|
array(6) {
|
|
[0]=>
|
|
string(36) "When you're taught through feelings
|
|
"
|
|
[1]=>
|
|
string(26) "Destiny flying high above
|
|
"
|
|
[2]=>
|
|
string(38) "all I know is that you can realize it
|
|
"
|
|
[3]=>
|
|
string(18) "Destiny who cares
|
|
"
|
|
[4]=>
|
|
string(19) "as it turns around
|
|
"
|
|
[5]=>
|
|
string(39) "and I know that it descends down on me
|
|
"
|
|
}
|
|
array(6) {
|
|
[0]=>
|
|
string(36) "When you're taught through feelings
|
|
"
|
|
[1]=>
|
|
string(26) "Destiny flying high above
|
|
"
|
|
[2]=>
|
|
string(38) "all I know is that you can realize it
|
|
"
|
|
[3]=>
|
|
string(18) "Destiny who cares
|
|
"
|
|
[4]=>
|
|
string(19) "as it turns around
|
|
"
|
|
[5]=>
|
|
string(39) "and I know that it descends down on me
|
|
"
|
|
}
|
|
===DONE===
|