|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-11-16 16:51 UTC] cmb@php.net
-Status: Open
+Status: Suspended
[2020-11-16 16:51 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
Description: ------------ Set the default value for sem_get()'s parameter auto_release to 0 as 1 allows additional acquisition of semaphores when reassigning semaphore resource identifiers although the semaphore was not released yet. Test script: --------------- <?php class Sem { private $key = null; private $res = null; public function __construct() { $this->key = ftok(".","."); $this->set_res(); $this->acquire(); } public function set_res() { // 4th parameter auto_released is 1 by default $this->res = sem_get($this->key, 1, 0600, 1); } public function acquire() { echo "acquired='".sem_acquire($this->res,true)."'\n"; } } $s = new Sem(); $s->set_res(); $s->acquire(); // NOTE: it allows additional acquisition for simple resource variables too ?> Expected result: ---------------- acquired='1' acquired='' Actual result: -------------- acquired='1' acquired='1'