Anonymous | Login | Signup for a new account | 11-17-2024 00:46 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0002876 | [Quercus] | major | always | 08-28-08 10:18 | 08-28-08 19:38 | ||||
Reporter | koreth | View Status | public | ||||||
Assigned To | nam | ||||||||
Priority | high | Resolution | fixed | ||||||
Status | closed | Product 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. |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed. 27 unique queries executed. |