import zend posix tests

Esse commit está contido em:
Paul Tarjan
2013-04-23 16:09:17 -07:00
commit de Sara Golemon
commit 5646a4ee78
207 arquivos alterados com 2911 adições e 1 exclusões
@@ -0,0 +1,23 @@
<?php
$filename = dirname(__FILE__) . '/foo.test';
$fp = fopen($filename,"w");
fwrite($fp,"foo");
fclose($fp);
chmod ($filename, 0000);
var_dump(posix_access($filename, POSIX_F_OK));
chmod ($filename, 0400);
var_dump(posix_access($filename, POSIX_R_OK));
chmod ($filename, 0600);
var_dump(posix_access($filename, POSIX_W_OK));
chmod ($filename, 0700);
var_dump(posix_access($filename, POSIX_X_OK));
?>
===DONE===<?php
$filename = dirname(__FILE__) . '/foo.test';
chmod ($filename, 0700);
unlink($filename);
?>
@@ -0,0 +1,6 @@
Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in hphp/test/zend/bad/ext-posix/posix_access.php on line %d
bool(true)
bool(true)
bool(true)
bool(true)
===DONE===
@@ -0,0 +1,17 @@
<?php
$filename = dirname(__FILE__) . '/foo.test';
var_dump(posix_access($filename, POSIX_F_OK));
$fp = fopen($filename,"w");
fwrite($fp,"foo");
fclose($fp);
chmod ($filename, 0000);
var_dump(posix_access($filename, POSIX_R_OK));
var_dump(posix_access($filename, POSIX_W_OK));
var_dump(posix_access($filename, POSIX_X_OK));
?>
===DONE===<?php
$filename = dirname(__FILE__) . '/foo.test';
chmod ($filename, 0700);
unlink($filename);
?>
@@ -0,0 +1,6 @@
WDeprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line %d
bool(false)
bool(false)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,10 @@
<?php
var_dump( posix_access() );
var_dump( posix_access(array()) );
var_dump( posix_access('foo',array()) );
var_dump( posix_access(null) );
var_dump(posix_access('./foobar'));
?>
===DONE===
@@ -0,0 +1,10 @@
Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,4 @@
<?php
var_dump(posix_access('/tmp', POSIX_W_OK));
?>
===DONE===
@@ -0,0 +1,3 @@
Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in hphp/test/zend/bad/ext-posix/posix_access_safemode.php on line %d
bool(false)
===DONE===
@@ -0,0 +1,8 @@
<?php
echo "*** Test by calling method or function with its expected arguments ***\n";
// test without any error
var_dump(posix_errno());
?>
@@ -0,0 +1,2 @@
*** Test by calling method or function with its expected arguments ***
int(0)
@@ -0,0 +1,8 @@
<?php
echo "*** Test by calling method or function with more than expected arguments ***\n";
// test without any error
var_dump(posix_errno('bar'));
?>
@@ -0,0 +1,3 @@
*** Test by calling method or function with more than expected arguments ***
HipHop Warning: %a
NULL
@@ -0,0 +1,8 @@
<?php
echo "*** Test by calling function with permission error ***\n";
posix_setuid(0);
var_dump(posix_errno());
?>
@@ -0,0 +1,2 @@
*** Test by calling function with permission error ***
int(1)
@@ -0,0 +1,15 @@
<?php
echo "*** Test by calling function with pid error ***\n";
$pid = 10000;
do {
$pid += 1;
$result = shell_exec("ps -p " . $pid);
} while (strstr($pid, $result));
posix_kill($pid, SIGKILL);
var_dump(posix_errno());
?>
@@ -0,0 +1,2 @@
*** Test by calling function with pid error ***
int(3)
@@ -0,0 +1,30 @@
<?php
$grp = posix_getgrgid(0);
if (!isset($grp['name'])) {
die('Array index "name" does not exist.');
}
if (!isset($grp['passwd'])) {
die('Array index "passwd" does not exist.');
}
if (!isset($grp['members'])) {
die('Array index "members" does not exist.');
} elseif (!is_array($grp['members'])) {
die('Array index "members" must be an array.');
} else {
if (count($grp['members']) > 0) {
foreach ($grp['members'] as $idx => $username) {
if (!is_int($idx)) {
die('Index in members Array is not an int.');
}
if (!is_string($username)) {
die('Username in members Array is not of type string.');
}
}
}
}
if (!isset($grp['gid'])) {
die('Array index "gid" does not exist.');
}
var_dump($grp['gid']);
?>
===DONE===
@@ -0,0 +1,2 @@
int(0)
===DONE===
@@ -0,0 +1,10 @@
<?php
echo "Basic test of POSIX getgid and getgrid fucntions\n";
$gid = posix_getgid();
$groupinfo = posix_getgrgid($gid);
print_r($groupinfo);
?>
===DONE===
@@ -0,0 +1,11 @@
Basic test of POSIX getgid and getgrid fucntions
Array
(
[name] => %s
[passwd] => %a
[members] => Array
%a
[gid] => %d
)
===DONE===
@@ -0,0 +1,26 @@
<?php
/* Prototype : proto array posix_getgrgid(long gid)
* Description: Group database access (POSIX.1, 9.2.1)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getgrgid() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
var_dump( posix_getgrgid() );
//Test posix_getgrgid with one more than the expected number of arguments
echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
$extra_arg = 10;
$gid = 0;
var_dump( posix_getgrgid($gid, $extra_arg) );
echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
$gid = -999;
var_dump( posix_getgrgid($gid));
echo "Done";
?>
@@ -0,0 +1,13 @@
*** Testing posix_getgrgid() : error conditions ***
-- Testing posix_getgrgid() function with Zero arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_getgrgid() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_getgrgid() function with a negative group id --
bool(false)
Done
@@ -0,0 +1,5 @@
<?php
$grp = posix_getgrgid(-1);
var_dump($grp['name']);
?>
===DONE===
@@ -0,0 +1,2 @@
string(7) "nogroup"
===DONE===
@@ -0,0 +1,76 @@
<?php
/* Prototype : proto array posix_getgrgid(long gid)
* Description: Group database access (POSIX.1, 9.2.1)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getgrgid() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
//get an unset variable
$unset_var = 10;
unset ($unset_var);
//array of values to iterate over
$values = array(
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// undefined data
$undefined_var,
// unset data
$unset_var,
// object data
new stdclass(),
);
// loop through each element of the array for gid
foreach($values as $value) {
echo "\nArg value $value \n";
$result = posix_getgrgid($value);
if ((is_array($result) && (count($result) == 4))
||
($result === false)) {
echo "valid output\n";
} else {
var_dump($result);
}
};
echo "Done";
?>
@@ -0,0 +1,85 @@
*** Testing posix_getgrgid() : usage variations ***
HipHop Notice: %a
HipHop Notice: %a
Arg value 10.5
valid output
Arg value -10.5
valid output
Arg value 101234567000
valid output
Arg value 1.07654321E-9
valid output
Arg value 0.5
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value
HipHop Warning: %a
valid output
Arg value
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Catchable fatal error: Object of class stdClass could not be converted to string in hphp/test/zend/bad/ext-posix/posix_getgrgid_variation.php on line %d
@@ -0,0 +1,7 @@
<?php
$gid = PHP_INT_MAX; // obscene high gid
var_dump(posix_getgrgid($gid));
var_dump(posix_getgrgid(-1));
var_dump(posix_getgrgid());
?>
===DONE===
@@ -0,0 +1,5 @@
bool(false)
bool(false)
HipHop Warning: %a
bool(false)
===DONE===
@@ -0,0 +1,7 @@
<?php
var_dump(posix_getgrnam(NULL));
var_dump(posix_getgrnam(1));
var_dump(posix_getgrnam(''));
?>
@@ -0,0 +1,3 @@
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,9 @@
<?php
echo "Basic test of POSIX posix_getgrnam function\n";
var_dump(posix_getgrnam(NULL));
var_dump(posix_getgrnam(1));
var_dump(posix_getgrnam(''));
?>
===DONE===
@@ -0,0 +1,5 @@
Basic test of POSIX posix_getgrnam function
bool(false)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,10 @@
<?php
echo "Basic test of posix_getpgid function\n";
$pid = posix_getpid();
$pgid = posix_getpgid($pid);
var_dump($pgid);
?>
===DONE====
@@ -0,0 +1,3 @@
Basic test of posix_getpgid function
int(%d)
===DONE====
@@ -0,0 +1,23 @@
<?php
/* Prototype : proto int posix_getpgid(void)
* Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getpgid() : error conditions ***\n";
echo "\n-- Testing posix_getpgid() function no arguments --\n";
var_dump( posix_getpgid() );
echo "\n-- Testing posix_getpgid() with one extra argument --\n";
$pid = 10;
$extra_arg = 20;
var_dump( posix_getpgid($pid, $extra_arg) );
echo "\n-- Testing posix_getpgid() with negative pid --\n";
$pid = -99;
var_dump( posix_getpgid($pid) );
echo "Done";
?>
@@ -0,0 +1,13 @@
*** Testing posix_getpgid() : error conditions ***
-- Testing posix_getpgid() function no arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_getpgid() with one extra argument --
HipHop Warning: %a
bool(false)
-- Testing posix_getpgid() with negative pid --
bool(false)
Done
@@ -0,0 +1,74 @@
<?php
/* Prototype : proto int posix_getpgid(void)
* Description: Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getpgid() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
//get an unset variable
$unset_var = 10;
unset ($unset_var);
//array of values to iterate over
$values = array(
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// undefined data
$undefined_var,
// unset data
$unset_var,
// object data
new stdclass(),
);
// loop through each element of the array for gid
foreach($values as $value) {
echo "\nArg value $value \n";
$result = posix_getpgid($value);
if (is_int($result) || $result === false) {
echo "valid output\n";
} else {
var_dump($result);
}
};
echo "Done";
?>
@@ -0,0 +1,85 @@
*** Testing posix_getpgid() : usage variations ***
HipHop Notice: %a
HipHop Notice: %a
Arg value 10.5
valid output
Arg value -10.5
valid output
Arg value 101234567000
valid output
Arg value 1.07654321E-9
valid output
Arg value 0.5
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value
HipHop Warning: %a
valid output
Arg value
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Catchable fatal error: Object of class stdClass could not be converted to string in hphp/test/zend/bad/ext-posix/posix_getpgid_variation.php on line %d
@@ -0,0 +1,9 @@
<?php
echo "Basic test of POSIX getpgrp function\n";
$pgrp = posix_getpgrp();
var_dump($pgrp);
?>
===DONE====
@@ -0,0 +1,3 @@
Basic test of POSIX getpgrp function
int(%d)
===DONE====
@@ -0,0 +1,9 @@
<?php
echo "Basic test of POSIX getpid function\n";
$pid = posix_getpid();
var_dump($pid);
?>
===DONE====
@@ -0,0 +1,3 @@
Basic test of POSIX getpid function
int(%d)
===DONE====
@@ -0,0 +1,9 @@
<?php
echo "Basic test of POSIX getppid function\n";
$ppid = posix_getppid();
var_dump($ppid);
?>
===DONE====
@@ -0,0 +1,3 @@
Basic test of POSIX getppid function
int(%d)
===DONE====
@@ -0,0 +1,7 @@
<?php
var_dump(posix_getpwnam(1));
var_dump(posix_getpwnam(''));
var_dump(posix_getpwnam(NULL));
?>
@@ -0,0 +1,3 @@
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,9 @@
<?php
echo "Basic test of POSIX posix_getpwnam function\n";
var_dump(posix_getpwnam(1));
var_dump(posix_getpwnam(''));
var_dump(posix_getpwnam(NULL));
?>
===DONE====
@@ -0,0 +1,5 @@
Basic test of POSIX posix_getpwnam function
bool(false)
bool(false)
bool(false)
===DONE====
@@ -0,0 +1,23 @@
<?php
/* Prototype : proto array posix_getpwuid(long uid)
* Description: User database access (POSIX.1, 9.2.2)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getpwuid() : error conditions ***\n";
echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n";
var_dump( posix_getpwuid() );
echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n";
$uid = posix_getuid();
$extra_arg = 10;
var_dump( posix_getpwuid($uid, $extra_arg) );
echo "\n-- Testing posix_getpwuid() function negative uid --\n";
$uid = -99;
var_dump( posix_getpwuid($uid) );
echo "Done";
?>
@@ -0,0 +1,13 @@
*** Testing posix_getpwuid() : error conditions ***
-- Testing posix_getpwuid() function with Zero arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_getpwuid() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_getpwuid() function negative uid --
bool(false)
Done
@@ -0,0 +1,76 @@
<?php
/* Prototype : proto array posix_getpwuid(long uid)
* Description: User database access (POSIX.1, 9.2.2)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_getpwuid() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
//get an unset variable
$unset_var = 10;
unset ($unset_var);
//array of values to iterate over
$values = array(
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// undefined data
$undefined_var,
// unset data
$unset_var,
// object data
new stdclass(),
);
// loop through each element of the array for uid
foreach($values as $value) {
echo "\nArg value $value \n";
$result = posix_getpwuid($value);
if ((is_array($result) && (count($result) == 7))
||
($result === false)) {
echo "valid output\n";
} else {
var_dump($result);
}
};
echo "Done";
?>
@@ -0,0 +1,85 @@
*** Testing posix_getpwuid() : usage variations ***
HipHop Notice: %a
HipHop Notice: %a
Arg value 10.5
valid output
Arg value -10.5
valid output
Arg value 101234567000
valid output
Arg value 1.07654321E-9
valid output
Arg value 0.5
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value 1
valid output
Arg value
valid output
Arg value
HipHop Warning: %a
valid output
Arg value
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value string
HipHop Warning: %a
valid output
Arg value
valid output
Arg value
valid output
Catchable fatal error: Object of class stdClass could not be converted to string in hphp/test/zend/bad/ext-posix/posix_getpwuid_variation.php on line %d
@@ -0,0 +1,5 @@
<?php
var_dump(posix_getrlimit());
?>
@@ -0,0 +1,3 @@
array(%d) {
%a
}
@@ -0,0 +1,6 @@
<?php
echo "Basic test of POSIX posix_getrlimit function\n";
var_dump(posix_getrlimit());
?>
===DONE====
@@ -0,0 +1,5 @@
Basic test of POSIX posix_getrlimit function
array(%d) {
%a
}
===DONE====
@@ -0,0 +1,10 @@
<?php
echo "Basic test of posix_getsid function\n";
$pid = posix_getpid();
$sid = posix_getsid($pid);
var_dump($sid);
?>
===DONE====
@@ -0,0 +1,3 @@
Basic test of posix_getsid function
int(%d)
===DONE====
@@ -0,0 +1,6 @@
<?php
var_dump( posix_getsid() );
var_dump( posix_getsid(array()) );
var_dump( posix_getsid(-1) );
?>
===DONE===
@@ -0,0 +1,6 @@
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,6 @@
<?php
var_dump(posix_initgroups('foo', 'bar'));
var_dump(posix_initgroups(NULL, NULL));
?>
@@ -0,0 +1,3 @@
HipHop Warning: %a
bool(false)
bool(false)
@@ -0,0 +1,7 @@
<?php
echo "Basic test of POSIX posix_initgroups function\n";
var_dump(posix_initgroups('foo', 'bar'));
var_dump(posix_initgroups(NULL, NULL));
?>
===DONE====
@@ -0,0 +1,5 @@
Basic test of POSIX posix_initgroups function
HipHop Warning: %a
bool(false)
bool(false)
===DONE====
@@ -0,0 +1,33 @@
<?php
/* Prototype : proto bool posix_kill(int pid, int sig)
* Description: Send a signal to a process (POSIX.1, 3.3.2)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_kill() : error conditions ***\n";
echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
$pid = posix_getpid();
$sig = 9;
$extra_arg = 10;
var_dump( posix_kill($pid, $sig, $extra_arg) );
echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
$pid = posix_getpid();
var_dump( posix_kill($pid) );
echo "\n-- Testing posix_kill() function with invalid signal --\n";
$pid = posix_getpid();
$sig = 999;
var_dump( posix_kill($pid, 999) );
echo "\n-- Testing posix_kill() function with negative pid --\n";
$pid = -999;
$sig = 9;
var_dump( posix_kill($pid, 999) );
echo "Done";
?>
@@ -0,0 +1,16 @@
*** Testing posix_kill() : error conditions ***
-- Testing posix_kill() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_kill() function with less than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing posix_kill() function with invalid signal --
bool(false)
-- Testing posix_kill() function with negative pid --
bool(false)
Done
@@ -0,0 +1,70 @@
<?php
/* Prototype : proto bool posix_kill(int pid, int sig)
* Description: Send a signal to a process (POSIX.1, 3.3.2)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_kill() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
$sig = -999;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
//array of values to iterate over
$values = array(
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// undefined data
$undefined_var,
// unset data
$unset_var,
// object data
new stdclass(),
);
// loop through each element of the array for pid
foreach($values as $value) {
echo "\nArg value $value \n";
var_dump( posix_kill($value, $sig) );
};
echo "Done";
?>
@@ -0,0 +1,85 @@
*** Testing posix_kill() : usage variations ***
HipHop Notice: %a
HipHop Notice: %a
Arg value 10.5
bool(false)
Arg value -10.5
bool(false)
Arg value 101234567000
bool(false)
Arg value 1.07654321E-9
bool(false)
Arg value 0.5
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
Arg value
bool(false)
Arg value
bool(false)
Arg value 1
bool(false)
Arg value
bool(false)
Arg value 1
bool(false)
Arg value
bool(false)
Arg value
HipHop Warning: %a
bool(false)
Arg value
HipHop Warning: %a
bool(false)
Arg value string
HipHop Warning: %a
bool(false)
Arg value string
HipHop Warning: %a
bool(false)
Arg value
bool(false)
Arg value
bool(false)
Catchable fatal error: Object of class stdClass could not be converted to string in hphp/test/zend/bad/ext-posix/posix_kill_variation1.php on line %d
@@ -0,0 +1,70 @@
<?php
/* Prototype : proto bool posix_kill(int pid, int sig)
* Description: Send a signal to a process (POSIX.1, 3.3.2)
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_kill() : usage variations ***\n";
// Initialise function arguments not being substituted (if any)
$pid = -999;
//get an unset variable
$unset_var = 10;
unset ($unset_var);
//array of values to iterate over
$values = array(
// float data
10.5,
-10.5,
10.1234567e10,
10.7654321E-10,
.5,
// array data
array(),
array(0),
array(1),
array(1, 2),
array('color' => 'red', 'item' => 'pen'),
// null data
NULL,
null,
// boolean data
true,
false,
TRUE,
FALSE,
// empty data
"",
'',
// string data
"string",
'string',
// undefined data
$undefined_var,
// unset data
$unset_var,
// object data
new stdclass(),
);
// loop through each element of the array for sig
foreach($values as $value) {
echo "\nArg value $value \n";
var_dump( posix_kill($pid, $value) );
};
echo "Done";
?>
@@ -0,0 +1,85 @@
*** Testing posix_kill() : usage variations ***
HipHop Notice: %a
HipHop Notice: %a
Arg value 10.5
bool(false)
Arg value -10.5
bool(false)
Arg value 101234567000
bool(false)
Arg value 1.07654321E-9
bool(false)
Arg value 0.5
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
HipHop Notice: %a
Arg value Array
HipHop Warning: %a
bool(false)
Arg value
bool(false)
Arg value
bool(false)
Arg value 1
bool(false)
Arg value
bool(false)
Arg value 1
bool(false)
Arg value
bool(false)
Arg value
HipHop Warning: %a
bool(false)
Arg value
HipHop Warning: %a
bool(false)
Arg value string
HipHop Warning: %a
bool(false)
Arg value string
HipHop Warning: %a
bool(false)
Arg value
bool(false)
Arg value
bool(false)
Catchable fatal error: Object of class stdClass could not be converted to string in hphp/test/zend/bad/ext-posix/posix_kill_variation2.php on line %d
@@ -0,0 +1,12 @@
<?php
var_dump(posix_mkfifo('/tmp/foobar', 0644));
$dir = dirname(__FILE__) . '/foo';
mkdir ($dir);
var_dump(posix_mkfifo($dir . '/bar', 0644));
?>
===DONE===<?php
$dir = dirname(__FILE__) . '/foo';
unlink($dir . '/bar');
rmdir($dir);
?>
@@ -0,0 +1,5 @@
Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in hphp/test/zend/bad/ext-posix/posix_mkfifo_safemode.php on line %d
HipHop Warning: %a
bool(false)
bool(true)
===DONE===
@@ -0,0 +1,6 @@
<?php
$myuid = posix_geteuid();
$uid = var_dump(posix_seteuid( $myuid ) );
?>
@@ -0,0 +1 @@
bool(true)
@@ -0,0 +1,13 @@
<?php
echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
$uid = '123';
$extra_arg = '12312';
var_dump(posix_seteuid( $uid, $extra_arg ) );
var_dump(posix_seteuid( ) );
?>
@@ -0,0 +1,5 @@
*** Test by calling method or function with incorrect numbers of arguments ***
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
@@ -0,0 +1,38 @@
<?php
echo "*** Test substituting argument 1 with object values ***\n";
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
if (error_reporting() != 0) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
}
}
set_error_handler('test_error_handler');
class classWithToString
{
public function __toString() {
return "Class A object";
}
}
class classWithoutToString
{
}
$variation_array = array(
'instance of classWithToString' => new classWithToString(),
'instance of classWithoutToString' => new classWithoutToString(),
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,5 @@
*** Test substituting argument 1 with object values ***
Error: 2 - posix_seteuid() expects parameter 1 to be long, object given, %s
bool(false)
Error: 2 - posix_seteuid() expects parameter 1 to be long, object given, %s
bool(false)
@@ -0,0 +1,18 @@
<?php
$index_array = array(1, 2, 3);
$assoc_array = array(1 => 'one', 2 => 'two');
$variation_array = array(
'empty array' => array(),
'int indexed array' => $index_array,
'associative array' => $assoc_array,
'nested arrays' => array('foo', $index_array, $assoc_array),
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,8 @@
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
@@ -0,0 +1,19 @@
<?php
echo "*** Test substituting argument 1 with boolean values ***\n";
$variation_array = array(
'lowercase true' => true,
'lowercase false' =>false,
'uppercase TRUE' =>TRUE,
'uppercase FALSE' =>FALSE,
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,5 @@
*** Test substituting argument 1 with boolean values ***
bool(false)
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,24 @@
<?php
echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
$unset_var = 10;
unset($unset_var);
$variation_array = array(
'unset var' => @$unset_var,
'undefined var' => @$undefined_var,
'empty string DQ' => "",
'empty string SQ' => '',
'uppercase NULL' => NULL,
'lowercase null' => null,
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,9 @@
*** Test substituting argument 1 with emptyUnsetUndefNull values ***
bool(false)
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,22 @@
<?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_seteuid( $var ) );
}
?>
@@ -0,0 +1,6 @@
*** Test substituting argument 1 with float values ***
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,18 @@
<?php
echo "*** Test substituting argument 1 with int values ***\n";
$variation_array = array (
'int 0' => 0,
'int 1' => 1,
'int -12345' => -12345,
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,4 @@
*** Test substituting argument 1 with int values ***
bool(false)
bool(false)
bool(false)
@@ -0,0 +1,23 @@
<?php
echo "*** Test substituting argument 1 with string values ***\n";
$heredoc = <<<EOT
hello world
EOT;
$variation_array = array(
'string DQ' => "string",
'string SQ' => 'string',
'mixed case string' => "sTrInG",
'heredoc' => $heredoc,
);
foreach ( $variation_array as $var ) {
var_dump(posix_seteuid( $var ) );
}
?>
@@ -0,0 +1,9 @@
*** Test substituting argument 1 with string values ***
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
@@ -0,0 +1,11 @@
<?php
echo "*** Test by calling method or function with its expected arguments ***\n";
$gid = posix_getgid();
var_dump(posix_setgid( $gid ) );
?>
===DONE===
@@ -0,0 +1,3 @@
*** Test by calling method or function with its expected arguments ***
bool(true)
===DONE===
@@ -0,0 +1,13 @@
<?php
echo "*** Test by calling method or function with incorrect numbers of arguments ***\n";
$gid = posix_getgid();
$extra_arg = '123';
var_dump(posix_setgid( $gid, $extra_arg ) );
var_dump(posix_setgid( ) );
?>
===DONE===
@@ -0,0 +1,6 @@
*** Test by calling method or function with incorrect numbers of arguments ***
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
===DONE===
@@ -0,0 +1,21 @@
<?php
echo "*** Test substituting argument 1 with array values ***\n";
$index_array = array(1, 2, 3);
$assoc_array = array(1 => 'one', 2 => 'two');
$variation_array = array(
'empty array' => array(),
'int indexed array' => $index_array,
'associative array' => $assoc_array,
'nested arrays' => array('foo', $index_array, $assoc_array),
);
foreach ( $variation_array as $var ) {
var_dump(posix_setgid( $var ) );
}
?>
===DONE===
@@ -0,0 +1,10 @@
*** Test substituting argument 1 with array values ***
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
===DONE===
@@ -0,0 +1,20 @@
<?php
echo "*** Test substituting argument 1 with boolean values ***\n";
$variation_array = array(
'lowercase true' => true,
'lowercase false' =>false,
'uppercase TRUE' =>TRUE,
'uppercase FALSE' =>FALSE,
);
foreach ( $variation_array as $var ) {
var_dump(posix_setgid( $var ) );
}
?>
===DONE===
@@ -0,0 +1,6 @@
*** Test substituting argument 1 with boolean values ***
bool(false)
bool(false)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,24 @@
<?php
echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n";
$unset_var = 10;
unset($unset_var);
$variation_array = array(
'unset var' => @$unset_var,
'undefined var' => @$undefined_var,
'empty string DQ' => "",
'empty string SQ' => '',
'uppercase NULL' => NULL,
'lowercase null' => null,
);
foreach ( $variation_array as $var ) {
var_dump(posix_setgid( $var ) );
}
?>
@@ -0,0 +1,9 @@
*** Test substituting argument 1 with emptyUnsetUndefNull values ***
bool(false)
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
bool(false)
bool(false)

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais