Skip to content

Commit

Permalink
#2255 - Fix zephir_require_ret() C function in PHP8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Sep 11, 2021
1 parent f1d67f9 commit 425702e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernels/ZendEngine3/require.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path)
#endif

#if PHP_VERSION_ID >= 80100
zend_string *zend_string_path = zend_string_init(require_path, strlen(require_path), 0);

zend_stream_init_filename_ex(&file_handle, zend_string_path);
ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);

zval_ptr_dtor(zend_string_path);
#else
ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);
#endif
Expand All @@ -56,7 +61,6 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path)

new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
if (new_op_array) {

if (file_handle.handle.stream.handle) {
ZVAL_NULL(&dummy);
if (!file_handle.opened_path) {
Expand Down

0 comments on commit 425702e

Please sign in to comment.