Closed jackpoz closed 4 years ago
This is caused by https://github.com/Sarjuuk/aowow/blob/93948a2ec53de57c4dacdeba8ef0d41b8534e9d6/pages/genericPage.class.php#L947 using wrong modifier flag 0x1300 which is the bitmask of the constants IS_PUBLIC (256), IS_PROTECTED (512) and another one (see https://www.php.net/manual/en/class.reflectionproperty.php for reference)
The function getModifiers() doesn't return these values but returns its own that start from 1, see below:
Using https://www.php.net/manual/en/reflection.getmodifiernames.php one can see the values of each modifier:
Which means no actual properties are saved locally and an empty array will be loaded on cache load
The actual bitmask values should not be hardcoded but should be retrieved using ReflectionProperty::IS_ constants, like these:
These values can be inspected at https://github.com/php/php-src/blob/d92229d8c78aac25925284e23aa7903dca9ed005/Zend/zend_compile.h#L208-L210
Thanks for the research so far. At the time of writing the code, i noticed ReflectionProperty 0x1000 being set, but found no documentation on what it actually was. But it did fit exactly on the properties i wanted to store. Anyway, i should redo this part.
ok, this is weird.
php > var_dump(ReflectionProperty::IS_PROTECTED);
int(512)
php > var_dump(ReflectionProperty::IS_PUBLIC);
int(256)
but i guess ReflectionProperty::isPublic()
and ReflectionProperty::isProtected()
will work anyway, so i will switch to that, but
i still get 0x1000 for properties created on the fly, although isPublic() also returns true for them.
could you check the return value of getModifiers on one of them, say for infobox
?
C:\Program Files\Console2>php -v
PHP 7.4.6 (cli) (built: May 12 2020 11:38:54) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
C:\Program Files\Console2>php -a
Interactive shell
php > var_dump(ReflectionProperty::IS_PROTECTED);
int(2)
alright, now i'm properly pissed!
the last post was from the server using
PHP 7.1.26-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jan 11 2019 14:13:16) ( NTS )
trinity@TCUBUNTU:~$ php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
trinity@TCUBUNTU:~$ php -a
Interactive mode enabled
php > var_dump(ReflectionProperty::IS_PROTECTED);
int(2)
Using Ubuntu 20.04
Btw the best thing is not to use the actual hardcoded int but just rely on ReflectionProperty::IS_PROTECTED variable itself, so it doesn't matter what value it has
Ye, or the built in functions ReflectionProperty::isPublic()
should be fixed in 583f8658d7f043643db51ab754495d4baf49614c
When enabling CACHE_MODE [x]filecache the page works at 1st load but doesn't work anymore from 2nd load and forward.
First load:
Second load:
The "cache/template" folder set in configs as CACHE_DIR shows files being created:
Permissions of the entire cache/* folder are set to have www-data as owner (Ubuntu 20.04 using apache2 with php enabled)
As soon as I enable DEBUG config everything works fine (as that setting disables the cache)