Req #60759 [Opn->Asn]: SplDoublyLinkedList->clear()
| From: | felipe@php.net | Date: | Sat, 28 Jul 2012 22:12:45 +0000 |
| Subject: | Req #60759 [Opn->Asn]: SplDoublyLinkedList->clear() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172305@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60759&edit=1
ID: 60759
Updated by: felipe@php.net
Reported by: dragoonis@php.net
Summary: SplDoublyLinkedList->clear()
-Status: Open
+Status: Assigned
Type: Feature/Change Request
Package: SPL related
Operating System: N/A
PHP Version: 5.4.0RC5
-Assigned To:
+Assigned To: colder
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-01-15 22:37:51] 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-01-15 22:37:16] 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:29:54] dragoonis@php.net
Renaming the reset() method to clear()
------------------------------------------------------------------------
[2012-01-15 03:26:24] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60759&edit=1