|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80413 TypeError: docs says param 4 of sem_get() is bool but PHP says int
Submitted: 2020-11-25 08:33 UTC Modified: 2020-11-25 09:00 UTC
From: cmanley at xs4all dot nl Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.3.24 OS: Debian 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: cmanley at xs4all dot nl
New email:
PHP Version: OS:


 [2020-11-25 08:33 UTC] cmanley at xs4all dot nl
The documentation says parameter 4 of sem_get is a bool (bool $auto_release = TRUE), but when calling sem_get using true as parameter 4 in strict_types=1 mode, then PHP throws a TypeError: "sem_get() expects parameter 4 to be int, bool given"

Exact PHP version I'm using: PHP 7.3.19-1~deb10u1

Previously, someone reported that the parameter wasn't documented (see bug #51045). Now it's documented, but either the documentation is incorrect or the implementation is incorrect.

Test script:
<?php declare(strict_types = 1);
$semkey = ftok(__FILE__, 'R');
$semid = sem_get($semkey, 1, 0666, true);
print "OK\n";

Expected result:

Actual result:
TypeError: sem_get() expects parameter 4 to be int, bool given


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-25 09:00 UTC]
-Status: Open +Status: Not a bug
 [2020-11-25 09:00 UTC]
See the changelog entry on the documentation page:

> 8.0.0 	The type of auto_release has been changed from int to bool.

The type is bool in PHP 8 and int in earlier PHP versions.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 22 22:01:41 2021 UTC