mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
More zpp error/variation test removals
This commit is contained in:
parent
c8e10c6119
commit
2580a7ba09
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
assert() - error - invalid params
|
||||
--INI--
|
||||
assert.active = 1
|
||||
assert.warning = 1
|
||||
assert.callback = f1
|
||||
assert.quiet_eval = 1
|
||||
assert.bail = 0
|
||||
--FILE--
|
||||
<?php
|
||||
function f1()
|
||||
{
|
||||
echo "f1 called\n";
|
||||
}
|
||||
|
||||
//Wrong number of parameters for assert_options()
|
||||
assert_options(ASSERT_WARNING, 1);
|
||||
var_dump($rao = assert_options(ASSERT_CALLBACK, "f1", 1));
|
||||
|
||||
|
||||
//Unknown option for assert_options()
|
||||
var_dump($rao=assert_options("F1", "f1"));
|
||||
|
||||
//Wrong number of parameters for assert()
|
||||
$sa="0 != 0";
|
||||
var_dump($r2 = assert($sa, "message", 1));
|
||||
|
||||
var_dump($rc = assert('aa=sd+as+safsafasfaçsafçsafç'));
|
||||
--EXPECTF--
|
||||
Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test chdir() function : error conditions - Incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool chdir(string $directory)
|
||||
* Description: Change the current directory
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to chdir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing chdir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing chdir() function with Zero arguments --\n";
|
||||
var_dump( chdir() );
|
||||
|
||||
//Test chdir with one more than the expected number of arguments
|
||||
echo "\n-- Testing chdir() function with more than expected no. of arguments --\n";
|
||||
$directory = __FILE__;
|
||||
$extra_arg = 10;
|
||||
var_dump( chdir($directory, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing chdir() : error conditions ***
|
||||
|
||||
-- Testing chdir() function with Zero arguments --
|
||||
|
||||
Warning: chdir() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Testing chdir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: chdir() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
@ -1,241 +0,0 @@
|
||||
--TEST--
|
||||
Test chdir() function : usage variations - different data type as $directory arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool chdir(string $directory)
|
||||
* Description: Change the current directory
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $directory argument to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing chdir() : usage variations ***\n";
|
||||
|
||||
// create the temporary directory
|
||||
$file_path = dirname(__FILE__);
|
||||
$dir_path = $file_path."/私はガラスを食べられますchdir_basic";
|
||||
@mkdir($dir_path);
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA {
|
||||
var $dir_path;
|
||||
|
||||
function __construct($dir) {
|
||||
$this->dir_path = $dir;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return "$this->dir_path";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
$dir_path
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $directory argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "$dir_path",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA($dir_path),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of chdir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( chdir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
$dir_path = $file_path."/私はガラスを食べられますchdir_basic";
|
||||
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chdir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: chdir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: chdir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
@ -1,235 +0,0 @@
|
||||
--TEST--
|
||||
Test chdir() function : usage variations - different data type as $directory arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool chdir(string $directory)
|
||||
* Description: Change the current directory
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $directory argument to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing chdir() : usage variations ***\n";
|
||||
|
||||
// create the temporary directory
|
||||
$file_path = dirname(__FILE__);
|
||||
$dir_path = $file_path."/chdir_basic";
|
||||
@mkdir($dir_path);
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA {
|
||||
var $dir_path;
|
||||
|
||||
function __construct($dir) {
|
||||
$this->dir_path = $dir;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return "$this->dir_path";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
$dir_path
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $directory argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "$dir_path",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA($dir_path),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of chdir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( chdir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
$dir_path = $file_path."/chdir_basic";
|
||||
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing chdir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: chdir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: chdir(): %s (errno %d) in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: chdir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
@ -1,45 +0,0 @@
|
||||
--TEST--
|
||||
Test closedir() function : error conditions - Pass incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void closedir([resource $dir_handle])
|
||||
* Description: Close directory connection identified by the dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
* Alias to functions: close
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to closedir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing closedir() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test closedir with one more than the expected number of arguments
|
||||
echo "\n-- Testing closedir() function with more than expected no. of arguments --\n";
|
||||
|
||||
$dir_path = dirname(__FILE__) . '\closedir_error';
|
||||
mkdir($dir_path);
|
||||
$dir_handle = opendir($dir_path);
|
||||
|
||||
$extra_arg = 10;
|
||||
var_dump( closedir($dir_handle, $extra_arg) );
|
||||
|
||||
//successfully close the directory handle so can delete in CLEAN section
|
||||
closedir($dir_handle);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$base_dir = dirname(__FILE__);
|
||||
$dir_path = $base_dir . '\closedir_error';
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing closedir() : error conditions ***
|
||||
|
||||
-- Testing closedir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,212 +0,0 @@
|
||||
--TEST--
|
||||
Test closedir() function : usage variations - different data types as $dir_handle arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void closedir([resource $dir_handle])
|
||||
* Description: Close directory connection identified by the dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
* Alias to functions: close
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $dir_handle argument to closedir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing closedir() : usage variations ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// unexpected values to be passed to $dir_handle argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of closedir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( closedir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing closedir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: closedir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Test dir() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Prototype : object dir(string $directory[, resource $context])
|
||||
* Description: Directory class with properties, handle and class and methods read, rewind and close
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
echo "*** Testing dir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing dir() function with zero arguments --";
|
||||
var_dump( dir() );
|
||||
|
||||
// With one more than expected number of arguments
|
||||
echo "\n-- Testing dir() function with one more than expected number of arguments --";
|
||||
$extra_arg = 10;
|
||||
var_dump( dir(getcwd(), "stream", $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing dir() : error conditions ***
|
||||
|
||||
-- Testing dir() function with zero arguments --
|
||||
Warning: dir() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing dir() function with one more than expected number of arguments --
|
||||
Warning: dir() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
Done
|
@ -1,166 +0,0 @@
|
||||
--TEST--
|
||||
Test dir() function : usage variations - unexpected value for 'dir' argument
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. Not valid for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Prototype : object dir(string $directory[, resource $context])
|
||||
* Description: Directory class with properties, handle and class and methods read, rewind and close
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Passing non string values to 'directory' argument of dir() and see
|
||||
* that the function outputs proper warning messages wherever expected.
|
||||
*/
|
||||
|
||||
echo "*** Testing dir() : unexpected values for \$directory argument ***\n";
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = 10;
|
||||
unset($unset_var);
|
||||
|
||||
class A
|
||||
{
|
||||
public $var;
|
||||
public function init() {
|
||||
$this->var = 10;
|
||||
}
|
||||
}
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r"); // get a file handle
|
||||
$dfp = opendir( dirname(__FILE__) ); // get a dir handle
|
||||
|
||||
// unexpected values to be passed to $directory argument
|
||||
$unexpected_values = array (
|
||||
|
||||
// array data
|
||||
/*1*/ array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
// null data
|
||||
/*6*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*8*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*12*/ "",
|
||||
'',
|
||||
|
||||
// undefined data
|
||||
/*14*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*15*/ @$unset_var,
|
||||
|
||||
// resource variable(dir and file handle)
|
||||
/*16*/ $fp,
|
||||
$dfp,
|
||||
|
||||
// object data
|
||||
/*18*/ new A()
|
||||
);
|
||||
|
||||
// loop through various elements of $unexpected_values to check the behavior of dir()
|
||||
$iterator = 1;
|
||||
foreach( $unexpected_values as $unexpected_value ) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( dir($unexpected_value) );
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
closedir($dfp);
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing dir() : unexpected values for $directory argument ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: dir(1): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: dir(1): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: dir() expects parameter 1 to be a valid path, object given in %s on line %d
|
||||
NULL
|
||||
Done
|
@ -1,229 +0,0 @@
|
||||
--TEST--
|
||||
Test dir() function : usage variations - unexpected value for 'context' argument
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Prototype : object dir(string $directory[, resource $context])
|
||||
* Description: Directory class with properties, handle and class and methods read, rewind and close
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Passing non resource values to 'context' argument of dir() and see
|
||||
* that the function outputs proper warning messages wherever expected.
|
||||
*/
|
||||
|
||||
echo "*** Testing dir() : unexpected values for \$context argument ***\n";
|
||||
|
||||
// create the temporary directory
|
||||
$file_path = dirname(__FILE__);
|
||||
$directory = $file_path."/私はガラスを食べられますdir_variation2";
|
||||
@mkdir($directory);
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = stream_context_create();
|
||||
unset($unset_var);
|
||||
|
||||
class classA
|
||||
{
|
||||
public $var;
|
||||
public function init() {
|
||||
$this->var = 10;
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// unexpected values to be passed to $directory argument
|
||||
$unexpected_values = array (
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// array data
|
||||
/*10*/ array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
|
||||
// null data
|
||||
/*15*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*17*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*21*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*23*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*26*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*27*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*28*/ @$unset_var
|
||||
);
|
||||
|
||||
// loop through various elements of $unexpected_values to check the behavior of dir()
|
||||
$iterator = 1;
|
||||
foreach( $unexpected_values as $unexpected_value ) {
|
||||
echo "\n-- Iteration $iterator --";
|
||||
var_dump( dir($directory, $unexpected_value) );
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
$directory = $file_path."/私はガラスを食べられますdir_variation2";
|
||||
|
||||
rmdir($directory);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing dir() : unexpected values for $context argument ***
|
||||
|
||||
-- Iteration 1 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 25 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 26 --
|
||||
Warning: dir() expects parameter 2 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 27 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 28 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
Done
|
@ -1,223 +0,0 @@
|
||||
--TEST--
|
||||
Test dir() function : usage variations - unexpected value for 'context' argument
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Prototype : object dir(string $directory[, resource $context])
|
||||
* Description: Directory class with properties, handle and class and methods read, rewind and close
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Passing non resource values to 'context' argument of dir() and see
|
||||
* that the function outputs proper warning messages wherever expected.
|
||||
*/
|
||||
|
||||
echo "*** Testing dir() : unexpected values for \$context argument ***\n";
|
||||
|
||||
// create the temporary directory
|
||||
$file_path = dirname(__FILE__);
|
||||
$directory = $file_path."/dir_variation2";
|
||||
@mkdir($directory);
|
||||
|
||||
// get an unset variable
|
||||
$unset_var = stream_context_create();
|
||||
unset($unset_var);
|
||||
|
||||
class classA
|
||||
{
|
||||
public $var;
|
||||
public function init() {
|
||||
$this->var = 10;
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// unexpected values to be passed to $directory argument
|
||||
$unexpected_values = array (
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// array data
|
||||
/*10*/ array(),
|
||||
array(0),
|
||||
array(1),
|
||||
array(1, 2),
|
||||
array('color' => 'red', 'item' => 'pen'),
|
||||
|
||||
|
||||
// null data
|
||||
/*15*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*17*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*21*/ "",
|
||||
'',
|
||||
|
||||
// string data
|
||||
/*23*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*26*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*27*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*28*/ @$unset_var
|
||||
);
|
||||
|
||||
// loop through various elements of $unexpected_values to check the behavior of dir()
|
||||
$iterator = 1;
|
||||
foreach( $unexpected_values as $unexpected_value ) {
|
||||
echo "\n-- Iteration $iterator --";
|
||||
var_dump( dir($directory, $unexpected_value) );
|
||||
$iterator++;
|
||||
}
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
$file_path = dirname(__FILE__);
|
||||
$directory = $file_path."/dir_variation2";
|
||||
|
||||
rmdir($directory);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing dir() : unexpected values for $context argument ***
|
||||
|
||||
-- Iteration 1 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
Warning: dir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
Warning: dir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
Warning: dir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
Warning: dir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 25 --
|
||||
Warning: dir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 26 --
|
||||
Warning: dir() expects parameter 2 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 27 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 28 --
|
||||
Warning: dir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
Done
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test getcwd() function : error conditions - Incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed getcwd(void)
|
||||
* Description: Gets the current directory
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to getcwd() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing getcwd() : error conditions ***\n";
|
||||
|
||||
// One argument
|
||||
echo "\n-- Testing getcwd() function with one argument --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( getcwd($extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing getcwd() : error conditions ***
|
||||
|
||||
-- Testing getcwd() function with one argument --
|
||||
|
||||
Warning: getcwd() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,53 +0,0 @@
|
||||
--TEST--
|
||||
Test opendir() function : error conditions - Incorrect number of args
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed opendir(string $path[, resource $context])
|
||||
* Description: Open a directory and return a dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to opendir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing opendir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing opendir() function with Zero arguments --\n";
|
||||
var_dump( opendir() );
|
||||
|
||||
//Test opendir with one more than the expected number of arguments
|
||||
echo "\n-- Testing opendir() function with more than expected no. of arguments --\n";
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_error";
|
||||
mkdir($path);
|
||||
$context = stream_context_create();
|
||||
|
||||
$extra_arg = 10;
|
||||
var_dump( opendir($path, $context, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_error";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing opendir() : error conditions ***
|
||||
|
||||
-- Testing opendir() function with Zero arguments --
|
||||
|
||||
Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing opendir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,47 +0,0 @@
|
||||
--TEST--
|
||||
Test opendir() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed opendir(string $path[, resource $context])
|
||||
* Description: Open a directory and return a dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to opendir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing opendir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing opendir() function with Zero arguments --\n";
|
||||
var_dump( opendir() );
|
||||
|
||||
//Test opendir with one more than the expected number of arguments
|
||||
echo "\n-- Testing opendir() function with more than expected no. of arguments --\n";
|
||||
$path = dirname(__FILE__) . "/opendir_error";
|
||||
mkdir($path);
|
||||
$context = stream_context_create();
|
||||
|
||||
$extra_arg = 10;
|
||||
var_dump( opendir($path, $context, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/opendir_error";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing opendir() : error conditions ***
|
||||
|
||||
-- Testing opendir() function with Zero arguments --
|
||||
|
||||
Warning: opendir() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing opendir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: opendir() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,224 +0,0 @@
|
||||
--TEST--
|
||||
Test opendir() function : usage variations - different data types as $path arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. Not valid for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed opendir(string $path[, resource $context])
|
||||
* Description: Open a directory and return a dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $path argument to opendir() to test behaviour
|
||||
* Where possible, an existing directory has been entered as a string value
|
||||
*/
|
||||
|
||||
echo "*** Testing opendir() : usage variations ***\n";
|
||||
|
||||
// create directory to be passed as string value where possible
|
||||
$path = dirname(__FILE__) . "/opendir_variation1";
|
||||
mkdir($path);
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA {
|
||||
|
||||
var $path;
|
||||
function __construct($path) {
|
||||
$this->path = $path;
|
||||
}
|
||||
public function __toString() {
|
||||
return $this->path;
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
$path
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $path argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "$path",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA($path),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of opendir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( $dh = opendir($input) );
|
||||
if ($dh) {
|
||||
closedir($dh);
|
||||
}
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/opendir_variation1";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing opendir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: opendir(0): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: opendir(1): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: opendir(12345): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: opendir(-2345): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: opendir(10.5): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: opendir(-10.5): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: opendir(123456789000): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: opendir(1.23456789E-9): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: opendir(0.5): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: opendir(1): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: opendir(1): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: opendir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
resource(%d) of type (stream)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: opendir(string): failed to open dir: %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
resource(%d) of type (stream)
|
||||
|
||||
-- Iteration 22 --
|
||||
resource(%d) of type (stream)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: opendir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,245 +0,0 @@
|
||||
--TEST--
|
||||
Test opendir() function : usage variations - different data types as $context arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed opendir(string $path[, resource $context])
|
||||
* Description: Open a directory and return a dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $context argument to opendir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing opendir() : usage variation ***\n";
|
||||
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
// create temporary directory for test, removed in CLEAN section
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation2";
|
||||
mkdir($path);
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString()
|
||||
{
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $context argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of opendir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump($dh = opendir($path, $input) );#
|
||||
if ($dh) {
|
||||
closedir($dh);
|
||||
}
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますopendir_variation2";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing opendir() : usage variation ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d
|
||||
resource(%d) of type (stream)
|
||||
===DONE===
|
@ -1,239 +0,0 @@
|
||||
--TEST--
|
||||
Test opendir() function : usage variations - different data types as $context arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : mixed opendir(string $path[, resource $context])
|
||||
* Description: Open a directory and return a dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $context argument to opendir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing opendir() : usage variation ***\n";
|
||||
|
||||
|
||||
// Initialise function arguments not being substituted (if any)
|
||||
// create temporary directory for test, removed in CLEAN section
|
||||
$path = dirname(__FILE__) . "/opendir_variation2";
|
||||
mkdir($path);
|
||||
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString()
|
||||
{
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $context argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of opendir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump($dh = opendir($path, $input) );#
|
||||
if ($dh) {
|
||||
closedir($dh);
|
||||
}
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/opendir_variation2";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing opendir() : usage variation ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: opendir() expects parameter 2 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: opendir(): supplied resource is not a valid Stream-Context resource in %s on line %d
|
||||
resource(%d) of type (stream)
|
||||
===DONE===
|
@ -1,49 +0,0 @@
|
||||
--TEST--
|
||||
Test readdir() function : error conditions - Incorrect number of args
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string readdir([resource $dir_handle])
|
||||
* Description: Read directory entry from dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to readdir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing readdir() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test readdir with one more than the expected number of arguments
|
||||
echo "\n-- Testing readdir() function with more than expected no. of arguments --\n";
|
||||
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_error";
|
||||
mkdir($path);
|
||||
$dir_handle = opendir($path);
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( readdir($dir_handle, $extra_arg) );
|
||||
|
||||
// close the handle so can remove dir in CLEAN section
|
||||
closedir($dir_handle);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/私はガラスを食べられますreaddir_error";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing readdir() : error conditions ***
|
||||
|
||||
-- Testing readdir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: readdir() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,43 +0,0 @@
|
||||
--TEST--
|
||||
Test readdir() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string readdir([resource $dir_handle])
|
||||
* Description: Read directory entry from dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to readdir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing readdir() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test readdir with one more than the expected number of arguments
|
||||
echo "\n-- Testing readdir() function with more than expected no. of arguments --\n";
|
||||
|
||||
$path = dirname(__FILE__) . "/readdir_error";
|
||||
mkdir($path);
|
||||
$dir_handle = opendir($path);
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( readdir($dir_handle, $extra_arg) );
|
||||
|
||||
// close the handle so can remove dir in CLEAN section
|
||||
closedir($dir_handle);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$path = dirname(__FILE__) . "/readdir_error";
|
||||
rmdir($path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing readdir() : error conditions ***
|
||||
|
||||
-- Testing readdir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: readdir() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,210 +0,0 @@
|
||||
--TEST--
|
||||
Test readdir() function : usage variations - different data types as $dir_handle arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string readdir([resource $dir_handle])
|
||||
* Description: Read directory entry from dir_handle
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $dir_handle argument to readdir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing readdir() : usage variations ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// unexpected values to be passed to $dir_handle argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of readdir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( readdir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing readdir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: readdir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,48 +0,0 @@
|
||||
--TEST--
|
||||
Test rewinddir() function : error conditions - incorrect number of args
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void rewinddir([resource $dir_handle])
|
||||
* Description: Rewind dir_handle back to the start
|
||||
* Source code: ext/standard/dir.c
|
||||
* Alias to functions: rewind
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to rewinddir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing rewinddir() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test rewinddir with one more than the expected number of arguments
|
||||
echo "\n-- Testing rewinddir() function with more than expected no. of arguments --\n";
|
||||
|
||||
$dir_path = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_error";
|
||||
mkdir($dir_path);
|
||||
$dir_handle = opendir($dir_path);
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( rewinddir($dir_handle, $extra_arg) );
|
||||
closedir($dir_handle);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir_path = dirname(__FILE__) . "/私はガラスを食べられますrewinddir_error";
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing rewinddir() : error conditions ***
|
||||
|
||||
-- Testing rewinddir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: rewinddir() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Test rewinddir() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void rewinddir([resource $dir_handle])
|
||||
* Description: Rewind dir_handle back to the start
|
||||
* Source code: ext/standard/dir.c
|
||||
* Alias to functions: rewind
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to rewinddir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing rewinddir() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test rewinddir with one more than the expected number of arguments
|
||||
echo "\n-- Testing rewinddir() function with more than expected no. of arguments --\n";
|
||||
|
||||
$dir_path = dirname(__FILE__) . "/rewinddir_error";
|
||||
mkdir($dir_path);
|
||||
$dir_handle = opendir($dir_path);
|
||||
$extra_arg = 10;
|
||||
|
||||
var_dump( rewinddir($dir_handle, $extra_arg) );
|
||||
closedir($dir_handle);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir_path = dirname(__FILE__) . "/rewinddir_error";
|
||||
rmdir($dir_path);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing rewinddir() : error conditions ***
|
||||
|
||||
-- Testing rewinddir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: rewinddir() expects at most 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,211 +0,0 @@
|
||||
--TEST--
|
||||
Test rewinddir() function : usage variations - different data types as $dir_handle arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void rewinddir([resource $dir_handle])
|
||||
* Description: Rewind dir_handle back to the start
|
||||
* Source code: ext/standard/dir.c
|
||||
* Alias to functions: rewind
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $dir_handle argument to rewinddir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing rewinddir() : usage variations ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// unexpected values to be passed to $dir_handle argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of rewinddir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( rewinddir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing rewinddir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: rewinddir() expects parameter 1 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,53 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : error conditions - Incorrect number of args
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die("skip Valid only on Windows");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to scandir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing scandir() function with Zero arguments --\n";
|
||||
var_dump( scandir() );
|
||||
|
||||
//Test scandir with one more than the expected number of arguments
|
||||
echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
|
||||
$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_error';
|
||||
mkdir($dir);
|
||||
$sorting_order = 10;
|
||||
$context = stream_context_create();
|
||||
$extra_arg = 10;
|
||||
var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$directory = dirname(__FILE__) . '/私はガラスを食べられますscandir_error';
|
||||
rmdir($directory);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : error conditions ***
|
||||
|
||||
-- Testing scandir() function with Zero arguments --
|
||||
|
||||
Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing scandir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,47 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : error conditions - Incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to scandir() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing scandir() function with Zero arguments --\n";
|
||||
var_dump( scandir() );
|
||||
|
||||
//Test scandir with one more than the expected number of arguments
|
||||
echo "\n-- Testing scandir() function with more than expected no. of arguments --\n";
|
||||
$dir = dirname(__FILE__) . '/scandir_error';
|
||||
mkdir($dir);
|
||||
$sorting_order = 10;
|
||||
$context = stream_context_create();
|
||||
$extra_arg = 10;
|
||||
var_dump( scandir($dir, $sorting_order, $context, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$directory = dirname(__FILE__) . '/scandir_error';
|
||||
rmdir($directory);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : error conditions ***
|
||||
|
||||
-- Testing scandir() function with Zero arguments --
|
||||
|
||||
Warning: scandir() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing scandir() function with more than expected no. of arguments --
|
||||
|
||||
Warning: scandir() expects at most 3 parameters, 4 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,259 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : usage variations - different data types as $dir arg
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. Not valid for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $dir argument to test behaviour of scandir()
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : usage variations ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $dir argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of scandir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( scandir($input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: scandir(0): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: scandir(1): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: scandir(12345): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: scandir(-2345): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: scandir(10.5): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: scandir(-10.5): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: scandir(123456789000): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: scandir(1.23456789E-9): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: scandir(0.5): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: scandir(1): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: scandir(1): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: scandir() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: scandir(string): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: scandir(string): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: scandir(hello world): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: scandir(Class A object): failed to open dir: %s in %s on line %d
|
||||
|
||||
Warning: scandir(): (errno %d): %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: scandir(): Directory name cannot be empty in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: scandir() expects parameter 1 to be a valid path, resource given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,285 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : usage variations - diff data types as $sorting_order arg
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only");
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $sorting_order argument to test how scandir() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation2';
|
||||
mkdir($dir);
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $sorting_order argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of scandir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( scandir($dir, $input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation2';
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 2 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 3 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, resource given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,285 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : usage variations - diff data types as $sorting_order arg
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only");
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $sorting_order argument to test how scandir() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$dir = dirname(__FILE__) . '/scandir_variation2';
|
||||
mkdir($dir);
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $sorting_order argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of scandir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( scandir($dir, $input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = dirname(__FILE__) . '/scandir_variation2';
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 2 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 3 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 4 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 5 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 6 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 7 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 8 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 9 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 10 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 11 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 12 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 13 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 14 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(2) ".."
|
||||
[1]=>
|
||||
string(1) "."
|
||||
}
|
||||
|
||||
-- Iteration 15 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 24 --
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: scandir() expects parameter 2 to be int, resource given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,238 +0,0 @@
|
||||
--TEST--
|
||||
Test scandir() function : usage variations - diff data types as $context arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
|
||||
* Description: List files & directories inside the specified path
|
||||
* Source code: ext/standard/dir.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $context argument to test how scandir() behaves
|
||||
*/
|
||||
|
||||
echo "*** Testing scandir() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$dir = dirname(__FILE__) . '/scandir_variation3';
|
||||
mkdir($dir);
|
||||
$sorting_order = SCANDIR_SORT_ASCENDING;
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "Class A object";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
hello world
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $context argument
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 0,
|
||||
1,
|
||||
12345,
|
||||
-2345,
|
||||
|
||||
// float data
|
||||
/*5*/ 10.5,
|
||||
-10.5,
|
||||
12.3456789000e10,
|
||||
12.3456789000E-10,
|
||||
.5,
|
||||
|
||||
// null data
|
||||
/*10*/ NULL,
|
||||
null,
|
||||
|
||||
// boolean data
|
||||
/*12*/ true,
|
||||
false,
|
||||
TRUE,
|
||||
FALSE,
|
||||
|
||||
// empty data
|
||||
/*16*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of scandir()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( scandir($dir, $sorting_order, $input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = dirname(__FILE__) . '/scandir_variation3';
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing scandir() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "."
|
||||
[1]=>
|
||||
string(2) ".."
|
||||
}
|
||||
===DONE===
|
@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Test rename() function: error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: bool rename ( string $oldname, string $newname [, resource $context] );
|
||||
Description: Renames a file or directory
|
||||
*/
|
||||
|
||||
echo "*** Testing rename() for error conditions ***\n";
|
||||
//Zero argument
|
||||
var_dump( rename() );
|
||||
|
||||
// less than expected,1 argument
|
||||
var_dump( rename(__FILE__) );
|
||||
|
||||
// more than expected no. of arguments
|
||||
$context = stream_context_create();
|
||||
$filename = __FILE__;
|
||||
$new_filename = __FILE__.".tmp";
|
||||
var_dump( rename($filename, $new_filename, $context, "extra_args") );
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing rename() for error conditions ***
|
||||
|
||||
Warning: rename() expects at least 2 parameters, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: rename() expects at least 2 parameters, 1 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: rename() expects at most 3 parameters, 4 given in %s on line %d
|
||||
bool(false)
|
||||
Done
|
@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Test umask() function: error conditions
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only for Linux');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: int umask ( [int $mask] );
|
||||
Description: Changes the current umask
|
||||
*/
|
||||
|
||||
echo "*** Testing umask() : error conditions ***\n";
|
||||
|
||||
var_dump( umask(0000, true) ); // args > expected
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing umask() : error conditions ***
|
||||
|
||||
Warning: umask() expects at most 1 parameter, 2 given in %s on line %d
|
||||
bool(false)
|
||||
Done
|
@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Test getimagesize() function : error conditions - wrong number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array getimagesize(string imagefile [, array info])
|
||||
* Description: Get the size of an image as 4-element array
|
||||
* Source code: ext/standard/image.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing getimagesize() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing getimagesize() function with Zero arguments --\n";
|
||||
var_dump( getimagesize() );
|
||||
|
||||
//Test getimagesize with one more than the expected number of arguments
|
||||
echo "\n-- Testing getimagesize() function with more than expected no. of arguments --\n";
|
||||
$imagefile = 'string_val';
|
||||
$info = array(1, 2);
|
||||
$extra_arg = 10;
|
||||
var_dump( getimagesize($imagefile, $info, $extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing getimagesize() : error conditions ***
|
||||
|
||||
-- Testing getimagesize() function with Zero arguments --
|
||||
|
||||
Warning: getimagesize() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing getimagesize() function with more than expected no. of arguments --
|
||||
|
||||
Warning: getimagesize() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Test image_type_to_mime_type() function : error conditions - Pass incorrect number of arguments
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string image_type_to_mime_type(int imagetype)
|
||||
* Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
|
||||
* Source code: ext/standard/image.c
|
||||
*/
|
||||
|
||||
$imagetype = IMAGETYPE_GIF;
|
||||
$extra_arg = 10;
|
||||
echo "*** Testing image_type_to_mime_type() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing image_type_to_mime_type() function with Zero arguments --\n";
|
||||
var_dump( image_type_to_mime_type() );
|
||||
|
||||
//Test image_type_to_mime_type with one more than the expected number of arguments
|
||||
echo "\n-- Testing image_type_to_mime_type() function with more than expected no. of arguments --\n";
|
||||
var_dump( image_type_to_mime_type($imagetype, $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing image_type_to_mime_type() : error conditions ***
|
||||
|
||||
-- Testing image_type_to_mime_type() function with Zero arguments --
|
||||
|
||||
Warning: image_type_to_mime_type() expects exactly 1 parameter, 0 given in %simage_type_to_mime_type_error.php on line 13
|
||||
NULL
|
||||
|
||||
-- Testing image_type_to_mime_type() function with more than expected no. of arguments --
|
||||
|
||||
Warning: image_type_to_mime_type() expects exactly 1 parameter, 2 given in %simage_type_to_mime_type_error.php on line 17
|
||||
NULL
|
||||
===DONE===
|
@ -1,66 +0,0 @@
|
||||
--TEST--
|
||||
Test ezmlm_hash() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int ezmlm_hash ( string $addr )
|
||||
* Description: Calculate the hash value needed by EZMLM.
|
||||
* Source code: ext/standard/mail.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ezmlm_hash() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing ezmlm_hash() function with fewer than expected no. of arguments --\n";
|
||||
var_dump( ezmlm_hash() );
|
||||
|
||||
echo "\n-- Testing ezmlm_hash() function with more than expected no. of arguments --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( ezmlm_hash("webmaster@example.com", $extra_arg) );
|
||||
|
||||
echo "\n-- Testing ezmlm_hash() function with invalid input - ARRAY --\n";
|
||||
$array_arg = array(1,2,3,4);
|
||||
$extra_arg = 10;
|
||||
var_dump( ezmlm_hash($array_arg) );
|
||||
|
||||
echo "\n-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --\n";
|
||||
class sample {
|
||||
}
|
||||
|
||||
$obj_arg = new sample();
|
||||
var_dump( ezmlm_hash($obj_arg) );
|
||||
|
||||
echo "\n-- Testing ezmlm_hash() function with invalid input - RESOURCE --\n";
|
||||
$file_handle = fopen(__FILE__, "r");
|
||||
$extra_arg = 10;
|
||||
var_dump( ezmlm_hash($file_handle) );
|
||||
fclose($file_handle);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ezmlm_hash() : error conditions ***
|
||||
|
||||
-- Testing ezmlm_hash() function with fewer than expected no. of arguments --
|
||||
|
||||
Warning: ezmlm_hash() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ezmlm_hash() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ezmlm_hash() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ezmlm_hash() function with invalid input - ARRAY --
|
||||
|
||||
Warning: ezmlm_hash() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ezmlm_hash() function with invalid input - OBJECT without 'cast_object' method --
|
||||
|
||||
Warning: ezmlm_hash() expects parameter 1 to be string, object given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ezmlm_hash() function with invalid input - RESOURCE --
|
||||
|
||||
Warning: ezmlm_hash() expects parameter 1 to be string, resource given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,44 +0,0 @@
|
||||
--TEST--
|
||||
Test mail() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
|
||||
* Description: Send an email message
|
||||
* Source code: ext/standard/mail.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing mail() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test mail with one more than the expected number of arguments
|
||||
echo "\n-- Testing mail() function with more than expected no. of arguments --\n";
|
||||
$to = 'string_val';
|
||||
$subject = 'string_val';
|
||||
$message = 'string_val';
|
||||
$additional_headers = 'string_val';
|
||||
$additional_parameters = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( mail($to, $subject, $message, $additional_headers, $additional_parameters, $extra_arg) );
|
||||
|
||||
// Testing mail with one less than the expected number of arguments
|
||||
echo "\n-- Testing mail() function with less than expected no. of arguments --\n";
|
||||
$to = 'string_val';
|
||||
$subject = 'string_val';
|
||||
var_dump( mail($to, $subject) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing mail() : error conditions ***
|
||||
|
||||
-- Testing mail() function with more than expected no. of arguments --
|
||||
|
||||
Warning: mail() expects at most 5 parameters, 6 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing mail() function with less than expected no. of arguments --
|
||||
|
||||
Warning: mail() expects at least 3 parameters, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test abs() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : number abs ( mixed $number )
|
||||
* Description: Returns the absolute value of number.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to abs() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing abs() : error conditions ***\n";
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(abs($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(abs());
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing abs() : error conditions ***
|
||||
|
||||
Too many arguments
|
||||
|
||||
Warning: abs() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: abs() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
===Done===
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for acos()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float acos(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(acos($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(acos());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: acos() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: acos() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for acosh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float acosh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(acosh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(acosh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: acosh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: acosh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for asin()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float asin(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(asin($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(asin());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: asin() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: asin() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for asinh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float asinh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(asinh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(asinh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: asinh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: asinh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
Test atan2() - wrong params atan2()
|
||||
--FILE--
|
||||
<?php
|
||||
atan2();
|
||||
atan2(36);
|
||||
atan2(36,25,0);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: atan2() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
|
||||
Warning: atan2() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
|
||||
Warning: atan2() expects exactly 2 parameters, 3 given in %s on line %d
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for atan()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float atan(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(atan($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(atan());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: atan() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: atan() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Test bindec() function : error conditions - incorrect input
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : number bindec ( string $binary_string )
|
||||
* Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect input to bindec() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing bindec() : error conditions ***\n";
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
}
|
||||
|
||||
echo "Incorrect number of arguments\n";
|
||||
bindec();
|
||||
bindec('01010101111',true);
|
||||
|
||||
echo "Incorrect input\n";
|
||||
bindec(new classA());
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing bindec() : error conditions ***
|
||||
Incorrect number of arguments
|
||||
|
||||
Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
Incorrect input
|
||||
|
||||
Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d
|
@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Test ceil() - error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float ceil ( float $value )
|
||||
* Description: Round fractions up.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing ceil() : error conditions ***\n";
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(ceil($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(ceil());
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing ceil() : error conditions ***
|
||||
|
||||
Too many arguments
|
||||
|
||||
Warning: ceil() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: ceil() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
===Done===
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for cos()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float cos(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(cos($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(cos());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: cos() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: cos() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for cosh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float cosh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(cosh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(cosh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: cosh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: cosh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Test expm1() - Error conditions
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float expm1 ( float $arg )
|
||||
* Description: Returns exp(number) - 1, computed in a way that is accurate even
|
||||
* when the value of number is close to zero.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing expm1() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
|
||||
expm1();
|
||||
echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
|
||||
expm1(23,true);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing expm1() : error conditions ***
|
||||
|
||||
-- Testing expm1() function with less than expected no. of arguments --
|
||||
|
||||
Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
-- Testing expm1() function with more than expected no. of arguments --
|
||||
|
||||
Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
===Done===
|
@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Test dechex() - wrong params dechex()
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string dechex ( int $number )
|
||||
* Description: Returns a string containing a hexadecimal representation of the given number argument.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing dechex() : error conditions ***\n";
|
||||
|
||||
echo "\nIncorrect number of arguments\n";
|
||||
dechex();
|
||||
dechex(23,2,true);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing dechex() : error conditions ***
|
||||
|
||||
Incorrect number of arguments
|
||||
|
||||
Warning: dechex() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: dechex() expects exactly 1 parameter, 3 given in %s on line %d
|
||||
===Done===
|
@ -1,25 +0,0 @@
|
||||
--TEST--
|
||||
Test decoct() - error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string decbin ( int $number )
|
||||
* Description: Decimal to binary.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing decoct() : error conditions ***\n";
|
||||
|
||||
echo "Incorrect number of arguments\n";
|
||||
decoct();
|
||||
decoct(23,2,true);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing decoct() : error conditions ***
|
||||
Incorrect number of arguments
|
||||
|
||||
Warning: decoct() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: decoct() expects exactly 1 parameter, 3 given in %s on line %d
|
||||
===Done===
|
@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for deg2rad()
|
||||
--INI--
|
||||
precision = 14
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float deg2rad(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(deg2rad($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(deg2rad());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: deg2rad() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: deg2rad() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,13 +0,0 @@
|
||||
--TEST--
|
||||
Test exp() - wrong params for exp()
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
<?php
|
||||
exp();
|
||||
exp(23,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exp() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: exp() expects exactly 1 parameter, 2 given in %s on line %d
|
@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Test expm1() - Error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float expm1 ( float $arg )
|
||||
* Description: Returns exp(number) - 1, computed in a way that is accurate even
|
||||
* when the value of number is close to zero.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing expm1() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
|
||||
expm1();
|
||||
echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
|
||||
expm1(23,true);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing expm1() : error conditions ***
|
||||
|
||||
-- Testing expm1() function with less than expected no. of arguments --
|
||||
|
||||
Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
-- Testing expm1() function with more than expected no. of arguments --
|
||||
|
||||
Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
===Done===
|
@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Test floor() - error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float floor ( float $value )
|
||||
* Description: Round fractions down.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing floor() : error conditions ***\n";
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\n-- Too many arguments --\n";
|
||||
var_dump(floor($arg_0, $extra_arg));
|
||||
|
||||
echo "\n-- Too few arguments --\n";
|
||||
var_dump(floor());
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing floor() : error conditions ***
|
||||
|
||||
-- Too many arguments --
|
||||
|
||||
Warning: floor() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Too few arguments --
|
||||
|
||||
Warning: floor() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
===Done===
|
@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Test fmod() - wrong params test fmod()
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
<?php
|
||||
fmod();
|
||||
fmod(23);
|
||||
fmod(23,2,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: fmod() expects exactly 2 parameters, 0 given in %s on line 2
|
||||
|
||||
Warning: fmod() expects exactly 2 parameters, 1 given in %s on line 3
|
||||
|
||||
Warning: fmod() expects exactly 2 parameters, 3 given in %s on line 4
|
@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Test getrandmax() - wrong params test getrandmax()
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump($biggest_int = getrandmax(true));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
|
||||
NULL
|
@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Test hexdec() - wrong params test hexdec()
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : number hexdec ( string $hex_string )
|
||||
* Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing hexdec() : error conditions ***\n";
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
}
|
||||
|
||||
echo "\n-- Incorrect number of arguments --\n";
|
||||
hexdec();
|
||||
hexdec('0x123abc',true);
|
||||
|
||||
echo "\n-- Incorrect input --\n";
|
||||
hexdec(new classA());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing hexdec() : error conditions ***
|
||||
|
||||
-- Incorrect number of arguments --
|
||||
|
||||
Warning: hexdec() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: hexdec() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
|
||||
-- Incorrect input --
|
||||
|
||||
Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d
|
@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Test hypot() - wrong params test hypot()
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float hypot ( float $x , float $y )
|
||||
* Description: Calculate the length of the hypotenuse of a right-angle triangle.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing hypot() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing hypot() function with less than expected no. of arguments --\n";
|
||||
hypot();
|
||||
hypot(36);
|
||||
|
||||
echo "\n-- Testing hypot() function with more than expected no. of arguments --\n";
|
||||
hypot(36,25,0);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing hypot() : error conditions ***
|
||||
|
||||
-- Testing hypot() function with less than expected no. of arguments --
|
||||
|
||||
Warning: hypot() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
|
||||
Warning: hypot() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
|
||||
-- Testing hypot() function with more than expected no. of arguments --
|
||||
|
||||
Warning: hypot() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
===Done===
|
@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Test is_finite() - wrong params test is_finite()
|
||||
--FILE--
|
||||
<?php
|
||||
is_finite();
|
||||
is_finite(23,2,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: is_finite() expects exactly 1 parameter, 0 given in %s on line 2
|
||||
|
||||
Warning: is_finite() expects exactly 1 parameter, 3 given in %s on line 3
|
@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Test is_infinite() - wrong params test is_infinite()
|
||||
--FILE--
|
||||
<?php
|
||||
is_infinite();
|
||||
is_infinite(23,2,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: is_infinite() expects exactly 1 parameter, 0 given in %s on line 2
|
||||
|
||||
Warning: is_infinite() expects exactly 1 parameter, 3 given in %s on line 3
|
@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Test is_nan() - wrong params test is_nan()
|
||||
--FILE--
|
||||
<?php
|
||||
is_nan();
|
||||
is_nan(23,2,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: is_nan() expects exactly 1 parameter, 0 given in %s on line 2
|
||||
|
||||
Warning: is_nan() expects exactly 1 parameter, 3 given in %s on line 3
|
@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for log10()
|
||||
--INI--
|
||||
precision = 14
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float log10(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(log10($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(log10());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: log10() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: log10() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test log1p() - Error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float log1p ( float $arg )
|
||||
* Description: Returns log(1 + number), computed in a way that is accurate even
|
||||
* when the value of number is close to zero
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing log1p() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Testing log1p() function with less than expected no. of arguments --\n";
|
||||
log1p();
|
||||
echo "\n-- Testing log1p() function with more than expected no. of arguments --\n";
|
||||
log1p(36, true);
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing log1p() : error conditions ***
|
||||
|
||||
-- Testing log1p() function with less than expected no. of arguments --
|
||||
|
||||
Warning: log1p() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
-- Testing log1p() function with more than expected no. of arguments --
|
||||
|
||||
Warning: log1p() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
===Done===
|
@ -1,9 +0,0 @@
|
||||
--TEST--
|
||||
Test mt_getrandmax() - wrong paramas mt_getrandmax()
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mt_getrandmax(true));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
|
||||
NULL
|
@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Test mt_rand() - wrong params test mt_rand()
|
||||
--FILE--
|
||||
<?php
|
||||
mt_rand(25);
|
||||
mt_rand(10,100,false);
|
||||
mt_rand("one", 100);
|
||||
mt_rand(1, "hundered");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line 2
|
||||
|
||||
Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line 3
|
||||
|
||||
Warning: mt_rand() expects parameter 1 to be int, string given in %s on line 4
|
||||
|
||||
Warning: mt_rand() expects parameter 2 to be int, string given in %s on line 5
|
@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Test mt_srand() - wrong params test mt_srand()
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mt_srand(500, 0, true));
|
||||
var_dump(mt_srand("fivehundred"));
|
||||
var_dump(mt_srand("500ABC"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mt_srand() expects at most 2 parameters, 3 given in %s on line 2
|
||||
NULL
|
||||
|
||||
Warning: mt_srand() expects parameter 1 to be int, string given in %s on line 3
|
||||
NULL
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line 4
|
||||
NULL
|
@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Test octdec() - wrong params test octdec()
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : number octdec ( string $octal_string )
|
||||
* Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
echo "*** Testing octdec() : error conditions ***\n";
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
}
|
||||
|
||||
echo "\n-- Incorrect number of arguments --\n";
|
||||
octdec();
|
||||
octdec('0123567',true);
|
||||
|
||||
echo "\n-- Incorrect input --\n";
|
||||
octdec(new classA());
|
||||
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing octdec() : error conditions ***
|
||||
|
||||
-- Incorrect number of arguments --
|
||||
|
||||
Warning: octdec() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
|
||||
Warning: octdec() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
|
||||
-- Incorrect input --
|
||||
|
||||
Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d
|
@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Test pow() - wrong params test pow()
|
||||
--INI--
|
||||
precision=14
|
||||
--FILE--
|
||||
<?php
|
||||
pow();
|
||||
pow(36);
|
||||
pow(36,4,true);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: pow() expects exactly 2 parameters, 0 given in %s line 2
|
||||
|
||||
Warning: pow() expects exactly 2 parameters, 1 given in %s line 3
|
||||
|
||||
Warning: pow() expects exactly 2 parameters, 3 given in %s line 4
|
@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for rad2deg()
|
||||
--INI--
|
||||
precision = 14
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float rad2deg(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(rad2deg($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(rad2deg());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: rad2deg() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: rad2deg() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Test rand() - wrong params test rand()
|
||||
--FILE--
|
||||
<?php
|
||||
rand(25);
|
||||
rand(10,100,false);
|
||||
rand("one", 100);
|
||||
rand(1, "hundered");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: rand() expects exactly 2 parameters, 1 given in %s on line 2
|
||||
|
||||
Warning: rand() expects exactly 2 parameters, 3 given in %s on line 3
|
||||
|
||||
Warning: rand() expects parameter 1 to be int, string given in %s on line 4
|
||||
|
||||
Warning: rand() expects parameter 2 to be int, string given in %s on line 5
|
@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Test round() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : float round ( float $val [, int $precision ] )
|
||||
* Description: Returns the rounded value of val to specified precision (number of digits
|
||||
* after the decimal point)
|
||||
* Source code: ext/standard/math.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to round() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing round() : error conditions ***\n";
|
||||
|
||||
echo "\n-- Wrong nmumber of arguments --\n";
|
||||
var_dump(round());
|
||||
var_dump(round(500, 10, true));
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing round() : error conditions ***
|
||||
|
||||
-- Wrong nmumber of arguments --
|
||||
|
||||
Warning: round() expects at least 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
float(500)
|
||||
===Done===
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for sin()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float sin(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(sin($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(sin());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: sin() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: sin() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for sqrt()
|
||||
--INI--
|
||||
precision = 14
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float sqrt(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(sqrt($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(sqrt());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: sqrt() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: sqrt() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,32 +0,0 @@
|
||||
--TEST--
|
||||
Test srand() function : error conditions - incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : void srand ([ int $seed ] )
|
||||
* Description: Seed the random number generator.
|
||||
* Source code: ext/standard/rand.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to srand() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing srand() : error conditions ***\n";
|
||||
|
||||
var_dump(srand(500, 0, true));
|
||||
var_dump(srand("fivehundred"));
|
||||
var_dump(srand("500ABC"));
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
*** Testing srand() : error conditions ***
|
||||
|
||||
Warning: srand() expects at most 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: srand() expects parameter 1 to be int, string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: A non well formed numeric value encountered in %s on line %d
|
||||
NULL
|
||||
===Done===
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for tan()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float tan(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(tan($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(tan());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: tan() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: tan() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,29 +0,0 @@
|
||||
--TEST--
|
||||
Test wrong number of arguments for tanh()
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* proto float tanh(float number)
|
||||
* Function is implemented in ext/standard/math.c
|
||||
*/
|
||||
|
||||
$arg_0 = 1.0;
|
||||
$extra_arg = 1;
|
||||
|
||||
echo "\nToo many arguments\n";
|
||||
var_dump(tanh($arg_0, $extra_arg));
|
||||
|
||||
echo "\nToo few arguments\n";
|
||||
var_dump(tanh());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Too many arguments
|
||||
|
||||
Warning: tanh() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Too few arguments
|
||||
|
||||
Warning: tanh() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
@ -1,22 +0,0 @@
|
||||
--TEST--
|
||||
Syslog parameter parsing test
|
||||
--FILE--
|
||||
<?php
|
||||
openlog();
|
||||
openlog(NULL, 'string', 0);
|
||||
|
||||
syslog();
|
||||
syslog('Wrong parameter order', LOG_WARNING);
|
||||
|
||||
closelog('Doesnt take any parameters');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: openlog() expects exactly 3 parameters, 0 given in %s on line %d
|
||||
|
||||
Warning: openlog() expects parameter 2 to be int, string given in %s on line %d
|
||||
|
||||
Warning: syslog() expects exactly 2 parameters, 0 given in %s on line %d
|
||||
|
||||
Warning: syslog() expects parameter 1 to be int, string given in %s on line %d
|
||||
|
||||
Warning: closelog() expects exactly 0 parameters, 1 given in %s on line %d
|
@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
time_nanosleep — Delay for a number of seconds and nanoseconds
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists('time_nanosleep')) die("skip"); ?>
|
||||
--CREDITS--
|
||||
Àlex Corretgé - alex@corretge.cat
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$nano = time_nanosleep('A', 100000);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: time_nanosleep() expects parameter 1 to be int, string given in %s.php on line %d
|
@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
time_nanosleep — Delay for a number of seconds and nanoseconds
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists('time_nanosleep')) die("skip"); ?>
|
||||
--CREDITS--
|
||||
Àlex Corretgé - alex@corretge.cat
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$nano = time_nanosleep(2, 'B');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: time_nanosleep() expects parameter 2 to be int, string given in %s.php on line %d
|
@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
time_sleep_until() function - error test for time_sleep_until()
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?>
|
||||
--CREDITS--
|
||||
Filippo De Santis fd@ideato.it
|
||||
#PHPTestFest Cesena Italia on 2009-06-20
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(time_sleep_until('goofy'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: time_sleep_until() expects parameter 1 to be float, string given in %s on line 2
|
||||
NULL
|
@ -1,14 +0,0 @@
|
||||
--TEST--
|
||||
time_sleep_until() function - error test for time_sleep_until()
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?>
|
||||
--CREDITS--
|
||||
Francesco Fullone ff@ideato.it
|
||||
#PHPTestFest Cesena Italia on 2009-06-20
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(time_sleep_until());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: time_sleep_until() expects exactly 1 parameter, 0 given in %s on line 2
|
||||
NULL
|
@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Test closelog() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool closelog(void)
|
||||
* Description: Close connection to system logger
|
||||
* Source code: ext/standard/syslog.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing closelog() : error conditions ***\n";
|
||||
|
||||
// One argument
|
||||
echo "\n-- Testing closelog() function with one argument --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( closelog($extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing closelog() : error conditions ***
|
||||
|
||||
-- Testing closelog() function with one argument --
|
||||
|
||||
Warning: closelog() expects exactly 0 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,12 +0,0 @@
|
||||
--TEST--
|
||||
gethostbyname() function - basic invalid parameter test
|
||||
--CREDITS--
|
||||
"Sylvain R." <sracine@phpquebec.org>
|
||||
--INI--
|
||||
display_errors=false
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(gethostbyname());
|
||||
?>
|
||||
--EXPECT--
|
||||
NULL
|
@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Test gethostbynamel() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array gethostbynamel(string hostname)
|
||||
* Description: Return a list of IP addresses that a given hostname resolves to.
|
||||
* Source code: ext/standard/dns.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing gethostbynamel() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing gethostbynamel() function with Zero arguments --\n";
|
||||
var_dump( gethostbynamel() );
|
||||
|
||||
//Test gethostbynamel with one more than the expected number of arguments
|
||||
echo "\n-- Testing gethostbynamel() function with more than expected no. of arguments --\n";
|
||||
$hostname = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( gethostbynamel($hostname, $extra_arg) );
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing gethostbynamel() : error conditions ***
|
||||
|
||||
-- Testing gethostbynamel() function with Zero arguments --
|
||||
|
||||
Warning: gethostbynamel() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing gethostbynamel() function with more than expected no. of arguments --
|
||||
|
||||
Warning: gethostbynamel() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
Done
|
@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Test ip2long() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int ip2long(string ip_address)
|
||||
* Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing ip2long() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing ip2long() function with Zero arguments --\n";
|
||||
var_dump( ip2long() );
|
||||
|
||||
//Test ip2long with one more than the expected number of arguments
|
||||
echo "\n-- Testing ip2long() function with more than expected no. of arguments --\n";
|
||||
$ip_address = '127.0.0.1';
|
||||
$extra_arg = 10;
|
||||
var_dump( ip2long($ip_address, $extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing ip2long() : error conditions ***
|
||||
|
||||
-- Testing ip2long() function with Zero arguments --
|
||||
|
||||
Warning: ip2long() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing ip2long() function with more than expected no. of arguments --
|
||||
|
||||
Warning: ip2long() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Test long2ip() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : string long2ip(int proper_address)
|
||||
* Description: Converts an (IPv4) Internet network address into a string in Internet standard dotted format
|
||||
* Source code: ext/standard/basic_functions.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing long2ip() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing long2ip() function with Zero arguments --\n";
|
||||
var_dump( long2ip() );
|
||||
|
||||
//Test long2ip with one more than the expected number of arguments
|
||||
echo "\n-- Testing long2ip() function with more than expected no. of arguments --\n";
|
||||
$proper_address = 10;
|
||||
$extra_arg = 10;
|
||||
var_dump( long2ip($proper_address, $extra_arg) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing long2ip() : error conditions ***
|
||||
|
||||
-- Testing long2ip() function with Zero arguments --
|
||||
|
||||
Warning: long2ip() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing long2ip() function with more than expected no. of arguments --
|
||||
|
||||
Warning: long2ip() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
Test syslog() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool syslog(int priority, string message)
|
||||
* Description: Generate a system log message
|
||||
* Source code: ext/standard/syslog.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing syslog() : error conditions ***\n";
|
||||
|
||||
|
||||
//Test syslog with one more than the expected number of arguments
|
||||
echo "\n-- Testing syslog() function with more than expected no. of arguments --\n";
|
||||
$priority = 10;
|
||||
$message = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( syslog($priority, $message, $extra_arg) );
|
||||
|
||||
// Testing syslog with one less than the expected number of arguments
|
||||
echo "\n-- Testing syslog() function with less than expected no. of arguments --\n";
|
||||
$priority = 10;
|
||||
var_dump( syslog($priority) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing syslog() : error conditions ***
|
||||
|
||||
-- Testing syslog() function with more than expected no. of arguments --
|
||||
|
||||
Warning: syslog() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing syslog() function with less than expected no. of arguments --
|
||||
|
||||
Warning: syslog() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Test error operation of password_get_info()
|
||||
--FILE--
|
||||
<?php
|
||||
//-=-=-=-
|
||||
var_dump(password_get_info());
|
||||
var_dump(password_get_info(array()));
|
||||
|
||||
echo "OK!";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: password_get_info() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: password_get_info() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
OK!
|
@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Test serialize() & unserialize() functions: error conditions - wrong number of args.
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string serialize(mixed variable)
|
||||
* Description: Returns a string representation of variable (which can later be unserialized)
|
||||
* Source code: ext/standard/var.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
/* Prototype : proto mixed unserialize(string variable_representation)
|
||||
* Description: Takes a string representation of variable and recreates it
|
||||
* Source code: ext/standard/var.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing serialize()/unserialize() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
var_dump( serialize() );
|
||||
var_dump( unserialize() );
|
||||
|
||||
//Test serialize with one more than the expected number of arguments
|
||||
var_dump( serialize(1,2) );
|
||||
var_dump( unserialize(1,2,3) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing serialize()/unserialize() : error conditions ***
|
||||
|
||||
Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16
|
||||
NULL
|
||||
|
||||
Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17
|
||||
bool(false)
|
||||
|
||||
Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20
|
||||
NULL
|
||||
|
||||
Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21
|
||||
bool(false)
|
||||
Done
|
@ -1,21 +0,0 @@
|
||||
--TEST--
|
||||
stream_context_set_option() function - error : invalid argument
|
||||
--CREDITS--
|
||||
Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
|
||||
# Alter Way Contribution Day 2011
|
||||
--FILE--
|
||||
<?php
|
||||
$context = stream_context_create();
|
||||
|
||||
// Single option
|
||||
var_dump(stream_context_set_option($context, 'http'));
|
||||
|
||||
// Array of options
|
||||
var_dump(stream_context_set_option($context, array(), 'foo', 'bar'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_context_set_option() expects parameter 2 to be array, string given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: stream_context_set_option() expects parameter 2 to be string, array given in %s on line %d
|
||||
bool(false)
|
@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
stream_context_set_option() function - error : missing argument
|
||||
--CREDITS--
|
||||
Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
|
||||
# Alter Way Contribution Day 2011
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(stream_context_set_option());
|
||||
|
||||
$context = stream_context_create();
|
||||
var_dump(stream_context_set_option($context));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_context_set_option() expects exactly 4 parameters, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: stream_context_set_option() expects exactly 4 parameters, 1 given in %s on line %d
|
||||
bool(false)
|
@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Test strlen() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Prototype : int strlen ( string $string )
|
||||
* Description: Get string length
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
echo "*** Testing strlen() : unexpected number of arguments ***";
|
||||
|
||||
|
||||
echo "\n-- Testing strlen() function with no arguments --\n";
|
||||
var_dump( strlen() );
|
||||
|
||||
echo "\n-- Testing strlen() function with more than expected no. of arguments --\n";
|
||||
$extra_arg = 10;
|
||||
var_dump( strlen("abc def", $extra_arg) );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing strlen() : unexpected number of arguments ***
|
||||
-- Testing strlen() function with no arguments --
|
||||
|
||||
Warning: strlen() expects exactly 1 parameter, 0 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing strlen() function with more than expected no. of arguments --
|
||||
|
||||
Warning: strlen() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
@ -1,34 +0,0 @@
|
||||
--TEST--
|
||||
Test strripos() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : int strripos ( string $haystack, string $needle [, int $offset] );
|
||||
* Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
|
||||
* Source code: ext/standard/string.c
|
||||
*/
|
||||
|
||||
echo "*** Testing strripos() function: error conditions ***";
|
||||
echo "\n-- With Zero arguments --";
|
||||
var_dump( strripos() );
|
||||
|
||||
echo "\n-- With less than expected number of arguments --";
|
||||
var_dump( strripos("String") );
|
||||
|
||||
echo "\n-- With more than expected number of arguments --";
|
||||
var_dump( strripos("string", "String", 1, 'extra_arg') );
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing strripos() function: error conditions ***
|
||||
-- With Zero arguments --
|
||||
Warning: strripos() expects at least 2 parameters, 0 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- With less than expected number of arguments --
|
||||
Warning: strripos() expects at least 2 parameters, 1 given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- With more than expected number of arguments --
|
||||
Warning: strripos() expects at most 3 parameters, 4 given in %s on line %d
|
||||
bool(false)
|
||||
===DONE===
|
@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Test base64_decode() function : error conditions - wrong number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string base64_decode(string str[, bool strict])
|
||||
* Description: Decodes string using MIME base64 algorithm
|
||||
* Source code: ext/standard/base64.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing base64_decode() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing base64_decode() function with Zero arguments --\n";
|
||||
var_dump( base64_decode() );
|
||||
|
||||
//Test base64_decode with one more than the expected number of arguments
|
||||
echo "\n-- Testing base64_decode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$strict = true;
|
||||
$extra_arg = 10;
|
||||
var_dump( base64_decode($str, $strict, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing base64_decode() : error conditions ***
|
||||
|
||||
-- Testing base64_decode() function with Zero arguments --
|
||||
|
||||
Warning: base64_decode() expects at least 1 parameter, 0 given in %s on line 12
|
||||
NULL
|
||||
|
||||
-- Testing base64_decode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: base64_decode() expects at most 2 parameters, 3 given in %s on line 19
|
||||
NULL
|
||||
Done
|
@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Test base64_encode() function : error conditions - wrong number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string base64_encode(string str)
|
||||
* Description: Encodes string using MIME base64 algorithm
|
||||
* Source code: ext/standard/base64.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing base64_encode() : error conditions - wrong number of args ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing base64_encode() function with Zero arguments --\n";
|
||||
var_dump( base64_encode() );
|
||||
|
||||
//Test base64_encode with one more than the expected number of arguments
|
||||
echo "\n-- Testing base64_encode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( base64_encode($str, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing base64_encode() : error conditions - wrong number of args ***
|
||||
|
||||
-- Testing base64_encode() function with Zero arguments --
|
||||
|
||||
Warning: base64_encode() expects exactly 1 parameter, 0 given in %s on line 12
|
||||
NULL
|
||||
|
||||
-- Testing base64_encode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: base64_encode() expects exactly 1 parameter, 2 given in %s on line 18
|
||||
NULL
|
||||
Done
|
@ -1,42 +0,0 @@
|
||||
--TEST--
|
||||
Test get_headers() function : error conditions - wrong number of args
|
||||
--CREDITS--
|
||||
June Henriksen <juneih@redpill-linpro.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array get_headers(string url[, int format[, resource $context]])
|
||||
* Description: Fetches all the headers sent by the server in response to a HTTP request
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing get_headers() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing get_headers() function with Zero arguments --\n";
|
||||
var_dump( get_headers() );
|
||||
|
||||
//Test get_headers with one more than the expected number of arguments
|
||||
echo "\n-- Testing get_headers() function with more than expected no. of arguments --\n";
|
||||
$url = 'string_val';
|
||||
$format = 1;
|
||||
$context = stream_context_get_default();
|
||||
$extra_arg = 10;
|
||||
var_dump( get_headers($url, $format, $context, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing get_headers() : error conditions ***
|
||||
|
||||
-- Testing get_headers() function with Zero arguments --
|
||||
|
||||
Warning: get_headers() expects at least 1 parameter, 0 given in %s on line 12
|
||||
NULL
|
||||
|
||||
-- Testing get_headers() function with more than expected no. of arguments --
|
||||
|
||||
Warning: get_headers() expects at most 3 parameters, 4 given in %s on line 20
|
||||
NULL
|
||||
Done
|
@ -1,54 +0,0 @@
|
||||
--TEST--
|
||||
Test get_headers() function: wrong type for argument format
|
||||
--CREDITS--
|
||||
June Henriksen <juneih@redpill-linpro.com>
|
||||
#PHPTestFest2009 Norway 2009-06-09 \o/
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto array get_headers(string url[, int format])
|
||||
* Description: Fetches all the headers sent by the server in response to a HTTP request
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing get_headers() : error conditions ***\n";
|
||||
$url = 'http://php.net';
|
||||
|
||||
// Format argument as type String
|
||||
echo "\n-- Testing get_headers() function with format argument as type string --\n";
|
||||
var_dump( get_headers($url, "#PHPTestFest2009 Norway") );
|
||||
|
||||
// Format argument as type Array
|
||||
echo "\n-- Testing get_headers() function with format argument as type array --\n";
|
||||
var_dump( get_headers($url, array()) );
|
||||
|
||||
// Format argument as type Object
|
||||
class testObject
|
||||
{
|
||||
}
|
||||
|
||||
$object = new testObject();
|
||||
echo "\n-- Testing get_headers() function with format argument as type object --\n";
|
||||
var_dump( get_headers($url, $object) );
|
||||
|
||||
|
||||
echo "Done"
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing get_headers() : error conditions ***
|
||||
|
||||
-- Testing get_headers() function with format argument as type string --
|
||||
|
||||
Warning: get_headers() expects parameter 2 to be int, string given in %s on line 13
|
||||
NULL
|
||||
|
||||
-- Testing get_headers() function with format argument as type array --
|
||||
|
||||
Warning: get_headers() expects parameter 2 to be int, array given in %s on line 17
|
||||
NULL
|
||||
|
||||
-- Testing get_headers() function with format argument as type object --
|
||||
|
||||
Warning: get_headers() expects parameter 2 to be int, object given in %s on line 26
|
||||
NULL
|
||||
Done
|
@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Test parse_url() function : error conditions - wrong number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto mixed parse_url(string url, [int url_component])
|
||||
* Description: Parse a URL and return its components
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
echo "*** Testing parse_url() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing parse_url() function with Zero arguments --\n";
|
||||
var_dump( parse_url() );
|
||||
|
||||
//Test parse_url with one more than the expected number of arguments
|
||||
echo "\n-- Testing parse_url() function with more than expected no. of arguments --\n";
|
||||
$url = 'string_val';
|
||||
$url_component = 10;
|
||||
$extra_arg = 10;
|
||||
var_dump( parse_url($url, $url_component, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing parse_url() : error conditions ***
|
||||
|
||||
-- Testing parse_url() function with Zero arguments --
|
||||
|
||||
Warning: parse_url() expects at least 1 parameter, 0 given in %s on line 12
|
||||
NULL
|
||||
|
||||
-- Testing parse_url() function with more than expected no. of arguments --
|
||||
|
||||
Warning: parse_url() expects at most 2 parameters, 3 given in %s on line 19
|
||||
NULL
|
||||
Done
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test rawurldecode() function : error conditions - wrong number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string rawurldecode(string str)
|
||||
* Description: Decodes URL-encodes string
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
// NB: basic functionality tested in tests/strings/001.phpt
|
||||
|
||||
echo "*** Testing rawurldecode() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing rawurldecode() function with Zero arguments --\n";
|
||||
var_dump( rawurldecode() );
|
||||
|
||||
//Test rawurldecode with one more than the expected number of arguments
|
||||
echo "\n-- Testing rawurldecode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( rawurldecode($str, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing rawurldecode() : error conditions ***
|
||||
|
||||
-- Testing rawurldecode() function with Zero arguments --
|
||||
|
||||
Warning: rawurldecode() expects exactly 1 parameter, 0 given in %s on line 14
|
||||
NULL
|
||||
|
||||
-- Testing rawurldecode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: rawurldecode() expects exactly 1 parameter, 2 given in %s on line 20
|
||||
NULL
|
||||
Done
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test rawurlencode() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string rawurlencode(string str)
|
||||
* Description: URL-encodes string
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
// NB: basic functionality tested in tests/strings/001.phpt
|
||||
|
||||
echo "*** Testing rawurlencode() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing rawurlencode() function with Zero arguments --\n";
|
||||
var_dump( rawurlencode() );
|
||||
|
||||
//Test rawurlencode with one more than the expected number of arguments
|
||||
echo "\n-- Testing rawurlencode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( rawurlencode($str, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing rawurlencode() : error conditions ***
|
||||
|
||||
-- Testing rawurlencode() function with Zero arguments --
|
||||
|
||||
Warning: rawurlencode() expects exactly 1 parameter, 0 given in %s on line 14
|
||||
NULL
|
||||
|
||||
-- Testing rawurlencode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: rawurlencode() expects exactly 1 parameter, 2 given in %s on line 20
|
||||
NULL
|
||||
Done
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test urldecode() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string urldecode(string str)
|
||||
* Description: Decodes URL-encoded string
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
// NB: basic functionality tested in tests/strings/001.phpt
|
||||
|
||||
echo "*** Testing urldecode() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing urldecode() function with Zero arguments --\n";
|
||||
var_dump( urldecode() );
|
||||
|
||||
//Test urldecode with one more than the expected number of arguments
|
||||
echo "\n-- Testing urldecode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( urldecode($str, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing urldecode() : error conditions ***
|
||||
|
||||
-- Testing urldecode() function with Zero arguments --
|
||||
|
||||
Warning: urldecode() expects exactly 1 parameter, 0 given in %s on line 14
|
||||
NULL
|
||||
|
||||
-- Testing urldecode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: urldecode() expects exactly 1 parameter, 2 given in %s on line 20
|
||||
NULL
|
||||
Done
|
@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Test urlencode() function : error conditions
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : proto string urlencode(string str)
|
||||
* Description: URL-encodes string
|
||||
* Source code: ext/standard/url.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
// NB: basic functionality tested in tests/strings/001.phpt
|
||||
|
||||
echo "*** Testing urlencode() : error conditions ***\n";
|
||||
|
||||
// Zero arguments
|
||||
echo "\n-- Testing urlencode() function with Zero arguments --\n";
|
||||
var_dump( urlencode() );
|
||||
|
||||
//Test urlencode with one more than the expected number of arguments
|
||||
echo "\n-- Testing urlencode() function with more than expected no. of arguments --\n";
|
||||
$str = 'string_val';
|
||||
$extra_arg = 10;
|
||||
var_dump( urlencode($str, $extra_arg) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing urlencode() : error conditions ***
|
||||
|
||||
-- Testing urlencode() function with Zero arguments --
|
||||
|
||||
Warning: urlencode() expects exactly 1 parameter, 0 given in %s on line 14
|
||||
NULL
|
||||
|
||||
-- Testing urlencode() function with more than expected no. of arguments --
|
||||
|
||||
Warning: urlencode() expects exactly 1 parameter, 2 given in %s on line 20
|
||||
NULL
|
||||
Done
|
Loading…
Reference in New Issue
Block a user