mirror of
https://github.com/php/php-src.git
synced 2025-01-07 11:34:09 +08:00
ce1d69a1f6
PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
--TEST--
|
|
Test function posix_setuid() by substituting argument 1 with float values.
|
|
--SKIPIF--
|
|
<?php
|
|
PHP_INT_SIZE == 4 or die("skip - 32-bit only");
|
|
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
|
|
if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
|
|
?>
|
|
--CREDITS--
|
|
Marco Fabbri mrfabbri@gmail.com
|
|
Francesco Fullone ff@ideato.it
|
|
#PHPTestFest Cesena Italia on 2009-06-20
|
|
--FILE--
|
|
<?php
|
|
|
|
|
|
echo "*** Test substituting argument 1 with float values ***\n";
|
|
|
|
$myUid = posix_getuid();
|
|
|
|
$myUid = $myUid - 1.1;
|
|
|
|
$variation_array = array(
|
|
'float '.$myUid => $myUid,
|
|
'float -'.$myUid => -$myUid,
|
|
'float 12.3456789000e10' => 12.3456789000e10,
|
|
'float -12.3456789000e10' => -12.3456789000e10,
|
|
'float .5' => .5,
|
|
);
|
|
|
|
|
|
foreach ( $variation_array as $var ) {
|
|
var_dump(posix_setuid( $var ) );
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
*** Test substituting argument 1 with float values ***
|
|
bool(false)
|
|
bool(false)
|
|
|
|
Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
|
|
bool(false)
|
|
bool(false)
|