[Pkg-php-pecl] Bug#864494: php5-xcache: Identical files with a static variable that has__DIR__ leads to wrong results.
Jiri Kacena
xcache at ehosting.cz
Fri Jun 9 13:35:52 UTC 2017
Package: php5-xcache
Version: 3.2.0-1
Severity: important
Dear Maintainer,
when two php source files are identical and they use a static variable which has __DIR__ or __FILE__ in it,
it will get cached once (which itself is not a bug), but when the files are requested,
the othe returns __DIR__ or __FILE__ from the first accessed instance. It seems like these specail variables
turn into static strings upon inserting into the cache. This error originally appeared when copying composer
installations (composer uses a class that has static variable with __DIR__ in the value).
To reproduce the error only four simple files are necessary:
testmain1.php:
<?php
require_once 'testinclude1.php';
var_dump($myfilename);
testinclude1.php:
<?php
static $myfilename=__FILE__;
testmain2.php:
<?php
require_once 'testinclude2.php';
var_dump($myfilename);
testinclude2.php:
<?php
static $myfilename=__FILE__;
After browsing to testmain1.php and then to testmain2.php
i see
string(35) "/var/www/testcache/testinclude1.php"
and
string(35) "/var/www/testcache/testinclude1.php"
while the expected results are
string(35) "/var/www/testcache/testinclude1.php"
and
string(35) "/var/www/testcache/testinclude2.php"
When the varialbes are NOT static, it gets interpretted correctly even though the file is cached only once in the memory.
I've also reported the bug in xcache's Trac:
https://xcache.lighttpd.net/ticket/371
Regards
Jiri
More information about the Pkg-php-pecl
mailing list