Adjust tests for zpp TypeError change

This commit is contained in:
Nikita Popov 2019-02-19 17:11:00 +01:00
parent 6bfb119e18
commit 852485d8ec
907 changed files with 2167 additions and 13108 deletions

View file

@ -23,8 +23,6 @@ class bar extends foo {
}
}
var_dump(property_exists());
var_dump(property_exists(""));
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
@ -53,11 +51,6 @@ $bar->test();
echo "Done\n";
?>
--EXPECTF--
Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
NULL
bool(true)
bool(true)
bool(true)

View file

@ -6,10 +6,8 @@ class_exists() tests
class foo {
}
var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
@ -18,14 +16,9 @@ var_dump(class_exists("stdClass"));
echo "Done\n";
?>
--EXPECTF--
Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
--EXPECT--
bool(false)
bool(false)
Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)

View file

@ -6,10 +6,8 @@ interface_exists() tests
interface foo {
}
var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
@ -18,14 +16,9 @@ var_dump(interface_exists("stdClass"));
echo "Done\n";
?>
--EXPECTF--
Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d
NULL
--EXPECT--
bool(false)
bool(false)
Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(false)
bool(true)
bool(true)

View file

@ -8,13 +8,9 @@ var_dump(get_included_files());
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1,1));
include_once(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1));
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
@ -31,18 +27,12 @@ array(2) {
[1]=>
string(%d) "%s"
}
Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"

View file

@ -3,9 +3,7 @@ trigger_error() tests
--FILE--
<?php
var_dump(trigger_error());
var_dump(trigger_error("error"));
var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
@ -14,15 +12,9 @@ var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
--EXPECTF--
Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
NULL
Notice: error in %s on line %d
bool(true)
Warning: trigger_error() expects parameter 1 to be string, array given in %s on line %d
NULL
Warning: Invalid error type specified in %s on line %d
bool(false)

View file

@ -3,8 +3,6 @@ builtin functions tests
--FILE--
<?php
var_dump(get_resource_type());
var_dump(get_resource_type(""));
$fp = fopen(__FILE__, "r");
var_dump(get_resource_type($fp));
fclose($fp);
@ -14,11 +12,9 @@ var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
var_dump(get_defined_constants(true, true));
var_dump(gettype(get_defined_constants(true)));
var_dump(gettype(get_defined_constants()));
var_dump(count(get_defined_constants()));
@ -29,11 +25,9 @@ function test () {
var_dump(gettype(get_defined_functions()));
var_dump(count(get_defined_functions()));
var_dump(get_declared_interfaces(true));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));
var_dump(get_extension_funcs());
var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
@ -44,36 +38,19 @@ var_dump(count(get_extension_funcs("zend")));
echo "Done\n";
?>
--EXPECTF--
Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
NULL
string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
NULL
Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
NULL
string(5) "array"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d
NULL
string(5) "array"
int(%d)
Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
NULL
bool(false)
string(5) "array"
int(%d)

View file

@ -3,12 +3,8 @@ constant() tests
--FILE--
<?php
var_dump(constant());
var_dump(constant("", ""));
var_dump(constant(""));
var_dump(constant(array()));
define("TEST_CONST", 1);
var_dump(constant("TEST_CONST"));
@ -18,17 +14,8 @@ var_dump(constant("TEST_CONST2"));
echo "Done\n";
?>
--EXPECTF--
Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: constant() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Warning: constant(): Couldn't find constant in %s on line %d
NULL
Warning: constant() expects parameter 1 to be string, array given in %s on line %d
NULL
int(1)
string(4) "test"
Done

View file

