php.net |  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.
Password:
Status:
Package:
Bug Type:
Summary:
From: cmanley at xs4all dot nl
New email:
PHP Version: OS:

 

 [2020-11-25 08:33 UTC] cmanley at xs4all dot nl
Description:
------------
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:
----------------
OK

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-25 09:00 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2020-11-25 09:00 UTC] nikic@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 08:01:30 2024 UTC