summaryrefslogtreecommitdiff
path: root/ext/standard/basic_functions.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-08-27 12:24:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-08-27 12:24:58 +0200
commitce83ec87909331e9a643e4e81c33524c0994641f (patch)
tree489bba609ede7cb5af5105a574d7b3dd54f87565 /ext/standard/basic_functions.h
parent0026d8a7838914296c0d7e99ddc639c84e6ebb8a (diff)
downloadphp-git-ce83ec87909331e9a643e4e81c33524c0994641f.tar.gz
Clean up strtok implementation
Store the zend_string instead of performing a copy and storing in a zval. Also make sure the string is released immediately if it's no longer needed. Finally, avoid null pointer offset UB if no string has been set -- though I'm wondering if this case shouldn't be generating a warning?
Diffstat (limited to 'ext/standard/basic_functions.h')
-rw-r--r--ext/standard/basic_functions.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 00727668dc..52db18ce85 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -60,8 +60,7 @@ typedef int32_t php_int32;
typedef struct _php_basic_globals {
HashTable *user_shutdown_function_names;
HashTable putenv_ht;
- zval strtok_zval;
- char *strtok_string;
+ zend_string *strtok_string;
zend_string *ctype_string; /* current LC_CTYPE locale (or NULL for 'C') */
zend_bool locale_changed; /* locale was changed and has to be restored */
char *strtok_last;