Skip to content

Commit

Permalink
Update for PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
myfluxi committed Dec 11, 2022
1 parent 2c5d484 commit a6c229b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ext/kernel/fcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,10 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context)
CG(compiler_options) = ZEND_COMPILE_DEFAULT_FOR_EVAL;
#if PHP_VERSION_ID < 80000
new_op_array = zend_compile_string(str, context);
#else
#elif PHP_VERSION_ID < 80200
new_op_array = zend_compile_string(Z_STR_P(str), context);
#else
new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
#endif
CG(compiler_options) = original_compiler_options;

Expand Down
6 changes: 5 additions & 1 deletion ext/kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ void zephir_get_arg(zval *return_value, zend_long idx)
}

arg_count = ZEND_CALL_NUM_ARGS(ex);
if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
#if PHP_VERSION_ID >= 80200
if (get_active_function_or_method_name() == FAILURE) {
#else
if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
#endif
RETURN_FALSE;
}

Expand Down
8 changes: 8 additions & 0 deletions ext/kernel/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include <ext/standard/php_string.h>
#include <ext/standard/php_math.h>
#include <ext/standard/php_rand.h>
#if PHP_VERSION_ID >= 80200
#include <ext/random/php_random.h>
#include <ext/standard/basic_functions.h>
#endif

#include "php_ext.h"
#include "kernel/main.h"
Expand Down Expand Up @@ -188,7 +192,11 @@ zend_long zephir_mt_rand(zend_long min, zend_long max)
return 0;
}

#if PHP_VERSION_ID < 80200
if (!BG(mt_rand_is_seeded)) {
#else
if (!RANDOM_G(mt19937_seeded)) {
#endif
php_mt_srand(GENERATE_SEED());
}

Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<required>
<php>
<min>7.4.0</min>
<max>8.1.99</max>
<max>8.2.99</max>
</php>
<pearinstaller>
<min>1.4.0</min>
Expand Down

0 comments on commit a6c229b

Please sign in to comment.