#348 closed defect (fixed)
Class properties created from __FILE__ break multi sites
Reported by: | steveh | Owned by: | moo |
---|---|---|---|
Priority: | major | Milestone: | 4.0.0 |
Component: | cacher | Version: | 3.1.0 |
Keywords: | Cc: | ||
Application: | PHP Version: | 5.3.28 | |
Other Exts: | SAPI: | Irrelevant | |
Probability: | Always | Blocked By: | |
Blocking: |
Description
If you have a class which uses FILE to initialise a property and said class is used on multiple sites xcache caches the value and hence its incorrect for all but the first site accessed.
Attachments (1)
Change History (6)
Changed 5 years ago by steveh
comment:1 Changed 5 years ago by steveh
The workaround is to set the property in the constructor instead of in the class declaration.
comment:2 Changed 5 years ago by steveh
Forgot to mention to reproduce just put test.php file under vhost for two sites and then visit each site, you'll see the second site reports paths from the first site for both the class constant and class property which are initialised at the class level
comment:3 Changed 5 years ago by moo
- Milestone changed from undecided to 3.3.0
- Status changed from new to accepted
good catch. XCache recalculate builtin __FILE__ __DIR__ in opcode but not in class constants.
unluckily this is too late for upcoming release that going to support PHP_5_6
comment:4 Changed 5 years ago by moo
- Resolution set to fixed
- Status changed from accepted to closed
In 1536:
comment:5 Changed 5 years ago by moo
- Milestone changed from 3.3.0 to 4.0.0
fixed in [1530], however PHP_5_6 zend_ast is not supported, e.g.:
<?php class C { const X = array(__FILE__); const Y = __DIR__ . "file"; }
Reproduction case for this issue