|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77032 bug in enum
Submitted: 2018-10-18 10:08 UTC Modified: 2021-05-31 13:57 UTC
From: bolkunovdu at mail dot ru Assigned:
Status: Suspended Package: SPL_Types (PECL)
PHP Version: 7.2.11 OS: ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-10-18 10:08 UTC] bolkunovdu at mail dot ru
sorry for my bad English. i found bug in enum, just run code, and you`ll see, that on first var_dump variables has correct values

object(CardType)#1 (1) { 
string(5) "table" 
object(CardType)#2 (1) { 
string(4) "list" 

but after assignment operation variable $card_type is broken. Sometimes it return another enum, but i can`t emulate this in short version of code, so just attach small code, which broke variable

object(CardType)#1 (1) { 
object(CardType)#2 (1) { 
string(5) "table" 

think that happens because of some bugs in work with memory pointers on clone\copy operation

Test script:
class CardType extends SplEnum 
const __default = 'list';

const CARD_LIST = 'list'; 
const TABLE = 'table'; 
const TABLE2 = 'table2'; 

$card_type = new CardType('table'); 
$card_type2 = new CardType('list'); 
var_dump($card_type, $card_type2);


var_dump($card_type, $card_type2);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-18 10:16 UTC]
-Package: Class/Object related +Package: SPL_Types
 [2018-10-18 12:25 UTC]
Hmm, SplTypes got no updates for five years (the latest release is
even more than six years old) – does it even compile with PHP
 [2021-05-31 13:57 UTC]
-Status: Open +Status: Suspended
 [2021-05-31 13:57 UTC]
The spl_types package is unmaintained; I suspend this ticket,
until a new maintainer steps up.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 05:01:29 2024 UTC