Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
2876 | major | always | 08-28-08 10:18 | 08-28-08 19:38 | |
|
|||||
Reporter: | koreth | Platform: | |||
Assigned To: | nam | OS: | |||
Priority: | high | OS Version: | |||
Status: | closed | Product Version: | 3.2.1 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.2.1 | ||
|
|||||
Summary: | 0002876: APC-cached objects' classes are assigned at store, not at fetch | ||||
Description: |
Here's test1.php, which unserializes an instance of an undefined class and stashes it in APC: <?php $foo = unserialize('O:3:"Foo":1:{s:3:"bar";i:1;}'); apc_store('test', $foo); And here's test2.php, which defines the class and pulls the object from APC: <?php class Foo { public $bar; } $foo = apc_fetch('test'); if ($foo instanceof Foo) { print "it's a Foo\n"; } else { print_r($foo); } In plain PHP, fetching test1.php then test2.php gets you "it's a Foo". In Quercus, you get the print_r of the incomplete-class-name object. We have an "initialize APC" script that reads a couple megabytes worth of data and stashes it into APC; that script doesn't need to have all the class declarations loaded in regular PHP. In Quercus it breaks in a bunch of places because the objects aren't of the expected types when they're pulled from APC. For our purposes it's sufficient to just fix this for the case of an object whose class was undefined at the time it was stored in APC (but is defined at fetch time) and I think that's probably the most common case in general. But I suppose there could also be more obscure cases where you have two classes of the same name but with different methods that you want to be able to instantiate from the same APC entries. Not good programming practice, of course, but it would work fine in vanilla PHP. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|