Skip to content

Commit f933cf5

Browse files
committed
remove interned strings optimization causing exhaustive memory usage
fixes #153 and possibly fixes #147
1 parent dc0e1ec commit f933cf5

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

msgpack_unpack.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
#if PHP_VERSION_ID < 70400
1313
# define zval_try_get_string zval_get_string
1414
#endif
15-
#if PHP_VERSION_ID < 70200
16-
# define zend_string_init_interned zend_string_init
17-
#endif
1815

1916
typedef struct {
2017
zend_long used_slots;
@@ -523,12 +520,7 @@ int msgpack_unserialize_str(msgpack_unserialize_data *unpack, const char* base,
523520
ZVAL_EMPTY_STRING(*obj);
524521
} else {
525522
/* TODO: check malformed input? */
526-
if (len < 1<<8) {
527-
zend_string *zs = zend_string_init_interned(data, len, 0);
528-
ZVAL_STR(*obj, zs);
529-
} else {
530-
ZVAL_STRINGL(*obj, data, len);
531-
}
523+
ZVAL_STRINGL(*obj, data, len);
532524
}
533525

534526
return 0;

0 commit comments

Comments
 (0)