@ -3,9 +3,7 @@ func_get_arg() invalid usage
--FILE--
<?php
var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
var_dump(func_get_arg());
function bar() {
var_dump(func_get_arg(1));
@ -20,15 +18,9 @@ foo(1,2);
echo "Done\n";
?>
--EXPECTF--
Warning: func_get_arg() expects exactly 1 parameter, 3 given in %s on line %d
NULL
Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
bool(false)
Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Done

View file

@ -4,11 +4,14 @@ Bug #31720 (Invalid object callbacks not caught in array_walk())
<?php
$array = array('at least one element');
array_walk($array, array($nonesuchvar,'show'));
try {
array_walk($array, array($nonesuchvar,'show'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
--EXPECTF--
Notice: Undefined variable: nonesuchvar in %s on line %d
Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d
array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object
===DONE===

View file

@ -31,10 +31,14 @@ $x->test();
call_user_func(array('BAR','x'));
call_user_func('BAR::www');
call_user_func('self::y');
try {
call_user_func('self::y');
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
--EXPECT--
__call:
string(3) "ABC"
__call:
@ -50,5 +54,4 @@ string(1) "y"
ok
__callstatic:
string(3) "www"
Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186.php on line 31
call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active

View file

@ -26,11 +26,19 @@ $x = new bar;
$x->test();
call_user_func(array('BAR','x'));
call_user_func('BAR::www');
call_user_func('self::y');
try {
call_user_func('BAR::www');
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
call_user_func('self::y');
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
--EXPECT--
__call:
string(3) "ABC"
__call:
@ -44,7 +52,5 @@ string(1) "y"
__call:
string(1) "y"
ok
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www' in %s on line %d
Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186_2.php on line 27
call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www'
call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active

View file

@ -15,8 +15,13 @@ function test($x) {
}
$x = new ReflectionFunction('str_pad');
test($x);
try {
test($x);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
DONE
--EXPECT--
str_pad() expects at least 2 parameters, 1 given
DONE

View file

@ -16,4 +16,8 @@ register_shutdown_function('exploDe');
--EXPECTF--
int(1)
Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d
Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0
Stack trace:
#0 [internal function]: explode()
#1 {main}
thrown in [no active file] on line 0

View file

@ -3,13 +3,23 @@ Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
array_map("%n", 0);
array_map("%n %i", 0);
array_map("%n %i aoeu %f aoeu %p", 0);
try {
array_map("%n", 0);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
array_map("%n %i", 0);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
array_map("%n %i aoeu %f aoeu %p", 0);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTREGEX--
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n' not found or invalid function name in .+
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name in .+
Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name in .+bug70895.php on line \d+
--EXPECT--
array_map() expects parameter 1 to be a valid callback, function '%n' not found or invalid function name
array_map() expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name
array_map() expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name

View file

@ -2,21 +2,15 @@
Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
function m($f,$a){
return array_map($f,0);
}
function m($f,$a){
return array_map($f,0);
}
echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
try {
echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name in %sbug70898.php on line %d
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
Warning: implode(): Argument must be an array in %sbug70898.php on line %d
--EXPECT--
array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name

View file

@ -14,5 +14,6 @@ try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
?>
--EXPECTF--
Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
===DONE===
--EXPECT--
===DONE===

View file

@ -22,14 +22,20 @@ namespace testing {
call_user_func(__NAMESPACE__ .'\foobar', 'foobar');
$class = __NAMESPACE__ .'\foo';
call_user_func(array(new $class, 'priv'), 'foobar');
call_user_func(array(new $class, 'prot'), 'foobar');
try {
call_user_func(array(new $class, 'priv'), 'foobar');
} catch (\TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
call_user_func(array(new $class, 'prot'), 'foobar');
} catch (\TypeError $e) {
echo $e->getMessage(), "\n";
}
}
?>
--EXPECTF--
--EXPECT--
string(6) "foobar"
Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d
Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d
call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv()
call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot()

View file

@ -4,26 +4,38 @@ Testing call_user_func() with autoload and passing invalid params
<?php
spl_autoload_register(function ($class) {
var_dump($class);
var_dump($class);
});
call_user_func(array('foo', 'bar'));
call_user_func(array('', 'bar'));
call_user_func(array($foo, 'bar'));
call_user_func(array($foo, ''));
try {
call_user_func(array('foo', 'bar'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
call_user_func(array('', 'bar'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
call_user_func(array($foo, 'bar'));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
call_user_func(array($foo, ''));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
string(3) "foo"
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found in %s on line %d
Warning: call_user_func() expects parameter 1 to be a valid callback, class '' not found in %s on line %d
call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found
call_user_func() expects parameter 1 to be a valid callback, class '' not found
Notice: Undefined variable: foo in %s on line %d
Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
Notice: Undefined variable: foo in %s on line %d
Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object

View file

@ -12,15 +12,11 @@ var_dump(class_exists(NULL));
var_dump(class_exists('FOO'));
var_dump(class_exists('bar'));
var_dump(class_exists(1));
var_dump(class_exists(new stdClass));
?>
--EXPECTF--
--EXPECT--
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
Warning: class_exists() expects parameter 1 to be string, object given in %s on line %d
NULL

View file

@ -25,9 +25,6 @@ $ca = $a->getIncrementor();
$cas = $a->getStaticIncrementor();
$ca->bindTo($a, array());
$ca->bindTo(array(), 'A');
$ca->bindTo($a, array(), "");
$ca->bindTo();
$cas->bindTo($a, 'A');
?>
@ -36,10 +33,4 @@ Notice: Array to string conversion in %s on line %d
Warning: Class 'Array' not found in %s on line %d
Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25
Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d
Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d
Warning: Cannot bind an instance to a static closure in %s on line %d

View file

@ -8,7 +8,6 @@ error_reporting(E_ALL);
function make_exception()
{
@$blah;
str_replace();
error_reporting(0);
throw new Exception();
}

View file

@ -5,8 +5,6 @@ exception handler tests - 4
set_exception_handler("fo");
set_exception_handler(array("", ""));
set_exception_handler();
set_exception_handler("foo", "bar");
echo "Done\n";
?>
@ -14,8 +12,4 @@ echo "Done\n";
Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d
Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d
Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d
Warning: set_exception_handler() expects exactly 1 parameter, 2 given in %s on line %d
Done

View file

@ -2,9 +2,10 @@
Call internal function with incorrect number of arguments
--FILE--
<?php
substr("foo");
array_diff([]);
--EXPECTF--
Warning: substr() expects at least 2 parameters, 1 given in %s
Warning: array_diff(): at least 2 parameters are required, 1 given in %s
try {
substr("foo");
} catch (ArgumentCountError $e) {
echo $e->getMessage(), "\n";
}
--EXPECT--
substr() expects at least 2 parameters, 1 given

View file

@ -9,13 +9,9 @@ interface foo {
var_dump(interface_exists('foo'));
var_dump(interface_exists(1));
var_dump(interface_exists(NULL));
var_dump(interface_exists(new stdClass));
?>
--EXPECTF--
--EXPECT--
bool(true)
bool(false)
bool(false)
Warning: interface_exists() expects parameter 1 to be string, object given in %s on line %d
NULL

View file

@ -2,11 +2,12 @@
call_user_func() in combination with "Call to a member function method() on a non-object"
--FILE--
<?php
$comparator= null;
var_dump(call_user_func([$comparator, 'compare'], 1, 2));
echo "Alive\n";
$comparator = null;
try {
var_dump(call_user_func([$comparator, 'compare'], 1, 2));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
NULL
Alive
--EXPECT--
call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object

View file

@ -9,13 +9,9 @@ trait foo {
var_dump(trait_exists('foo'));
var_dump(trait_exists(1));
var_dump(trait_exists(NULL));
var_dump(trait_exists(new stdClass));
?>
--EXPECTF--
--EXPECT--
bool(true)
bool(false)
bool(false)
Warning: trait_exists() expects parameter 1 to be string, object given in %s on line %d
NULL

View file

@ -2,16 +2,17 @@
Crash when function parameter modified via unexpected reference
--FILE--
<?php
function my_errorhandler($errno,$errormsg) {
global $my_var;
$my_var = 0;
return true;
class Test {
public function __toString() {
global $my_var;
$my_var = 0;
return ",";
}
}
set_error_handler("my_errorhandler");
$my_var = str_repeat("A",64);
$data = call_user_func_array("explode",array(new StdClass(), &$my_var));
$data = call_user_func_array("explode",array(new Test(), &$my_var));
$my_var=array(1,2,3);
$data = call_user_func_array("implode",array(&$my_var, new StdClass()));
$data = call_user_func_array("implode",array(&$my_var, new Test()));
echo "Done.\n";
?>
--EXPECT--

View file

@ -5,7 +5,6 @@ bzopen() and invalid parameters
--FILE--
<?php
var_dump(bzopen());
var_dump(bzopen("", ""));
var_dump(bzopen("", "r"));
var_dump(bzopen("", "w"));
@ -19,9 +18,6 @@ var_dump(bzopen($fp, "r"));
echo "Done\n";
?>
--EXPECTF--
Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d
bool(false)

View file

@ -6,8 +6,6 @@ bzread() tests
<?php
$fd = bzopen(dirname(__FILE__)."/003私はガラスを食べられます.txt.bz2","r");
var_dump(bzread());
var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
var_dump(bzread($fd, -10));
var_dump(bzread($fd, 1));
@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000));
echo "Done\n";
?>
--EXPECTF--
Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
string(0) ""
Warning: bzread(): length may not be negative in %s on line %d

View file

@ -6,8 +6,6 @@ bzread() tests
<?php
$fd = bzopen(dirname(__FILE__)."/003.txt.bz2","r");
var_dump(bzread());
var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
var_dump(bzread($fd, -10));
var_dump(bzread($fd, 1));
@ -17,11 +15,6 @@ var_dump(bzread($fd, 100000));
echo "Done\n";
?>
--EXPECTF--
Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
string(0) ""
Warning: bzread(): length may not be negative in %s on line %d

View file

@ -10,7 +10,6 @@ Drifting further everyday
Getting lost within myself
Nothing matters no one else";
var_dump(bzcompress());
var_dump(bzcompress(1,1,1));
var_dump(bzcompress($string, 100));
var_dump(bzcompress($string, 100, -1));
@ -23,8 +22,6 @@ $data2 = bzcompress($string, 1, 10);
$data3 = $data2;
$data3{3} = 0;
var_dump(bzdecompress());
var_dump(bzdecompress(1,1,1));
var_dump(bzdecompress(1,1));
var_dump(bzdecompress($data3));
var_dump(bzdecompress($data3,1));
@ -38,19 +35,11 @@ var_dump(bzdecompress($data2));
echo "Done\n";
?>
--EXPECTF--
Warning: bzcompress() expects at least 1 parameter, 0 given in %s on line %d
NULL
string(%d) "BZ%a"
int(-2)
int(-2)
int(-2)
int(-2)
Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
int(-5)
int(-5)
int(-5)

View file

@ -9,7 +9,6 @@ $jd_days = Array(
2453396,
2440588,
-1,
array(),
10000000
);
@ -52,28 +51,6 @@ string(0) ""
string(0) ""
string(0) ""
===
Notice: Array to string conversion in %sjdtomonthname.php on line %d
Array
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
bool(false)
=== 10000000
string(3) "Dec"
string(8) "December"

View file

@ -9,37 +9,17 @@ Paul Sohier
<?php
echo "*** curl_setopt() call with incorrect parameters\n";
$ch = curl_init();
curl_setopt();
curl_setopt(false);
curl_setopt($ch);
curl_setopt($ch, false);
curl_setopt($ch, -10);
curl_setopt($ch, '');
curl_setopt($ch, 1, false);
try {
curl_setopt($ch, '', false);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
curl_setopt(false, false, false);
curl_setopt($ch, '', false);
curl_setopt($ch, 1, '');
curl_setopt($ch, -10, 0);
?>
--EXPECTF--
*** curl_setopt() call with incorrect parameters
Warning: curl_setopt() expects exactly 3 parameters, 0 given in %s on line %d
Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
Warning: curl_setopt() expects parameter 1 to be resource, bool given in %s on line %d
Warning: curl_setopt() expects parameter 2 to be int, string given in %s on line %d
curl_setopt() expects parameter 2 to be int, string given
Warning: curl_setopt(): Invalid curl configuration option in %scurl_setopt_error.php on line %d

View file

@ -6,9 +6,6 @@ date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
var_dump(idate());
var_dump(idate(1,1,1));
var_dump(idate(1,1));
var_dump(idate(""));
var_dump(idate(0));
@ -20,12 +17,6 @@ var_dump(idate("'"));
echo "Done\n";
?>
--EXPECTF--
Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
Warning: idate(): Unrecognized date format token. in %s on line %d
bool(false)

View file

@ -4,7 +4,6 @@ checkdate() tests
<?php
date_default_timezone_set('UTC');
var_dump(checkdate());
var_dump(checkdate(1,1,1));
var_dump(checkdate(2,29,2006));
@ -18,9 +17,7 @@ var_dump(checkdate(1,1,-1));
echo "Done\n";
?>
--EXPECTF--
Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
bool(false)
--EXPECT--
bool(true)
bool(false)
bool(false)

View file

@ -5,7 +5,6 @@ localtime() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
var_dump(localtime(1,1,1));
var_dump(localtime());
var_dump(localtime($t));
@ -15,8 +14,6 @@ var_dump(localtime($t, false));
echo "Done\n";
?>
--EXPECTF--
Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
array(9) {
[0]=>
int(%d)

View file

@ -5,7 +5,6 @@ getdate() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
var_dump(getdate(1,1));
var_dump(getdate($t));
var_dump(getdate());
@ -13,8 +12,6 @@ var_dump(getdate());
echo "Done\n";
?>
--EXPECTF--
Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
bool(false)
array(11) {
["seconds"]=>
int(0)

View file

@ -11,16 +11,12 @@ date_default_timezone_set('Asia/Jerusalem');
$t = mktime(0,0,0, 6, 27, 2006);
var_dump(strftime());
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(strftime("%%q %%a", $t));
var_dump(strftime("%q", $t));
var_dump(strftime("blah", $t));
var_dump(gmstrftime());
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(gmstrftime("%%q %%a", $t));
@ -30,17 +26,12 @@ var_dump(gmstrftime("blah", $t));
echo "Done\n";
?>
--EXPECTF--
Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
%s %"
string(5) "%q %a"
string(%d) "%s"
string(4) "blah"
Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
bool(false)
string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
%s %"

View file

@ -15,8 +15,6 @@ setlocale(LC_TIME, "en-us");
$t = mktime(0,0,0, 6, 27, 2006);
var_dump(strftime());
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@ -25,8 +23,6 @@ var_dump(strftime("%%q %%a", $t));
var_dump(strftime("blah", $t));
var_dump(gmstrftime());
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@ -40,15 +36,10 @@ echo "Done\n";
setlocale(LC_TIME, $loc);
?>
--EXPECTF--
Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June 6/27/2006 12:00:00 AM 27 00 12 178 06 00 AM 00 26 26 2 6/27/2006 12:00:00 AM 06 2006 %s"
string(5) "%q %a"
string(4) "blah"
Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
bool(false)
string(%d) "Mon Monday Jun June 6/26/2006 9:00:00 PM 26 21 09 177 06 00 PM 00 26 26 1 6/26/2006 9:00:00 PM 06 2006 %s"
string(5) "%q %a"

View file

@ -4,7 +4,6 @@ timezone_name_from_abbr() tests
<?php
date_default_timezone_set('UTC');
var_dump(timezone_name_from_abbr());
var_dump(timezone_name_from_abbr("CET"));
var_dump(timezone_name_from_abbr("AXST"));
var_dump(timezone_name_from_abbr("", 3600));
@ -12,9 +11,7 @@ var_dump(timezone_name_from_abbr("", 3600, 0));
echo "Done\n";
?>
--EXPECTF--
Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
--EXPECT--
string(13) "Europe/Berlin"
bool(false)
bool(false)

View file

@ -7,15 +7,10 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump(date_isodate_set($dto, 2006, 2, 15));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 5));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 100, 15));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 100, 15, 10));
var_dump($dto->format("Y/m/d H:i:s"));
echo "Done\n";
?>
--EXPECTF--
@ -28,10 +23,6 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2006/01/23 00:00:00"
Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d
bool(false)
string(19) "2006/01/23 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-01-30 00:00:00.000000"
@ -50,8 +41,4 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2007/12/10 00:00:00"
Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
bool(false)
string(19) "2007/12/10 00:00:00"
Done

View file

@ -7,10 +7,6 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump($dto);
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set());
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 5));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 2, 15));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 24, 60));
@ -28,14 +24,6 @@ object(DateTime)#%d (3) {
string(3) "UTC"
}
string(19) "2006.12.12 00:00:00"
Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
bool(false)
string(19) "2006.12.12 00:00:00"
Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
bool(false)
string(19) "2006.12.12 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-02-15 00:00:00.000000"

View file

@ -10,7 +10,6 @@ var_dump($dto);
$dtz = date_timezone_get($dto);
var_dump($dtz);
var_dump(timezone_offset_get());
var_dump(timezone_offset_get($dtz, $dto));
var_dump(timezone_offset_get($dto, $dtz));
@ -32,9 +31,6 @@ object(DateTimeZone)#%d (2) {
["timezone"]=>
string(3) "UTC"
}
Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
int(0)
Fatal error: Uncaught TypeError: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s:%d

View file

@ -6,8 +6,12 @@ DateTimeZone::getOffset() accepts a DateTimeInterface object
$tz = new DateTimeZone('Europe/London');
$dt = new DateTimeImmutable('2014-09-20', $tz);
echo $tz->getOffset($dt);
echo $tz->getOffset(1);
--EXPECTF--
echo $tz->getOffset($dt), "\n";
try {
echo $tz->getOffset(1);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
--EXPECT--
3600
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s
DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given

View file

@ -1,5 +1,5 @@
--TEST--
Tests for DateTimeImmutable::createFromMutable.
Tests for DateTimeImmutable::createFromMutable
--INI--
date.timezone=Europe/London
--FILE--
@ -9,8 +9,11 @@ $current = "2014-03-02 16:24:08";
$i = DateTimeImmutable::createFromMutable( date_create( $current ) );
var_dump( $i );
$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
var_dump( $i );
try {
DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
object(DateTimeImmutable)#%d (3) {
@ -21,6 +24,4 @@ object(DateTimeImmutable)#%d (3) {
["timezone"]=>
string(13) "Europe/London"
}
Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d
NULL
DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given

View file

@ -14,8 +14,11 @@ $m->modify('+ 1 hour');
var_dump( $i->format('Y-m-d H:i:s') === $current );
$m = DateTime::createFromImmutable( date_create( $current ) );
var_dump( $m );
try {
DateTime::createFromImmutable( date_create( $current ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
object(DateTime)#%d (3) {
@ -27,6 +30,4 @@ object(DateTime)#%d (3) {
string(13) "Europe/London"
}
bool(true)
Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
NULL
DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given

View file

@ -6,7 +6,11 @@ Bug #36988 (mktime freezes on long numbers)
<?php
date_default_timezone_set('GMT');
$start = microtime(true);
$a = mktime(1, 1, 1, 1, 1, 11111111111);
try {
$a = mktime(1, 1, 1, 1, 1, 11111111111);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: mktime() expects parameter 6 to be int, float given in %s on line %d
--EXPECT--
mktime() expects parameter 6 to be int, float given

View file

@ -13,7 +13,11 @@ var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
var_dump($d->format('U'));
$d->setTimestamp(100000000000);
try {
$d->setTimestamp(100000000000);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
@ -24,8 +28,7 @@ var_dump($i->format('%s'));
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(12) "100000000000"
Warning: DateTime::setTimestamp() expects parameter 1 to be int, float given in %s on line %d
DateTime::setTimestamp() expects parameter 1 to be int, float given
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(10) "1215752192"

View file

@ -3,8 +3,11 @@ Bug #70245 (strtotime does not emit warning when 2nd parameter is object or stri
--FILE--
<?php
$d = new DateTime('2011-01-15 00:00:00');
var_dump(strtotime('-1 month', $d));
try {
var_dump(strtotime('-1 month', $d));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: strtotime() expects parameter 2 to be int, object given in %sbug70245.php on line %d
bool(false)
strtotime() expects parameter 2 to be int, object given

View file

@ -9,13 +9,6 @@ Test date_default_timezone_set() function : error variations
echo "*** Testing date_default_timezone_set() : error variations ***\n";
echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n";
var_dump( date_default_timezone_set() );
echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( date_default_timezone_set("GMT", $extra_arg) );
echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n";
var_dump( date_default_timezone_set("foo") );
@ -24,16 +17,6 @@ var_dump( date_default_timezone_set("foo") );
--EXPECTF--
*** Testing date_default_timezone_set() : error variations ***
-- Testing date_default_timezone_set() function with less than expected no. of arguments --
Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing date_default_timezone_set() function with more than expected no. of arguments --
Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-- Testing date_default_timezone_set() function with invalid timezone identifier --
Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d

View file

@ -12,7 +12,6 @@ Test basic date_parse()
var_dump(date_parse("03-03"));
var_dump(date_parse("0-0"));
var_dump(date_parse(""));
var_dump(date_parse(array()));
echo "Done\n";
?>
--EXPECTF--
@ -298,7 +297,4 @@ array(12) {
["is_localtime"]=>
bool(false)
}
Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d
bool(false)
Done

View file

@ -12,14 +12,6 @@ date_default_timezone_set("Europe/London");
echo "*** Testing date_parse() : error conditions ***\n";
echo "\n-- Testing date_parse() function with zero arguments --\n";
var_dump( date_parse() );
echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n";
$date = "2009-02-27 10:00:00.5";
$extra_arg = 10;
var_dump( date_parse($date, $extra_arg) );
echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
$invalid_date = "2OO9-02--27 10:00?00.5";
var_dump( date_parse($invalid_date) );
@ -29,16 +21,6 @@ var_dump( date_parse($invalid_date) );
--EXPECTF--
*** Testing date_parse() : error conditions ***
-- Testing date_parse() function with zero arguments --
Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing date_parse() function with more than expected no. of arguments --
Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-- Testing date_parse() function with unexpected characters in $date argument --
array(13) {
["year"]=>

View file

@ -1,61 +0,0 @@
--TEST--
Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunrise for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunrise() : usage variation ***\n";
// GMT is zero for the timezone
date_default_timezone_set("Asia/Calcutta");
//Initialise the variables
$latitude = 38.4;
$longitude = -9;
$zenith = 90;
$gmt_offset = 1;
echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n";
$time = 12.3456789000e10;
var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n";
$time = -12.3456789000e10;
var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
?>
===DONE===
--EXPECTF--
*** Testing date_sunrise() : usage variation ***
-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -1,61 +0,0 @@
--TEST--
Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
* Description: Returns time of sunset for a given day and location
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing date_sunset() : usage variation ***\n";
// GMT is zero for the timezone
date_default_timezone_set("Asia/Calcutta");
//Initialise the variables
$latitude = 38.4;
$longitude = -9;
$zenith = 90;
$gmt_offset = 1;
echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
$time = 12.3456789000e10;
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
$time = -12.3456789000e10;
var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
?>
===DONE===
--EXPECTF--
*** Testing date_sunset() : usage variation ***
-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -1,37 +0,0 @@
--TEST--
Test getdate() function : usage variation - Passing high positive and negative float values to timestamp.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : array getdate([int timestamp])
* Description: Get date/time information
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing getdate() : usage variation ***\n";
date_default_timezone_set("Asia/Calcutta");
echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n";
$timestamp = 12.3456789000e10;
var_dump( getdate($timestamp) );
echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n";
$timestamp = -12.3456789000e10;
var_dump( getdate($timestamp) );
?>
===DONE===
--EXPECTF--
*** Testing getdate() : usage variation ***
-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --
Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
bool(false)
-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --
Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -1,40 +0,0 @@
--TEST--
Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : string gmdate(string format [, long timestamp])
* Description: Format a GMT date/time
* Source code: ext/date/php_date.c
*/
echo "*** Testing gmdate() : usage variation ***\n";
// Initialise all required variables
date_default_timezone_set('UTC');
$format = DATE_ISO8601;
echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
$timestamp = 12.3456789000e10;
var_dump( gmdate($format, $timestamp) );
echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
$timestamp = -12.3456789000e10;
var_dump( gmdate($format, $timestamp) );
?>
===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
-- Testing gmdate() function with float 12.3456789000e10 to timestamp --
Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
bool(false)
-- Testing gmdate() function with float -12.3456789000e10 to timestamp --
Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -21,15 +21,9 @@ $year = 2008;
// Calling gmmktime() with all possible arguments
var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
// Calling gmmktime() with mandatory arguments
var_dump( gmmktime() );
?>
===DONE===
--EXPECTF--
*** Testing gmmktime() : basic functionality ***
int(1218182888)
Warning: gmmktime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
===DONE===

View file

@ -1,41 +0,0 @@
--TEST--
Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : int idate(string format [, int timestamp])
* Description: Format a local time/date as integer
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing idate() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
$format = 'Y';
date_default_timezone_set("Asia/Calcutta");
echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n";
$timestamp = 12.3456789000e10;
var_dump( idate($format, $timestamp) );
echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n";
$timestamp = -12.3456789000e10;
var_dump( idate($format, $timestamp) );
?>
===DONE===
--EXPECTF--
*** Testing idate() : usage variation ***
-- Testing idate() function with float 12.3456789000e10 to timestamp --
Warning: idate() expects parameter 2 to be int, float given in %s on line %d
bool(false)
-- Testing idate() function with float -12.3456789000e10 to timestamp --
Warning: idate() expects parameter 2 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -1,50 +0,0 @@
--TEST--
Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : array localtime([int timestamp [, bool associative_array]])
* Description: Returns the results of the C system call localtime as an associative array
* if the associative_array argument is set to 1 other wise it is a regular array
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing localtime() : usage variation ***\n";
date_default_timezone_set("UTC");
// Initialise function arguments not being substituted (if any)
$is_associative = true;
echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
$timestamp = 12.3456789000e10;
var_dump( localtime($timestamp) );
var_dump( localtime($timestamp, $is_associative) );
echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
$timestamp = -12.3456789000e10;
var_dump( localtime($timestamp) );
var_dump( localtime($timestamp, $is_associative) );
?>
===DONE===
--EXPECTF--
*** Testing localtime() : usage variation ***
-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --
Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
bool(false)
-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --
Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
bool(false)
Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -7,13 +7,6 @@ Test wrong number of arguments for microtime()
* Function is implemented in ext/standard/microtime.c
*/
$opt_arg_0 = true;
$extra_arg = 1;
echo "\n-- Too many arguments --\n";
var_dump(microtime($opt_arg_0, $extra_arg));
echo "\n-- Bad Arg types --\n";
$bad_args = array(null,
@ -25,17 +18,16 @@ $bad_args = array(null,
foreach ($bad_args as $bad_arg) {
echo "\n--> bad arg: ";
var_dump($bad_arg);
var_dump(microtime($bad_arg));
try {
var_dump(microtime($bad_arg));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
}
?>
===DONE===
--EXPECTF--
-- Too many arguments --
Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11
NULL
-- Bad Arg types --
--> bad arg: NULL
@ -56,15 +48,11 @@ float(%s)
int(0)
}
}
Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25
NULL
microtime() expects parameter 1 to be bool, array given
--> bad arg: object(stdClass)#%d (0) {
}
Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25
NULL
microtime() expects parameter 1 to be bool, object given
--> bad arg: int(1)
float(%s)

View file

@ -14,7 +14,11 @@ date_default_timezone_set("Europe/London");
echo "*** Testing mktime() : error conditions ***\n";
echo "\n-- Testing mktime() function with Zero arguments --\n";
var_dump( mktime() );
try {
var_dump( mktime() );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
$hour = 10;
@ -24,7 +28,11 @@ $month = 7;
$day = 2;
$year = 1963;
$extra_arg = 10;
var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
try {
var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
@ -32,12 +40,8 @@ var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
*** Testing mktime() : error conditions ***
-- Testing mktime() function with Zero arguments --
Warning: mktime() expects at least 1 parameter, 0 given in %s on line %d
bool(false)
mktime() expects at least 1 parameter, 0 given
-- Testing mktime() function with more than expected no. of arguments --
Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d
bool(false)
mktime() expects at most 6 parameters, 7 given
===DONE===

View file

@ -1,42 +0,0 @@
--TEST--
Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
--FILE--
<?php
/* Prototype : string strftime(string format [, int timestamp])
* Description: Format a local time/date according to locale settings
* Source code: ext/date/php_date.c
* Alias to functions:
*/
echo "*** Testing strftime() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
setlocale(LC_ALL, "en_US");
date_default_timezone_set("UTC");
$format = '%b %d %Y %H:%M:%S';
echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
$timestamp = 12.3456789000e10;
var_dump( strftime($format, $timestamp) );
echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
$timestamp = -12.3456789000e10;
var_dump( strftime($format, $timestamp) );
?>
===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with float 12.3456789000e10 to timestamp --
Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
bool(false)
-- Testing strftime() function with float -12.3456789000e10 to timestamp --
Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
bool(false)
===DONE===

View file

@ -15,31 +15,6 @@ $date = date_create("GMT");
echo "*** Testing timezone_offset_get() : error conditions ***\n";
echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
try {
var_dump( timezone_offset_get() );
} catch (Error $ex) {
var_dump($ex->getMessage());
echo "\n";
}
echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n";
try {
var_dump( timezone_offset_get($tz) );
} catch (Error $ex) {
var_dump($ex->getMessage());
echo "\n";
}
echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n";
$extra_arg = 99;
try {
var_dump( timezone_offset_get($tz, $date, $extra_arg) );
} catch (Error $ex) {
var_dump($ex->getMessage());
echo "\n";
}
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
try {
@ -90,21 +65,6 @@ try {
--EXPECTF--
*** Testing timezone_offset_get() : error conditions ***
-- Testing timezone_offset_get() function with zero arguments --
Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with less than expected no. of arguments --
Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with more than expected no. of arguments --
Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)
-- Testing timezone_offset_get() function with an invalid values for $object argument --
string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given"

View file

@ -9,7 +9,6 @@ die("info $HND handler used");
<?php
require_once(dirname(__FILE__) .'/test.inc');
echo "database handler: $handler\n";
var_dump(dba_open($db_file));
var_dump(dba_open($db_file, 'n'));
var_dump(dba_open($db_file, 'n', 'bogus'));
var_dump(dba_open($db_file, 'q', $handler));
@ -22,9 +21,6 @@ require(dirname(__FILE__) .'/clean.inc');
?>
--EXPECTF--
database handler: flatfile
Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d
NULL
resource(%d) of type (dba)
Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d

View file

@ -35,13 +35,9 @@ check(dba_handlers(null));
echo "Test 3\n";
check(dba_handlers(1, 2));
echo "Test 4\n";
check(dba_handlers(0));
echo "Test 5 - full info\n";
echo "Test 4 - full info\n";
$h = dba_handlers(1);
foreach ($h as $key => $val) {
if ($key === "flatfile") {
@ -61,9 +57,6 @@ Success: flatfile enabled
Test 2
Success: flatfile enabled
Test 3
Warning: dba_handlers() expects at most 1 parameter, 2 given in %sdba_handlers.php on line %d
Test 4
Success: flatfile enabled
Test 5 - full info
Test 4 - full info
Success: flatfile enabled

View file

@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
var_dump(dba_optimize());
var_dump(dba_optimize(""));
var_dump(dba_optimize($db_file));
dba_close($db_file);
} else {
@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
Warning: dba_optimize() expects exactly 1 parameter, 0 given in %sdba_optimize.php on line %d
NULL
Warning: dba_optimize() expects parameter 1 to be resource, string given in %sdba_optimize.php on line %d
NULL
bool(true)
===DONE===

View file

@ -7,7 +7,6 @@ DBA Split Test
?>
--FILE--
<?php
var_dump(dba_key_split("key1", "name"));
var_dump(dba_key_split(1));
var_dump(dba_key_split(null));
var_dump(dba_key_split(""));
@ -23,8 +22,6 @@ var_dump(dba_key_split("[key1]name1"));
===DONE===
<?php exit(0); ?>
--EXPECTF--
Warning: Wrong parameter count for dba_key_split() in %sdba_split.php on line %d
NULL
array(2) {
[0]=>
string(0) ""

View file

@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
var_dump(dba_sync());
var_dump(dba_sync(""));
var_dump(dba_sync($db_file));
dba_close($db_file);
} else {
@ -41,11 +39,5 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
Warning: dba_sync() expects exactly 1 parameter, 0 given in %sdba_sync.php on line %d
NULL
Warning: dba_sync() expects parameter 1 to be resource, string given in %sdba_sync.php on line %d
NULL
bool(true)
===DONE===

View file

@ -12,13 +12,6 @@ Test exif_imagetype() function : error conditions
echo "*** Testing exif_imagetype() : error conditions ***\n";
echo "\n-- Testing exif_imagetype() function with no arguments --\n";
var_dump( exif_imagetype() );
echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n";
$extra_arg = 10;
var_dump( exif_imagetype(dirname(__FILE__).'/test2.jpg', $extra_arg) );
echo "\n-- Testing exif_imagetype() function with an unknown file --\n";
var_dump( exif_imagetype(dirname(__FILE__).'/foo.jpg') );
@ -28,16 +21,6 @@ var_dump( exif_imagetype(dirname(__FILE__).'/foo.jpg') );
--EXPECTF--
*** Testing exif_imagetype() : error conditions ***
-- Testing exif_imagetype() function with no arguments --
Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-- Testing exif_imagetype() function with more than expected no. of arguments --
Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-- Testing exif_imagetype() function with an unknown file --
Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d

View file

@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527私はガラスを食べられます.magic");
$info = finfo_file($finfo, __FILE__);
var_dump($info);
var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527私はガラスを食べられます.magic'. in %sbug71527-mb.php on line %d
Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527-mb.php on line %d
bool(false)

View file

@ -9,11 +9,8 @@ USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
$info = finfo_file($finfo, __FILE__);
var_dump($info);
var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527.php on line %d
bool(false)

View file

@ -12,17 +12,8 @@ Test finfo_close() function : error conditions
echo "*** Testing finfo_close() : error conditions ***\n";
$magicFile = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'magic';
$finfo = finfo_open( FILEINFO_MIME, $magicFile );
$fp = fopen( __FILE__, 'r' );
echo "\n-- Testing finfo_close() function with Zero arguments --\n";
var_dump( finfo_close() );
echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n";
var_dump( finfo_close( $finfo, '10') );
echo "\n-- Testing finfo_close() function with wrong resource type --\n";
$fp = fopen( __FILE__, 'r' );
var_dump( finfo_close( $fp ) );
?>
@ -30,16 +21,6 @@ var_dump( finfo_close( $fp ) );
--EXPECTF--
*** Testing finfo_close() : error conditions ***
-- Testing finfo_close() function with Zero arguments --
Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing finfo_close() function with more than expected no. of arguments --
Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-- Testing finfo_close() function with wrong resource type --
Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d

View file

@ -5,7 +5,12 @@ finfo_open(): Testing magic_file names
--FILE--
<?php
var_dump(finfo_open(FILEINFO_MIME, "\0"));
try {
var_dump(finfo_open(FILEINFO_MIME, "\0"));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump(finfo_open(FILEINFO_MIME, NULL));
var_dump(finfo_open(FILEINFO_MIME, ''));
var_dump(finfo_open(FILEINFO_MIME, 123));
@ -14,8 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));
?>
--EXPECTF--
Warning: finfo_open() expects parameter 2 to be a valid path, string given in %s on line %d
bool(false)
finfo_open() expects parameter 2 to be a valid path, string given
resource(%d) of type (file_info)
resource(%d) of type (file_info)

View file

@ -15,10 +15,13 @@ $magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
echo "*** Testing finfo_open() : error functionality ***\n";
var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) );
var_dump( finfo_open( array(), $magicFile ) );
var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) );
var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) );
var_dump( finfo_open( 'foobar' ) );
try {
var_dump( finfo_open( 'foobar' ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump( new finfo('foobar') );
@ -31,23 +34,15 @@ try {
--EXPECTF--
*** Testing finfo_open() : error functionality ***
Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12
Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d
bool(false)
Warning: finfo_open() expects parameter 1 to be int, array given in %sfinfo_open_error.php on line 13
bool(false)
Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14
bool(false)
Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15
Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
resource(6) of type (file_info)
Warning: finfo_open() expects parameter 1 to be int, string given in %sfinfo_open_error.php on line 16
bool(false)
finfo_open() expects parameter 1 to be int, string given
finfo::__construct() expects parameter 1 to be int, string given
===DONE===

View file

@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
var_dump( $finfo->set_flags() );
?>
===DONE===
@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() );
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
bool(true)
Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
===DONE===

View file

@ -17,14 +17,12 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
var_dump( $finfo->set_flags() );
?>
===DONE===
@ -32,11 +30,5 @@ var_dump( $finfo->set_flags() );
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
bool(true)
Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
===DONE===

View file

@ -14,20 +14,12 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "nonex"));
var_dump(filter_has_var(INPUT_GET, " "));
var_dump(filter_has_var(INPUT_GET, ""));
var_dump(filter_has_var(INPUT_GET, array()));
var_dump(filter_has_var(INPUT_POST, "b"));
var_dump(filter_has_var(INPUT_POST, "bbc"));
var_dump(filter_has_var(INPUT_POST, "nonex"));
var_dump(filter_has_var(INPUT_POST, " "));
var_dump(filter_has_var(INPUT_POST, ""));
var_dump(filter_has_var(INPUT_POST, array()));
var_dump(filter_has_var(-1, ""));
var_dump(filter_has_var("", ""));
var_dump(filter_has_var(array(), array()));
var_dump(filter_has_var(array(), ""));
var_dump(filter_has_var("", array()));
echo "Done\n";
?>
@ -37,28 +29,9 @@ bool(true)
bool(false)
bool(false)
bool(false)
Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
bool(false)
bool(false)
Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
bool(false)
Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
bool(false)
Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
bool(false)
Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
bool(false)
Done

View file

@ -6,7 +6,6 @@ filter_list()
<?php
var_dump(filter_list());
var_dump(filter_list(array()));
echo "Done\n";
?>
@ -57,7 +56,4 @@ array(22) {
[21]=>
string(8) "callback"
}
Warning: filter_list() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Done

View file

@ -10,23 +10,15 @@ var_dump(filter_id("string"));
var_dump(filter_id("url"));
var_dump(filter_id("int"));
var_dump(filter_id("none"));
var_dump(filter_id(array()));
var_dump(filter_id(-1));
var_dump(filter_id(0,0,0));
echo "Done\n";
?>
--EXPECTF--
--EXPECT--
int(513)
int(513)
int(518)
int(257)
bool(false)
Warning: filter_id() expects parameter 1 to be string, array given in %s on line %d
NULL
bool(false)
Warning: filter_id() expects exactly 1 parameter, 3 given in %s on line %d
NULL
Done

View file

@ -9,7 +9,6 @@ precision=14
var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(1, array()));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, array()));
@ -53,9 +52,6 @@ array(7) {
array(0) {
}
}
Warning: filter_var() expects parameter 2 to be int, array given in %s on line %d
NULL
string(1) "1"
string(1) "1"
string(1) "1"

View file

@ -20,12 +20,6 @@ var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT));
var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS));
var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_INT));
var_dump(filter_var(new stdClass, "d"));
var_dump(filter_input(INPUT_POST, "c", "", ""));
var_dump(filter_var("", "", "", "", ""));
var_dump(filter_var(0, 0, 0, 0, 0));
echo "Done\n";
?>
--EXPECTF--
@ -39,16 +33,4 @@ string(6) "string"
float(12345.7)
string(29) "&#60;p&#62;string&#60;/p&#62;"
bool(false)
Warning: filter_var() expects parameter 2 to be int, string given in %s011.php on line %d
NULL
Warning: filter_input() expects parameter 3 to be int, string given in %s011.php on line %d
NULL
Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
NULL
Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
NULL
Done

View file

@ -6,7 +6,6 @@ filter_var_array() and different arguments
<?php
echo "-- (1)\n";
var_dump(filter_var_array(NULL));
var_dump(filter_var_array(array()));
var_dump(filter_var_array(array(1,"blah"=>"hoho")));
var_dump(filter_var_array(array(), -1));
@ -51,9 +50,6 @@ echo "Done\n";
?>
--EXPECTF--
-- (1)
Warning: filter_var_array() expects parameter 1 to be array, null given in %s on line %d
NULL
array(0) {
}
array(2) {

View file

@ -9,9 +9,7 @@ ap[]=1&bp=test&cp=
--FILE--
<?php
var_dump(filter_has_var());
var_dump(filter_has_var(INPUT_GET,""));
var_dump(filter_has_var(INPUT_GET,array()));
var_dump(filter_has_var(INPUT_POST, "ap"));
var_dump(filter_has_var(INPUT_POST, "cp"));
var_dump(filter_has_var(INPUT_GET, "a"));
@ -20,16 +18,10 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "cc"));
var_dump(filter_has_var(-1, "cc"));
var_dump(filter_has_var(0, "cc"));
var_dump(filter_has_var("", "cc"));
echo "Done\n";
?>
--EXPECTF--
Warning: filter_has_var() expects exactly 2 parameters, 0 given in %s on line %d
bool(false)
bool(false)
Warning: filter_has_var() expects parameter 2 to be string, array given in %s on line %d
--EXPECT--
bool(false)
bool(true)
bool(true)
@ -39,7 +31,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
Warning: filter_has_var() expects parameter 1 to be int, string given in %s on line %d
bool(false)
Done

View file

@ -8,68 +8,22 @@ require 'skipif.inc';
<?php
require 'server.inc';
// Negative timeout
var_dump(ftp_connect('127.0.0.1', 0, -3));
$ftp = ftp_connect('127.0.0.1', $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
var_dump(ftp_systype($ftp));
/* some bogus usage */
var_dump(ftp_alloc($ftp, array()));
var_dump(ftp_cdup($ftp, 0));
var_dump(ftp_chdir($ftp, array()));
var_dump(ftp_chmod($ftp, 0666));
var_dump(ftp_close());
var_dump(ftp_connect('sfjkfjaksfjkasjf'));
var_dump(ftp_delete($ftp, array()));
var_dump(ftp_exec($ftp, array()));
var_dump(ftp_systype($ftp, 0));
var_dump(ftp_pwd($ftp, array()));
var_dump(ftp_login($ftp));
var_dump(ftp_login($ftp, 'user', 'bogus'));
var_dump(ftp_quit($ftp));
?>
--EXPECTF--
bool(true)
string(4) "UNIX"
Warning: ftp_alloc() expects parameter 2 to be int, array given in %s004.php on line 12
bool(false)
Warning: ftp_cdup() expects exactly 1 parameter, 2 given in %s004.php on line 13
NULL
Warning: ftp_chdir() expects parameter 2 to be string, array given in %s004.php on line 14
NULL
Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d
bool(false)
Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16
NULL
Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17
bool(false)
Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18
NULL
Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19
NULL
Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21
NULL
Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22
NULL
Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24
NULL
Warning: ftp_login(): Not logged in. in %s004.php on line 25
Warning: ftp_connect(): Timeout has to be greater than 0 in %s on line %d
bool(false)
bool(true)
Warning: ftp_login(): Not logged in. in %s on line %d
bool(false)
bool(true)

View file

@ -1,108 +0,0 @@
--TEST--
FTP with bogus parameters
--SKIPIF--
<?php
require 'skipif.inc';
?>
--FILE--
<?php
$ftp=null;
var_dump(ftp_connect(array()));
var_dump(ftp_connect('127.0.0.1', 0, -3));
var_dump(ftp_raw($ftp));
var_dump(ftp_mkdir($ftp));
var_dump(ftp_rmdir($ftp));
var_dump(ftp_nlist($ftp));
var_dump(ftp_rawlist($ftp));
var_dump(ftp_fget($ftp));
var_dump(ftp_nb_fget($ftp));
var_dump(ftp_nb_get($ftp));
var_dump(ftp_pasv($ftp));
var_dump(ftp_nb_continue());
var_dump(ftp_fput());
var_dump(ftp_nb_fput($ftp));
var_dump(ftp_put($ftp));
var_dump(ftp_nb_put($ftp));
var_dump(ftp_size($ftp));
var_dump(ftp_mdtm($ftp));
var_dump(ftp_rename($ftp));
var_dump(ftp_site($ftp));
var_dump(ftp_set_option($ftp));
var_dump(ftp_get_option($ftp));
var_dump(ftp_mlsd($ftp));
var_dump(ftp_append($ftp));
?>
--EXPECTF--
Warning: ftp_connect() expects parameter 1 to be string, array given in %s006.php on line 4
NULL
Warning: ftp_connect(): Timeout has to be greater than 0 in %s006.php on line 5
bool(false)
Warning: ftp_raw() expects exactly 2 parameters, 1 given in %s006.php on line 6
NULL
Warning: ftp_mkdir() expects exactly 2 parameters, 1 given in %s006.php on line 7
NULL
Warning: ftp_rmdir() expects exactly 2 parameters, 1 given in %s006.php on line 8
NULL
Warning: ftp_nlist() expects exactly 2 parameters, 1 given in %s006.php on line 9
NULL
Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10
NULL
Warning: ftp_fget() expects at least 3 parameters, 1 given in %s006.php on line 11
NULL
Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12
NULL
Warning: ftp_nb_get() expects at least 3 parameters, 1 given in %s006.php on line 13
NULL
Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14
NULL
Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15
NULL
Warning: ftp_fput() expects at least 3 parameters, 0 given in %s006.php on line 16
NULL
Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17
NULL
Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18
NULL
Warning: ftp_nb_put() expects at least 3 parameters, 1 given in %s006.php on line 19
NULL
Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20
NULL
Warning: ftp_mdtm() expects exactly 2 parameters, 1 given in %s006.php on line 21
NULL
Warning: ftp_rename() expects exactly 3 parameters, 1 given in %s006.php on line 22
NULL
Warning: ftp_site() expects exactly 2 parameters, 1 given in %s006.php on line 23
NULL
Warning: ftp_set_option() expects exactly 3 parameters, 1 given in %s006.php on line 24
NULL
Warning: ftp_get_option() expects exactly 2 parameters, 1 given in %s006.php on line 25
NULL
Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26
NULL
Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27
NULL

View file

@ -29,9 +29,6 @@ unlink($tmpfname);
//test non-existent file request
ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII);
//test invalid ftp_get params
var_dump(ftp_get('foo', 'bar', 'baz'));
?>
--EXPECTF--
bool(true)
@ -41,6 +38,3 @@ bool(true)
string(21) "BINARYFoo%00Bar%0D%0A"
Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d
Warning: ftp_get() expects parameter 1 to be resource, string given in %s on line %d
NULL

View file

@ -12,14 +12,6 @@ echo "*** Testing ftp_ssl_connect() function : error conditions ***\n";
echo "\n-- Testing ftp_ssl_connect() function on failure --\n";
var_dump(ftp_ssl_connect('totes.invalid'));
echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n";
ftp_ssl_connect([]);
ftp_ssl_connect('totes.invalid', []);
ftp_ssl_connect('totes.invalid', 21, []);
echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n";
ftp_ssl_connect('totes.invalid', 21, 1, []);
echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n";
ftp_ssl_connect('totes.invalid', 21, 0);
@ -32,18 +24,6 @@ echo "===DONE===\n";
Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d
bool(false)
-- Testing ftp_ssl_connect() function invalid argument type --
Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d
Warning: ftp_ssl_connect() expects parameter 2 to be int, array given in %s on line %d
Warning: ftp_ssl_connect() expects parameter 3 to be int, array given in %s on line %d
-- Testing ftp_ssl_connect() function with more than expected no. of arguments --
Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d
-- Testing ftp_ssl_connect() function timeout warning for value 0 --
Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d

View file

@ -9,17 +9,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
--FILE--
<?php
$resource = tmpfile();
imagecolorallocatealpha($resource, 255, 255, 255, 50);
imagecolorallocatealpha('string', 255, 255, 255, 50);
imagecolorallocatealpha(array(), 255, 255, 255, 50);
imagecolorallocatealpha(null, 255, 255, 255, 50);
?>
--EXPECTF--
Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d
Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d
Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d
Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d

View file

@ -1,5 +1,5 @@
--TEST--
Test imagecolorstotal() function : error conditions - Pass incorrect number of arguments
Test imagecolorstotal() function : error conditions - Pass invalid resource type
--SKIPIF--
<?php
if(!extension_loaded('gd')) {
@ -21,13 +21,6 @@ echo "*** Testing imagecolorstotal() : error conditions ***\n";
// Get a resource
$im = fopen(__FILE__, 'r');
echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n";
var_dump( imagecolorstotal() );
echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n";
$extra_arg = false;
var_dump( imagecolorstotal($im, $extra_arg) );
echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
var_dump( imagecolorstotal($im) );
@ -37,16 +30,6 @@ fclose($im);
--EXPECTF--
*** Testing imagecolorstotal() : error conditions ***
-- Testing imagecolorstotal() function with Zero arguments --
Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d
NULL
-- Testing imagecolorstotal() function with more than expected no. of arguments --
Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d
NULL
-- Testing imagecolorstotal() function with a invalid resource
Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d

View file

@ -11,14 +11,8 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
<?php
$image = imagecreatetruecolor(-1, 30);
$image = imagecreatetruecolor(30, -1);
$image = imagecreatetruecolor(999999999999999999999999999, 30);
$image = imagecreatetruecolor(30, 999999999999999999999999999);
?>
--EXPECTF--
Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
Warning: imagecreatetruecolor() expects parameter 1 to be int, float given in %s on line %d
Warning: imagecreatetruecolor() expects parameter 2 to be int, float given in %s on line %d

View file

@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present");
<?php
$image = imagecreatetruecolor(180, 30);
var_dump(imagefilter($image));
try {
var_dump(imagefilter($image));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Wrong parameter count for imagefilter() in %s on line %d
NULL
--EXPECT--
Wrong parameter count for imagefilter()

View file

@ -22,13 +22,16 @@ $userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagegd2 TEST\n";
imagegd2($image, $temp);
try {
imagegd2($image, $temp);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
--EXPECT--
imagegd2 TEST
Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
imagegd2() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)

View file

@ -22,13 +22,16 @@ $userinput = "1\0"; // from post or get data
$temp = $tempdir. "/test" . $userinput .".tmp";
echo "\nimagegd TEST\n";
imagegd($image, $temp);
try {
imagegd($image, $temp);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump(file_exists($tempdir. "/test1"));
var_dump(file_exists($tempdir. "/test1.tmp"));
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
--EXPECTF--
--EXPECT--
imagegd TEST
Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
imagegd() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)

View file

@ -9,16 +9,8 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
$image = imagecreatetruecolor(180, 30);
$resource = tmpfile();
imageistruecolor('string');
imageistruecolor($resource);
imageistruecolor(array());
?>
--EXPECTF--
Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d
Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d

View file

@ -9,14 +9,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
--FILE--
<?php
$resource = tmpfile();
imagesetthickness('string', 5);
imagesetthickness(array(), 5);
imagesetthickness($resource, 5);
?>
--EXPECTF--
Warning: imagesetthickness() expects parameter 1 to be resource, %s given in %s on line %d
Warning: imagesetthickness() expects parameter 1 to be resource, array given in %s on line %d
Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d

View file

@ -10,17 +10,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
--FILE--
<?php
$resource = tmpfile();
imagetruecolortopalette($resource, true, 2);
imagetruecolortopalette('string', true, 2);
imagetruecolortopalette(array(), true, 2);
imagetruecolortopalette(null, true, 2);
?>
--EXPECTF--
Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d

View file

@ -10,19 +10,7 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
--FILE--
<?php
$image = imagecreatetruecolor(50, 50);
$resource = tmpfile();
imagetruecolortopalette($image, true, 'string');
imagetruecolortopalette($image, true, $resource);
imagetruecolortopalette($image, true, array());
imagetruecolortopalette($image, true, null);
?>
--EXPECTF--
Warning: imagetruecolortopalette() expects parameter 3 to be int, string given in %s on line %d
Warning: imagetruecolortopalette() expects parameter 3 to be int, resource given in %s on line %d
Warning: imagetruecolortopalette() expects parameter 3 to be int, array given in %s on line %d
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d

View file

@ -9,10 +9,6 @@ imageline no AA
$im = imagecreatetruecolor(6,6);
imagefill($im, 0,0, 0xffffff);
// Wrong argument count
imageline($im, 0,0, 5,5);
// Horizontal line
imageline($im, 0,5, 5,5, 0x00ff00);
@ -105,7 +101,6 @@ if ($p3) {
?>
--EXPECTF--
Warning: imageline() expects exactly 6 parameters, 5 given in %s on line %d
Horizontal: ok
Vertical: ok
Diagonal: ok

View file

@ -8,7 +8,6 @@ if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist");
--FILE--
<?php
var_dump(dcngettext(1,1,1,1));
var_dump(dcngettext(1,1,1,1,1));
var_dump(dcngettext("test","test","test",1,1));
var_dump(dcngettext("test","test","test",0,0));
@ -18,9 +17,7 @@ var_dump(dcngettext("","","",0,0));
echo "Done\n";
?>
--EXPECTF--
Warning: dcngettext() expects exactly 5 parameters, 4 given in %s on line %d
bool(false)
--EXPECT--
string(1) "1"
string(4) "test"
string(4) "test"

View file

@ -15,8 +15,6 @@ var_dump(gmp_strval(gmp_abs("0000")));
var_dump(gmp_strval(gmp_abs("09876543")));
var_dump(gmp_strval(gmp_abs("-099987654")));
var_dump(gmp_abs());
var_dump(gmp_abs(1,2));
var_dump(gmp_abs(array()));
echo "Done\n";
@ -39,12 +37,6 @@ string(1) "0"
Warning: gmp_abs(): Unable to convert variable to GMP - string is not an integer in %s on line %d
string(1) "0"
Warning: gmp_abs() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: gmp_abs() expects exactly 1 parameter, 2 given in %s on line %d
NULL
Warning: gmp_abs(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done

Some files were not shown because too many files have changed in this diff Show more