Skip to content

Commit 69d46c3

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix brittle shmop test
2 parents 50a9f51 + 1892e3a commit 69d46c3

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

ext/shmop/tests/002.phpt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,34 @@ edgarsandi - <edgar.r.sandi@gmail.com>
1010
?>
1111
--FILE--
1212
<?php
13-
$hex_shm_id = function(){
14-
return mt_rand(1338, 9999);
15-
};
1613

1714
echo PHP_EOL, '## shmop_open function tests ##';
1815
// warning outputs: invalid flag when the flags length != 1
19-
var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
16+
var_dump(shmop_open(1338, '', 0644, 1024));
2017

2118
// warning outputs: invalid access mode
22-
var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024));
19+
var_dump(shmop_open(1338, 'b', 0644, 1024));
2320

2421
// warning outputs: unable to attach or create shared memory segment
2522
var_dump(shmop_open(null, 'a', 0644, 1024));
2623

2724
// warning outputs: Shared memory segment size must be greater than zero
28-
var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
25+
var_dump(shmop_open(1338, "c", 0666, 0));
2926

3027
echo PHP_EOL, '## shmop_read function tests ##';
3128
// warning outputs: start is out of range
32-
$shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
29+
$shm_id = shmop_open(1338, 'n', 0600, 1024);
3330
var_dump(shmop_read($shm_id, -10, 0));
3431
shmop_delete($shm_id);
3532

3633
// warning outputs: count is out of range
37-
$shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
34+
$shm_id = shmop_open(1339, 'n', 0600, 1024);
3835
var_dump(shmop_read($shm_id, 0, -10));
3936
shmop_delete($shm_id);
4037

4138
echo PHP_EOL, '## shmop_write function tests ##';
4239
// warning outputs: offset out of range
43-
$shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
40+
$shm_id = shmop_open(1340, 'n', 0600, 1024);
4441
var_dump(shmop_write($shm_id, 'text to try write', -10));
4542
shmop_delete($shm_id);
4643
?>

0 commit comments

Comments
 (0)