Skip to content

Commit

Permalink
Fix bug #5347 (#5359)
Browse files Browse the repository at this point in the history
* fix bug #5347

* skip ci

* optimize

* remove useless files

---------

Co-authored-by: MARiA so cute <[email protected]>
  • Loading branch information
matyhtf and NathanFreeman authored Jun 6, 2024
1 parent 8b80b4f commit 89d87cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 652 deletions.
3 changes: 1 addition & 2 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,7 @@ EOF
thirdparty/php/sockets/conversions.cc \
thirdparty/php/sockets/sockaddr_conv.cc \
thirdparty/php/standard/var_decoder.cc \
thirdparty/php/standard/proc_open.cc \
thirdparty/php83/Zend/zend_call_stack.cc"
thirdparty/php/standard/proc_open.cc"

swoole_source_file="$swoole_source_file \
thirdparty/swoole_http_parser.c \
Expand Down
23 changes: 8 additions & 15 deletions ext-src/php_swoole_call_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@
#include "php_swoole.h"

#ifdef ZEND_CHECK_STACK_LIMIT
#include "thirdparty/php83/Zend/zend_call_stack.h"
#endif

#ifdef ZEND_CHECK_STACK_LIMIT
#define HOOK_PHP_CALL_STACK(exp) \
zend_call_stack __stack; \
zend_call_stack_get(&__stack); \
auto __stack_base = EG(stack_base); \
auto __stack_limit = EG(stack_limit); \
EG(stack_base) = __stack.base; \
EG(stack_limit) = zend_call_stack_limit(__stack.base, __stack.max_size, EG(reserved_stack_size)); \
exp \
EG(stack_base) = __stack_base; \
EG(stack_limit) = __stack_limit;
#define HOOK_PHP_CALL_STACK(callback) \
auto __stack_limit = EG(stack_limit); \
auto __stack_base = EG(stack_base); \
EG(stack_base) = (void *) 0; \
EG(stack_limit) = (void *) 0; \
callback EG(stack_limit) = __stack_limit; \
EG(stack_base) = __stack_base;
#else
#define HOOK_PHP_CALL_STACK(exp) exp
#define HOOK_PHP_CALL_STACK(callback) callback
#endif
Loading

0 comments on commit 89d87cc

Please sign in to comment.