Browse Source

Merge branch 'PHP-7.0'

* PHP-7.0:
  Removed shmop test leaking an shm segment
pull/1846/head
Matteo Beccati 10 years ago
parent
commit
5274353719
  1. 1
      ext/shmop/shmop.c
  2. 33
      ext/shmop/tests/003.phpt

1
ext/shmop/shmop.c

@ -203,6 +203,7 @@ PHP_FUNCTION(shmop_open)
}
if (shmctl(shmop->shmid, IPC_STAT, &shm)) {
/* please do not add coverage here: the segment would be leaked and impossible to delete via php */
php_error_docref(NULL, E_WARNING, "unable to get shared memory segment information '%s'", strerror(errno));
goto err;
}

33
ext/shmop/tests/003.phpt

@ -1,33 +0,0 @@
--TEST--
shmop extension error messages (non-root)
--SKIPIF--
<?php
if( substr(PHP_OS, 0, 3) == "WIN") {
die('skip not for Windows');
}
if (!extension_loaded("shmop")) {
die("skip shmop extension not available");
}
if (!extension_loaded("posix")) {
die("skip posix extension not available");
}
if (!posix_geteuid()) {
die("skip cannot run test as root");
}
?>
--FILE--
<?php
$hex_shm_id = function(){
return mt_rand(1338, 9999);
};
echo '## shmop_open function tests ##', PHP_EOL;
// warning outputs: unable to get shared memory segment information
var_dump(shmop_open($hex_shm_id(), 'n', 0, 1024));
?>
--EXPECTF--
## shmop_open function tests ##
Warning: shmop_open(): unable to get shared memory segment information 'Permission denied' in %s on line %d
bool(false)
Loading…
Cancel
Save