php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75673 SplStack::unserialize() behavior
Submitted: 2017-12-13 00:57 UTC Modified: 2018-10-18 12:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: wolfsoft at mail dot ru Assigned:
Status: Open Package: SPL related
PHP Version: 7.0.26 OS: Linux
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: wolfsoft at mail dot ru
New email:
PHP Version: OS:

 

 [2017-12-13 00:57 UTC] wolfsoft at mail dot ru
Description:
------------
The SplStack::unserialize() method adds elements to current object from serialized one instead of replacing

Test script:
---------------
<?php

$stack = new SplStack();
$stack->push("one");
$stack->push("two");

$serialized = $stack->serialize();
echo $stack->count(), "\n";
$stack->unserialize($serialized);
echo $stack->count(), "\n";
$stack->unserialize($serialized);
echo $stack->count(), "\n";


Expected result:
----------------
2
2
2

Actual result:
--------------
2
4
6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-18 12:22 UTC] cmb@php.net
-Package: SPL_Types +Package: SPL related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 11:01:25 2019 UTC