mirror of
https://github.com/php/php-src.git
synced 2025-01-22 11:44:09 +08:00
ceb1ea37ad
A little background: * key_t is an int, like ext/shmop * There is no ftok() (from ext/standard), so tests have a new check to see whether or not it is available. This however means that the 7 tests will all be skipped for Windows. I know we cannot properly implement an ftok() function since there is no inodes for NTFS, maybe we should look into using the GetFileInfoByHandle() or similar to use the system unique ID for a file to get the same functionality, Anatol? * Despite the lack of phpt's, local testing works flawlessly but we better look into a solution for this if we are to keep this patch
44 lines
995 B
PHP
44 lines
995 B
PHP
--TEST--
|
|
shm_put_var() tests
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("sysvshm")){ print 'skip'; }
|
|
if (!function_exists('ftok')){ print 'skip'; }
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$key = ftok(__FILE__, 't');
|
|
$s = shm_attach($key, 1024);
|
|
|
|
var_dump(shm_put_var());
|
|
var_dump(shm_put_var(-1, -1, -1));
|
|
var_dump(shm_put_var(-1, 10, "qwerty"));
|
|
var_dump(shm_put_var($s, -1, "qwerty"));
|
|
var_dump(shm_put_var($s, 10, "qwerty"));
|
|
var_dump(shm_put_var($s, 10, "qwerty"));
|
|
|
|
$string = str_repeat("test", 512);
|
|
var_dump(shm_put_var($s, 11, $string));
|
|
|
|
shm_remove($s);
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECTF--
|
|
Warning: shm_put_var() expects exactly 3 parameters, 0 given in %s004.php on line %d
|
|
NULL
|
|
|
|
Warning: shm_put_var() expects parameter 1 to be resource, integer given in %s004.php on line %d
|
|
NULL
|
|
|
|
Warning: shm_put_var() expects parameter 1 to be resource, integer given in %s004.php on line %d
|
|
NULL
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
|
|
Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14
|
|
bool(false)
|
|
Done
|