|  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
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.
Block user comment
Status: Assign to:
Bug Type:
From: oeildanslabouche at gmail dot com
New email:
PHP Version: OS:


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

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-14 09:59 UTC]
-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]
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]
We're only going to change it in the next major version of PHP, as this, unfortunately, is a BC.

 [2018-07-23 02:32 UTC]
-Assigned To: +Assigned To: carusogabriel
 [2018-08-11 21:38 UTC]
Adding array_walk()[1] to this list, even though it is not an SPL

[1] <>
 [2018-08-12 00:14 UTC]
Also Locale::setDefault from
 [2018-09-21 05:36 UTC]
-PHP Version: 7.1.14 +PHP Version: Next major version
 [2020-03-25 14:05 UTC]
Automatic comment on behalf of
Log: Fix #75958 Return void instead of true
 [2020-03-25 14:05 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 22:05:51 2022 UTC