View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001822 | Xdebug | Uncategorized | public | 2020-07-26 18:32 | 2020-07-27 21:44 |
Reporter | fpoirotte | Assigned To | derick | ||
Priority | low | Severity | tweak | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 2.9.6 | ||||
Summary | 0001822: XDebug changes the output of serialize() for classes that use __sleep() with binary data | ||||
Description | Hello, I'm not sure if this is an issue with XDebug or in the PHP interpreter itself, but when calling serialize() on an object whose class uses the sleep() magic method to provide serialization, the output changes depending on whether XDebug is loaded or not. When XDebug is not loaded, the test script returns: When XDebug is enabled, the following is returned instead: I'd expect the result of serialize() to be the same whether XDebug is enabled or not. Best regards, | ||||
Steps To Reproduce | <?php class Sleeper
} var_dump(serialize(new Sleeper("test"))); | ||||
Additional Information | $ /usr/bin/php -v $ /usr/bin/php -m [Zend Modules] | ||||
Tags | No tags attached. | ||||
Operating System | Debian GNU/Linux testing (11 / Bullseye) | ||||
PHP Version | 7.4.0-7.4.4 | ||||
|
Hi! Xdebug does not change the output of serialise. I've modified your script a little:
With Xdebug:
Without Xdebug:
The difference is purely in the output of xdebug's var_dump, where it escapes the \0 characters that are present in the original serialize() output:
(Spot the "00" in there) IMO, Xdebug does the right thing and instead outputs the \0 characters as "\000". |
|
I see. Thanks for clarifying what's happening here! |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-07-26 18:32 | fpoirotte | New Issue | |
2020-07-27 13:40 | derick | Assigned To | => derick |
2020-07-27 13:40 | derick | Status | new => resolved |
2020-07-27 13:40 | derick | Resolution | open => no change required |
2020-07-27 13:40 | derick | Note Added: 0005431 | |
2020-07-27 21:44 | fpoirotte | Note Added: 0005432 |