Skip to content

Commit 77fea0e

Browse files
Fixed potention crashes when __invoke() was called on PHP 8.3 and up, because the zend_internal_function structure was not correctly initialized
1 parent a12556d commit 77fea0e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ INSTALL_LIB = ${INSTALL_PREFIX}/lib
5050
#
5151

5252
SONAME = 2.4
53-
VERSION = 2.4.10
53+
VERSION = 2.4.11
5454

5555

5656
#

zend/classimpl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ zend_function *ClassImpl::getMethod(zend_object **object, zend_string *method, c
225225
auto *data = (CallData *)emalloc(sizeof(CallData));
226226
auto *function = &data->func;
227227

228+
// reset everything to zero (in case future PHP versions add more fields)
229+
memset(function, 0, sizeof(*function));
230+
228231
// set all properties
229232
function->type = ZEND_INTERNAL_FUNCTION;
230233
function->arg_flags[0] = 0;
@@ -269,6 +272,9 @@ zend_function *ClassImpl::getStaticMethod(zend_class_entry *entry, zend_string *
269272
auto *data = (CallData *)emalloc(sizeof(CallData));
270273
auto *function = &data->func;
271274

275+
// reset everything to zero (in case future PHP versions add more fields)
276+
memset(function, 0, sizeof(*function));
277+
272278
// set all properties for the function
273279
function->type = ZEND_INTERNAL_FUNCTION;
274280
function->arg_flags[0] = 0;
@@ -319,6 +325,9 @@ zend_result ClassImpl::getClosure(ZEND_OBJECT_OR_ZVAL object, zend_class_entry *
319325
auto *data = (CallData *)emalloc(sizeof(CallData));
320326
auto *function = &data->func;
321327

328+
// reset everything to zero (in case future PHP versions add more fields)
329+
memset(function, 0, sizeof(*function));
330+
322331
// we're going to set all properties of the zend_internal_function struct
323332
function->type = ZEND_INTERNAL_FUNCTION;
324333
function->arg_flags[0] = 0;

0 commit comments

Comments
 (0)