mirror of
https://github.com/php/php-src.git
synced 2024-09-30 14:26:12 +00: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
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
--TEST--
|
|
shm_detach() tests
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("sysvshm")){ print 'skip'; }
|
|
if (!function_exists('ftok')){ print 'skip'; }
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$key = ftok(dirname(__FILE__)."/003.phpt", 'q');
|
|
|
|
var_dump(shm_detach());
|
|
var_dump(shm_detach(1,1));
|
|
|
|
$s = shm_attach($key);
|
|
|
|
var_dump(shm_detach($s));
|
|
var_dump(shm_detach($s));
|
|
shm_remove($s);
|
|
|
|
var_dump(shm_detach(0));
|
|
var_dump(shm_detach(1));
|
|
var_dump(shm_detach(-1));
|
|
|
|
echo "Done\n";
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
|
|
$key = ftok(dirname(__FILE__)."/003.phpt", 'q');
|
|
$s = shm_attach($key);
|
|
shm_remove($s);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: shm_detach() expects exactly 1 parameter, 0 given in %s003.php on line %d
|
|
NULL
|
|
|
|
Warning: shm_detach() expects exactly 1 parameter, 2 given in %s003.php on line %d
|
|
NULL
|
|
bool(true)
|
|
|
|
Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
|
|
bool(false)
|
|
|
|
Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
|
|
|
|
Warning: shm_detach() expects parameter 1 to be resource, integer given in %s003.php on line %d
|
|
NULL
|
|
|
|
Warning: shm_detach() expects parameter 1 to be resource, integer given in %s003.php on line %d
|
|
NULL
|
|
|
|
Warning: shm_detach() expects parameter 1 to be resource, integer given in %s003.php on line %d
|
|
NULL
|
|
Done
|