File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
general_functions /
gettype_settype_error.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 4 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test gettype() & settype() functions : error conditions
--FILE--
<?php
/* Prototype: string gettype ( mixed $var );
Description: Returns the type of the PHP variable var
Prototype: bool settype ( mixed &$var, string $type );
Description: Set the type of variable var to type
*/
/* Test different error conditions of settype() and gettype() functions */
echo "**** Testing gettype() and settype() functions ****\n";
echo "\n*** Testing gettype(): error conditions ***\n";
//Zero arguments
var_dump( gettype() );
// args more than expected
var_dump( gettype( "1", "2" ) );
echo "\n*** Testing settype(): error conditions ***\n";
//Zero arguments
var_dump( settype() );
// args more than expected
$var = 10.5;
var_dump( settype( $var, $var, "int" ) );
// passing an invalid type to set
var_dump( settype( $var, "unknown" ) );
echo "Done\n";
?>
--EXPECTF--
**** Testing gettype() and settype() functions ****
*** Testing gettype(): error conditions ***
Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d
NULL
Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d
NULL
*** Testing settype(): error conditions ***
Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: settype(): Invalid type in %s on line %d
bool(false)
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>