@@ -797,8 +797,9 @@ static inline int ct_eval_array_key_exists(zval *result, zval *op1, zval *op2) {
797
797
}
798
798
799
799
static bool can_ct_eval_func_call (zend_string * name , uint32_t num_args , zval * * args ) {
800
- /* Functions that can be evaluated independently of what the arguments are.
801
- * It's okay if these functions throw on invalid arguments, but they should not warn. */
800
+ /* Functions in this list must always produce the same result for the same arguments,
801
+ * and have no dependence on global state (such as locales). It is okay if they throw
802
+ * or warn on invalid arguments, as we detect this and will discard the evaluation result. */
802
803
if (false
803
804
|| zend_string_equals_literal (name , "array_diff" )
804
805
|| zend_string_equals_literal (name , "array_diff_assoc" )
@@ -811,6 +812,7 @@ static bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zval **a
811
812
|| zend_string_equals_literal (name , "array_merge_recursive" )
812
813
|| zend_string_equals_literal (name , "array_replace" )
813
814
|| zend_string_equals_literal (name , "array_replace_recursive" )
815
+ || zend_string_equals_literal (name , "array_unique" )
814
816
|| zend_string_equals_literal (name , "array_values" )
815
817
|| zend_string_equals_literal (name , "base64_decode" )
816
818
|| zend_string_equals_literal (name , "base64_encode" )
@@ -834,6 +836,7 @@ static bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zval **a
834
836
|| zend_string_equals_literal (name , "serialize" )
835
837
|| zend_string_equals_literal (name , "str_contains" )
836
838
|| zend_string_equals_literal (name , "str_ends_with" )
839
+ || zend_string_equals_literal (name , "str_replace" )
837
840
|| zend_string_equals_literal (name , "str_split" )
838
841
|| zend_string_equals_literal (name , "str_starts_with" )
839
842
|| zend_string_equals_literal (name , "strpos" )
0 commit comments