sem_get: Changed "auto_release" Argument to Boolean
As of PHP 8.0.0, the auto_release
integer argument of the sem_get()
function changed to a boolean. This only causes an issue with strict_types
enabled, although it's best to fix this regardless, to avoid unexpected compatibility issues in the future. Using an integer with strict_types
enabled will throw a TypeError
:
declare(strict_types=1);
sem_get(100, 1, 0600, 0);
Solution
Replace the argument with a boolean, or cast it:
declare(strict_types=1);
sem_get(100, 1, 0600, (bool) 0);
Errors or Warnings
- sem_get(): Argument #4 ($auto_release) must be of type bool, int given