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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Sun Jun 16 12:01:29 2019 UTC