Skip to content

Instantly share code, notes, and snippets.

@laruence
Created June 15, 2018 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/a8bd0b629ecdcf6fdafffe0528a5517e to your computer and use it in GitHub Desktop.
Save laruence/a8bd0b629ecdcf6fdafffe0528a5517e to your computer and use it in GitHub Desktop.
diff --git a/ext/opcache/Optimizer/zend_call_graph.c b/ext/opcache/Optimizer/zend_call_graph.c
index 886a793..a0ea479 100644
--- a/ext/opcache/Optimizer/zend_call_graph.c
+++ b/ext/opcache/Optimizer/zend_call_graph.c
@@ -155,6 +155,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
case ZEND_SEND_REF:
case ZEND_SEND_VAR_NO_REF:
case ZEND_SEND_VAR_NO_REF_EX:
+ case ZEND_SEND_USER:
if (call_info) {
uint32_t num = opline->op2.num;
@@ -165,9 +166,11 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
}
break;
case ZEND_SEND_ARRAY:
- case ZEND_SEND_USER:
case ZEND_SEND_UNPACK:
/* TODO: set info about var_arg call ??? */
+ if (call_info) {
+ call_info->num_args = -1;
+ }
break;
}
opline++;
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 19b8e51..b32a954 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
-/* $Id:$ */
-
#include "php.h"
#include "zend_compile.h"
#include "zend_extensions.h"
@@ -79,9 +77,11 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa
tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
}
return tmp;
- } else {
+ } else if (call_info->num_args != -1) {
/* warning, and returns NULL */
return FUNC_MAY_WARN | MAY_BE_NULL;
+ } else {
+ return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
}
}
@@ -90,9 +90,11 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa
if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args &&
call_info->num_args == 1) {
return MAY_BE_RC1 | MAY_BE_STRING;
- } else {
+ } else if (call_info->num_args != -1) {
/* warning, and returns NULL */
return FUNC_MAY_WARN | MAY_BE_NULL;
+ } else {
+ return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment