Bug #54970 [Opn->Csd]: SplFixedArray::setSize() isn't resizing
| From: | felipe@php.net | Date: | Thu, 02 Jun 2011 00:40:53 +0000 |
| Subject: | Bug #54970 [Opn->Csd]: SplFixedArray::setSize() isn't resizing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161118@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54970&edit=1
ID: 54970
Updated by: felipe@php.net
Reported by: marco dot paulo dot lopes at gmail dot com
Summary: SplFixedArray::setSize() isn't resizing
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
PHP Version: 5.3.6
-Assigned To:
+Assigned To: felipe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-06-02 02:40:31] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=311721
Log: - Fixed bug #54970 (SplFixedArray::setSize() isn't resizing)
------------------------------------------------------------------------
[2011-06-01 15:25:48] marco dot paulo dot lopes at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/splfixedarray.setsize
---
When resizing an SplFixedArray using the setSize method, values from the deleted
indexes behave strangely.
Test script:
---------------
The following piece of code:
<?php
$fa = new SplFixedArray(2);
$fa[0] = 'Hello';
$fa[1] = 'World';
$fa->setSize(3);
var_dump($fa);
$fa[2] = '!';
$fa->setSize(1);
var_dump($fa);
?>
Outputs:
object(SplFixedArray)#1 (3) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
[2]=>
NULL
}
object(SplFixedArray)#1 (3) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
[2]=>
NULL
}
While the following piece of code:
<?php
$fa = new SplFixedArray(2);
$fa[0] = 'Hello';
$fa[1] = 'World';
$fa->setSize(3);
$fa[2] = '!';
var_dump($fa);
$fa->setSize(1);
var_dump($fa);
?>
Outputs this:
object(SplFixedArray)#1 (3) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
[2]=>
string(1) "!"
}
object(SplFixedArray)#1 (3) {
[0]=>
string(5) "Hello"
[1]=>
string(5) "World"
[2]=>
string(1) "!"
}
Expected result:
----------------
I would expect to see the same in either of the above presented cases, and it
should be an array with the new size that was specified using setSize:
object(SplFixedArray)#1 (1) {
[0]=>
string(5) "Hello"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54970&edit=1