Bug #77032 [NEW]: bug in enum

From: Date: Thu, 18 Oct 2018 10:08:38 +0000
Subject: Bug #77032 [NEW]: bug in enum
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217620@lists.php.net to get a copy of this message
From: bolkunovdu at mail dot ru Operating system: ubuntu PHP version: 7.2.11 Package: Class/Object related Bug Type: Bug Bug description:bug in enum Description: ------------ 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) { ["__default"]=> string(5) "table" } object(CardType)#2 (1) { ["__default"]=> 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) { ["__default"]=> UNKNOWN:0 } object(CardType)#2 (1) { ["__default"]=> 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); $card_type2=$card_type; var_dump($card_type, $card_type2); -- Edit bug report at https://bugs.php.net/bug.php?id=77032&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77032&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77032&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77032&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77032&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77032&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77032&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77032&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77032&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77032&r=support Expected behavior: https://bugs.php.net/fix.php?id=77032&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77032&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77032&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77032&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77032&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77032&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77032&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77032&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77032&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77032&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77032&r=mysqlcfg

« previous php.bugs (#217620) next »