Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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)

test.php (387 bytes) - added by steveh 3 years ago.
Reproduction case for this issue

Download all attachments as: .zip

Change History (6)

Changed 3 years ago by steveh

Reproduction case for this issue

comment:1 Changed 3 years ago by steveh

The workaround is to set the property in the constructor instead of in the class declaration.

comment:2 Changed 3 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 3 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

Last edited 3 years ago by moo (previous) (diff)

comment:4 Changed 3 years ago by moo

  • Resolution set to fixed
  • Status changed from accepted to closed

In 1536:

update ChangeLog? about fixed #348

comment:5 Changed 3 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";
}
Note: See TracTickets for help on using tickets.