php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75958 bool return on some SPL methods, not void
Submitted: 2018-02-14 09:38 UTC Modified: 2018-09-21 05:36 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: oeildanslabouche at gmail dot com Assigned: carusogabriel (profile)
Status: Closed Package: SPL related
PHP Version: Next major version OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oeildanslabouche at gmail dot com
New email:
PHP Version: OS:

 

 [2018-02-14 09:38 UTC] oeildanslabouche at gmail dot com
Description:
------------
The doc says push() return void, but it's a boolean indeed.

Test script:
---------------
$test = new \SplStack();
var_dump( $test->push(1));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-14 09:59 UTC] requinix@php.net
-Summary: bool return on \SplStack->push(), not void +Summary: bool return on some SPL methods, not void -Type: Documentation Problem +Type: Bug
 [2018-02-14 09:59 UTC] requinix@php.net
Just went through the SPL code...

Always RETURN_TRUE, docs say void:
- SplHelp::insert
- SplPriorityQueue::insert
- SplHeap::recoverFromCorruption
- SplDoublyLinkedList::push
- SplDoublyLinkedList::unshift

Always RETURN_TRUE, docs say bool:
- SplFixedArray::setSize

Always returning true isn't helpful. Maybe it would be better to change the code so they are actually void?
 [2018-07-23 02:32 UTC] carusogabriel@php.net
We're only going to change it in the next major version of PHP, as this, unfortunately, is a BC.

Ref: https://github.com/php/php-src/pull/3162
 [2018-07-23 02:32 UTC] carusogabriel@php.net
-Assigned To: +Assigned To: carusogabriel
 [2018-08-11 21:38 UTC] cmb@php.net
Adding array_walk()[1] to this list, even though it is not an SPL
method.

[1] <https://bugs.php.net/76668>
 [2018-08-12 00:14 UTC] carusogabriel@php.net
Also Locale::setDefault from https://bugs.php.net/55173
 [2018-09-21 05:36 UTC] carusogabriel@php.net
-PHP Version: 7.1.14 +PHP Version: Next major version
 [2020-03-25 14:05 UTC] kocsismate@php.net
Automatic comment on behalf of kocsismate@woohoolabs.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=782f7e2ad864693919b9f9efbb4d64bbae17cdc5
Log: Fix #75958 Return void instead of true
 [2020-03-25 14:05 UTC] kocsismate@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC