using enum in $_SESSION variable causes session_start to error "Failed to decode session object. "
Open
Nobody has claimed this yet.
Extension: session
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
Description
The following code:
<?php
session_start() ;
enum xxx {
case A;
case B;
case C;
}
echo "Hallo, wereld" ;
$_SESSION['test'] = xxx::C;
When run TWICE!
Resulted SECOND TIME RUNNING in this output:
Warning: session_start(): Class 'xxx' not found in /home/admin/domains/xxxxxxxxx.nl/public_html/test/test.php on line 3
Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/admin/domains/xxxxxxxxxxxx.nl/public_html/test/test.php on line 3
Hallo, wereld
But I expected this output instead:
Hallo, wereld
PHP Version
8.1.4
Operating System
Linux CentOs 7 -- 3.10.0-1160.59.1.el7.x86_64 php/php-src#1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two-run example using session_start(), $_SESSION, and the enum on PHP 8.1.4, paying attention to the reported “Class 'xxx' not found” and session-decoding warnings. Identify the relevant PHP documentation entry and clarify the documented behavior and expected handling of enum values in sessions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100