Skip to content

Commit 4e72cb3

Browse files
authored
Merge pull request #185 from andypost/php86
fix build with PHP 8.6: unserialize_callback_func is a zend_string
2 parents e0a6616 + cf19b26 commit 4e72cb3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

msgpack_unpack.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,25 @@ static zend_class_entry* msgpack_unserialize_class(zval **container, zend_string
276276
}
277277

278278
/* Check for unserialize callback */
279+
#if PHP_VERSION_ID >= 80600
280+
/* php 8.6 turned the unserialize_callback_func global into a zend_string* */
281+
if ((PG(unserialize_callback_func) == NULL) ||
282+
(ZSTR_LEN(PG(unserialize_callback_func)) == 0)) {
283+
#else
279284
if ((PG(unserialize_callback_func) == NULL) ||
280285
(PG(unserialize_callback_func)[0] == '\0')) {
286+
#endif
281287
incomplete_class = 1;
282288
ce = PHP_IC_ENTRY;
283289
break;
284290
}
285291

286292
/* Call unserialize callback */
293+
#if PHP_VERSION_ID >= 80600
294+
ZVAL_STR(&user_func, zend_string_dup(PG(unserialize_callback_func), false));
295+
#else
287296
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
297+
#endif
288298
ZVAL_STR(&args[0], class_name);
289299

290300
func_call_status = call_user_function(CG(function_table), NULL, &user_func, &retval, 1, args);

0 commit comments

Comments
 (0)