Page 1 of 1

Predefined constants don't work in static expressions

PostPosted: Tue Feb 14, 2017 9:20 pm
by mikh1250

Static initialization expressions using predefined constants like __FILE__ and __DIR__ produce garbled results.
The bug occurrs with php 5.6 + zend guard 7 + debian 8 x64_86, but I think the version does not matter much.

To reproduce create a file - test.php
Code: Select all
class Foo { public static $expr = __DIR__ . '-bar'; }

Encode it with the cli tool:
Code: Select all
zendenc56 test.php test.enc.php

There should be no difference:
Code: Select all
diff -s <(php test.php) <(php test.enc.php)

yet, the php test.enc.php returns garbled string
Code: Select all