/* Copyright 2025 Sebastian Peters The _raw mode is for loading via php extension, it skips the linking of libphp.so - this is necessary because we dont want to have symbol conflicts in FPM/CLI/CGI */ #include #include #include "../opcodes/src/pwphpbytecode_opcodes.h" #include "Zend/zend_exceptions.h" #include #include "pwphpbytecode.h" extern void pwphpbytecode_load_compiled_chararr(char* debugname, unsigned char *chararr, int charlen, bool verbose, bool with_jit){ pw_main_opcache_load_compiled_chararr(chararr, charlen, verbose, with_jit); } // Additional check, because in FPM mode, we could have multiple requests in one process life - so its possible that while library .so is loaded, the class dissappears on next .php-request extern bool pwphpbytecode_is_raw_loaded(char *classname){ char zend_execute_str[256]=""; sprintf(zend_execute_str, "isset($_PWPHPBYTECODE_CLASS_LOADED[\"%s\"]);",classname); zval retval; zend_eval_string(zend_execute_str, &retval, "pwphpbytecode_is_raw_loaded"); if (Z_TYPE(retval) == IS_TRUE) { return true; } return false; } extern void pwphpbytecode_set_raw_loaded(char *classname){ char zend_execute_str[256]=""; sprintf(zend_execute_str, "$_PWPHPBYTECODE_CLASS_LOADED[\"%s\"]=true;",classname); zend_eval_string(zend_execute_str, NULL, "pwphpbytecode_set_raw_loaded"); } extern bool pwphpbytecode_check_if_in_raw_mode(){ return true; }