php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60759 SplDoublyLinkedList->clear()
Submitted: 2012-01-15 03:26 UTC Modified: 2021-07-26 16:31 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: dragoonis@php.net Assigned:
Status: Open Package: SPL related
PHP Version: 5.4.0RC5 OS: N/A
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dragoonis@php.net
New email:
PHP Version: OS:

 

 [2012-01-15 03:26 UTC] dragoonis@php.net
Description:
------------
The patch adds a reset() method to the SplDoublyLinkedList class.
This allows the internal list to be wiped cleaned for reuse.

Test script:
---------------
<?php
$d = new SplDoublyLinkedList();
$d->push(5);
var_dump($d->count());
$d->reset();
var_dump($d->count());

int(1)
int(0)

Actual result:
--------------
<?php
$d = new SplDoublyLinkedList();
$d->push(5);
var_dump($d->count());
$d->reset();
var_dump($d->count());

int(1)
int(0)

Patches

spl_dllist_clear (last revision 2012-01-15 22:37 UTC by dragoonis@php.net)
spl_dllist_reset (last revision 2012-01-15 03:26 UTC by dragoonis)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-15 22:29 UTC] dragoonis@php.net
-Summary: SplDoublyLinkedList->reset() +Summary: SplDoublyLinkedList->clear()
 [2012-01-15 22:29 UTC] dragoonis@php.net
Renaming the reset() method to clear()
 [2012-01-15 22:37 UTC] dragoonis@php.net
I think it's much more appropriate to rename this to clear() as it implies wiping 
contents of something. The original idea of reset() wasn't a good one as the term 
'reset' in PHP usually refers to resetting an internal pointer of a list.

New patch attached as spl_dllist_clear.
 [2012-01-15 22:37 UTC] dragoonis@php.net
The following patch has been added/updated:

Patch Name: spl_dllist_clear
Revision:   1326667071
URL:        https://bugs.php.net/patch-display.php?bug=60759&patch=spl_dllist_clear&revision=1326667071
 [2012-07-28 22:12 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: colder
 [2012-07-28 22:14 UTC] dragoonis@php.net
Thanks for getting this merged into a version branch Felipe. Paul.
 [2012-07-28 22:29 UTC] felipe@php.net
It hasn't been merged, yet. Just assigned to the SPL maintainer.
 [2014-02-27 04:54 UTC] levim@php.net
-Assigned To: colder +Assigned To: levim
 [2017-10-24 08:09 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: levim +Assigned To:
 [2021-07-26 16:31 UTC] cmb@php.net
Apparently, this ticket has been forgotten.  If you're still
interested in this, I suggest to submit a pull request[1].

[1] <https://github.com/php/php-src/pulls>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 18:01:29 2024 UTC