|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-14 11:34 UTC] r dot vanicek at seznam dot cz
Description: ------------ I am using PHP 4.4.0 with bcompiler 0.7. The problem is that if the script uses __FILE__, it is bytecompiled and if the script is copied to another system and located in another directory, the value of __FILE__ is not the 'true' one (the run-time value) but the compile-time value. Eg: require_once(dirname(__FILE__).'/cmn/module.php'); may not find the module. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 10:00:01 2025 UTC |
This is rather a messy patch - needs better testing of types etc. But the basic idea is that __BCOMPILER_FILE__ gets replaced with the compiled filename when it get's rebuilt.. Can you test this with a few files and see if it breaks.. @@ -3668,6 +3681,20 @@ break; } #endif + + if (zo->opcode == ZEND_FETCH_CONSTANT && + ((&zo->op2)->op_type == IS_CONST) && + strcmp((&zo->op2)->u.constant.value.str.val, "__BCOMPILER__FILE__") == 0 + ) { + BCOMPILER_DEBUG(("REPLACING __BCOMPILER_FILE__ BACK" )); + (&zo->op2)->u.constant.value.str.len = strlen( BCOMPILERG(current_filename)); + (&zo->op2)->u.constant.value.str.val = estrdup( BCOMPILERG(current_filename)); + } + + + + + DESERIALIZE_SCALAR(&zo->extended_value, ulong); DESERIALIZE_SCALAR(&zo->lineno, uint); }