diff options
Diffstat (limited to 'src/sp_execute.c')
| -rw-r--r-- | src/sp_execute.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/sp_execute.c b/src/sp_execute.c index f1ed8d0..b81f408 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c | |||
| @@ -286,6 +286,34 @@ static zend_result sp_stream_open(zend_file_handle *handle) { | |||
| 286 | 286 | ||
| 287 | #endif | 287 | #endif |
| 288 | 288 | ||
| 289 | ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, | ||
| 290 | int type) = NULL; | ||
| 291 | #if PHP_VERSION_ID >= 80000 | ||
| 292 | ZEND_API zend_op_array* (*orig_zend_compile_string)( | ||
| 293 | zend_string* source_string, const char* filename) = NULL; | ||
| 294 | #else | ||
| 295 | ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, | ||
| 296 | char* filename) = NULL; | ||
| 297 | #endif | ||
| 298 | |||
| 299 | #if PHP_VERSION_ID >= 80000 | ||
| 300 | ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, | ||
| 301 | const char* filename) { | ||
| 302 | #else | ||
| 303 | ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { | ||
| 304 | #endif | ||
| 305 | zend_op_array* opline = orig_zend_compile_string(source_string, filename); | ||
| 306 | sp_sloppy_modify_opcode(opline); | ||
| 307 | return opline; | ||
| 308 | } | ||
| 309 | |||
| 310 | ZEND_API zend_op_array* sp_compile_file(zend_file_handle* file_handle, | ||
| 311 | int type) { | ||
| 312 | zend_op_array* opline = orig_zend_compile_file(file_handle, type); | ||
| 313 | sp_sloppy_modify_opcode(opline); | ||
| 314 | return opline; | ||
| 315 | } | ||
| 316 | |||
| 289 | int hook_execute(void) { | 317 | int hook_execute(void) { |
| 290 | TSRMLS_FETCH(); | 318 | TSRMLS_FETCH(); |
| 291 | 319 | ||
| @@ -309,5 +337,16 @@ int hook_execute(void) { | |||
| 309 | } | 337 | } |
| 310 | } | 338 | } |
| 311 | 339 | ||
| 340 | if (NULL == orig_zend_compile_file && zend_compile_file != sp_compile_file) { | ||
| 341 | orig_zend_compile_file = zend_compile_file; | ||
| 342 | zend_compile_file = sp_compile_file; | ||
| 343 | } | ||
| 344 | |||
| 345 | if (NULL == orig_zend_compile_string && | ||
| 346 | zend_compile_string != sp_compile_string) { | ||
| 347 | orig_zend_compile_string = zend_compile_string; | ||
| 348 | zend_compile_string = sp_compile_string; | ||
| 349 | } | ||
| 350 | |||
| 312 | return SUCCESS; | 351 | return SUCCESS; |
| 313 | } | 352 | } |
