It looks like as of bcompiler 0.9.3 geoff's code above works correctly with the output:
static
construct
testOut
PHP bytecode Compiler
- Introduction
- Installing/Configuring
- Predefined Constants
- bcompiler Functions
- bcompiler_load_exe — Reads and creates classes from a bcompiler exe file
- bcompiler_load — Reads and creates classes from a bz compressed file
- bcompiler_parse_class — Reads the bytecodes of a class and calls back to a user function
- bcompiler_read — Reads and creates classes from a filehandle
- bcompiler_write_class — Writes a defined class as bytecodes
- bcompiler_write_constant — Writes a defined constant as bytecodes
- bcompiler_write_exe_footer — Writes the start pos, and sig to the end of a exe type file
- bcompiler_write_file — Writes a php source file as bytecodes
- bcompiler_write_footer — Writes the single character \x00 to indicate End of compiled data
- bcompiler_write_function — Writes a defined function as bytecodes
- bcompiler_write_functions_from_file — Writes all functions defined in a file as bytecodes
- bcompiler_write_header — Writes the bcompiler header
- bcompiler_write_included_filename — Writes an included file as bytecodes
rustushki ¶
2 years ago
geoff at spacevs dot com ¶
3 years ago
static vars on classes do not work with bcompiler, eg.
<?PHP
class testClass {
static public $i;
static public function testStatic() {
echo "static\n";
testClass::$i = new testClass();
}
public function __construct() {
echo "construct\n";
}
public function testOut() {
echo "testOut\n";
}
}
testClass::testStatic();
testClass::$i->testOut();
?>
the call to "testOut" will silently fail.
