1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 2.00 of the Zend license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.zend.com/license/2_00.txt. |
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Authors: Dmitry Stogov <dmitry@php.net> |
16 +----------------------------------------------------------------------+
17 */
18
19 #ifndef ZEND_STRING_H
20 #define ZEND_STRING_H
21
22 #include "zend.h"
23
24 BEGIN_EXTERN_C()
25
26 typedef void (*zend_string_copy_storage_func_t)(void);
27 typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str);
28 typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, bool permanent);
29
30 ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string;
31 ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned;
32
33 ZEND_API zend_ulong ZEND_FASTCALL zend_string_hash_func(zend_string *str);
34 ZEND_API zend_ulong ZEND_FASTCALL zend_hash_func(const char *str, size_t len);
35 ZEND_API zend_string* ZEND_FASTCALL zend_interned_string_find_permanent(zend_string *str);
36
37 ZEND_API zend_string *zend_string_concat2(
38 const char *str1, size_t str1_len,
39 const char *str2, size_t str2_len);
40 ZEND_API zend_string *zend_string_concat3(
41 const char *str1, size_t str1_len,
42 const char *str2, size_t str2_len,
43 const char *str3, size_t str3_len);
44
45 ZEND_API void zend_interned_strings_init(void);
46 ZEND_API void zend_interned_strings_dtor(void);
47 ZEND_API void zend_interned_strings_activate(void);
48 ZEND_API void zend_interned_strings_deactivate(void);
49 ZEND_API void zend_interned_strings_set_request_storage_handlers(zend_new_interned_string_func_t handler, zend_string_init_interned_func_t init_handler);
50 ZEND_API void zend_interned_strings_switch_storage(zend_bool request);
51
52 ZEND_API extern zend_string *zend_empty_string;
53 ZEND_API extern zend_string *zend_one_char_string[256];
54 ZEND_API extern zend_string **zend_known_strings;
55
END_EXTERN_C()56 END_EXTERN_C()
57
58 /* Shortcuts */
59
60 #define ZSTR_VAL(zstr) (zstr)->val
61 #define ZSTR_LEN(zstr) (zstr)->len
62 #define ZSTR_H(zstr) (zstr)->h
63 #define ZSTR_HASH(zstr) zend_string_hash_val(zstr)
64
65 /* Compatibility macros */
66
67 #define IS_INTERNED(s) ZSTR_IS_INTERNED(s)
68 #define STR_EMPTY_ALLOC() ZSTR_EMPTY_ALLOC()
69 #define _STR_HEADER_SIZE _ZSTR_HEADER_SIZE
70 #define STR_ALLOCA_ALLOC(str, _len, use_heap) ZSTR_ALLOCA_ALLOC(str, _len, use_heap)
71 #define STR_ALLOCA_INIT(str, s, len, use_heap) ZSTR_ALLOCA_INIT(str, s, len, use_heap)
72 #define STR_ALLOCA_FREE(str, use_heap) ZSTR_ALLOCA_FREE(str, use_heap)
73
74 /*---*/
75
76 #define ZSTR_IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED)
77
78 #define ZSTR_EMPTY_ALLOC() zend_empty_string
79 #define ZSTR_CHAR(c) zend_one_char_string[c]
80 #define ZSTR_KNOWN(idx) zend_known_strings[idx]
81
82 #define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val)
83
84 #define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1)
85
86 #define ZSTR_MAX_OVERHEAD (ZEND_MM_ALIGNED_SIZE(_ZSTR_HEADER_SIZE + 1))
87 #define ZSTR_MAX_LEN (SIZE_MAX - ZSTR_MAX_OVERHEAD)
88
89 #define ZSTR_ALLOCA_ALLOC(str, _len, use_heap) do { \
90 (str) = (zend_string *)do_alloca(ZEND_MM_ALIGNED_SIZE_EX(_ZSTR_STRUCT_SIZE(_len), 8), (use_heap)); \
91 GC_SET_REFCOUNT(str, 1); \
92 GC_TYPE_INFO(str) = GC_STRING; \
93 ZSTR_H(str) = 0; \
94 ZSTR_LEN(str) = _len; \
95 } while (0)
96
97 #define ZSTR_ALLOCA_INIT(str, s, len, use_heap) do { \
98 ZSTR_ALLOCA_ALLOC(str, len, use_heap); \
99 memcpy(ZSTR_VAL(str), (s), (len)); \
100 ZSTR_VAL(str)[(len)] = '\0'; \
101 } while (0)
102
103 #define ZSTR_ALLOCA_FREE(str, use_heap) free_alloca(str, use_heap)
104
105 /*---*/
106
107 static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s)
108 {
109 return ZSTR_H(s) ? ZSTR_H(s) : zend_string_hash_func(s);
110 }
111
zend_string_forget_hash_val(zend_string * s)112 static zend_always_inline void zend_string_forget_hash_val(zend_string *s)
113 {
114 ZSTR_H(s) = 0;
115 GC_DEL_FLAGS(s, IS_STR_VALID_UTF8);
116 }
117
zend_string_refcount(const zend_string * s)118 static zend_always_inline uint32_t zend_string_refcount(const zend_string *s)
119 {
120 if (!ZSTR_IS_INTERNED(s)) {
121 return GC_REFCOUNT(s);
122 }
123 return 1;
124 }
125
zend_string_addref(zend_string * s)126 static zend_always_inline uint32_t zend_string_addref(zend_string *s)
127 {
128 if (!ZSTR_IS_INTERNED(s)) {
129 return GC_ADDREF(s);
130 }
131 return 1;
132 }
133
zend_string_delref(zend_string * s)134 static zend_always_inline uint32_t zend_string_delref(zend_string *s)
135 {
136 if (!ZSTR_IS_INTERNED(s)) {
137 return GC_DELREF(s);
138 }
139 return 1;
140 }
141
zend_string_alloc(size_t len,bool persistent)142 static zend_always_inline zend_string *zend_string_alloc(size_t len, bool persistent)
143 {
144 zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
145
146 GC_SET_REFCOUNT(ret, 1);
147 GC_TYPE_INFO(ret) = GC_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << GC_FLAGS_SHIFT);
148 ZSTR_H(ret) = 0;
149 ZSTR_LEN(ret) = len;
150 return ret;
151 }
152
zend_string_safe_alloc(size_t n,size_t m,size_t l,bool persistent)153 static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, bool persistent)
154 {
155 zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
156
157 GC_SET_REFCOUNT(ret, 1);
158 GC_TYPE_INFO(ret) = GC_STRING | ((persistent ? IS_STR_PERSISTENT : 0) << GC_FLAGS_SHIFT);
159 ZSTR_H(ret) = 0;
160 ZSTR_LEN(ret) = (n * m) + l;
161 return ret;
162 }
163
zend_string_init(const char * str,size_t len,bool persistent)164 static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, bool persistent)
165 {
166 zend_string *ret = zend_string_alloc(len, persistent);
167
168 memcpy(ZSTR_VAL(ret), str, len);
169 ZSTR_VAL(ret)[len] = '\0';
170 return ret;
171 }
172
zend_string_init_fast(const char * str,size_t len)173 static zend_always_inline zend_string *zend_string_init_fast(const char *str, size_t len)
174 {
175 if (len > 1) {
176 return zend_string_init(str, len, 0);
177 } else if (len == 0) {
178 return zend_empty_string;
179 } else /* if (len == 1) */ {
180 return ZSTR_CHAR((zend_uchar) *str);
181 }
182 }
183
zend_string_copy(zend_string * s)184 static zend_always_inline zend_string *zend_string_copy(zend_string *s)
185 {
186 if (!ZSTR_IS_INTERNED(s)) {
187 GC_ADDREF(s);
188 }
189 return s;
190 }
191
zend_string_dup(zend_string * s,bool persistent)192 static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool persistent)
193 {
194 if (ZSTR_IS_INTERNED(s)) {
195 return s;
196 } else {
197 return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
198 }
199 }
200
zend_string_separate(zend_string * s,bool persistent)201 static zend_always_inline zend_string *zend_string_separate(zend_string *s, bool persistent)
202 {
203 if (ZSTR_IS_INTERNED(s) || GC_REFCOUNT(s) > 1) {
204 if (!ZSTR_IS_INTERNED(s)) {
205 GC_DELREF(s);
206 }
207 return zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent);
208 }
209
210 zend_string_forget_hash_val(s);
211 return s;
212 }
213
zend_string_realloc(zend_string * s,size_t len,bool persistent)214 static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, bool persistent)
215 {
216 zend_string *ret;
217
218 if (!ZSTR_IS_INTERNED(s)) {
219 if (EXPECTED(GC_REFCOUNT(s) == 1)) {
220 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
221 ZSTR_LEN(ret) = len;
222 zend_string_forget_hash_val(ret);
223 return ret;
224 }
225 }
226 ret = zend_string_alloc(len, persistent);
227 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1);
228 if (!ZSTR_IS_INTERNED(s)) {
229 GC_DELREF(s);
230 }
231 return ret;
232 }
233
zend_string_extend(zend_string * s,size_t len,bool persistent)234 static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, bool persistent)
235 {
236 zend_string *ret;
237
238 ZEND_ASSERT(len >= ZSTR_LEN(s));
239 if (!ZSTR_IS_INTERNED(s)) {
240 if (EXPECTED(GC_REFCOUNT(s) == 1)) {
241 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
242 ZSTR_LEN(ret) = len;
243 zend_string_forget_hash_val(ret);
244 return ret;
245 }
246 }
247 ret = zend_string_alloc(len, persistent);
248 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1);
249 if (!ZSTR_IS_INTERNED(s)) {
250 GC_DELREF(s);
251 }
252 return ret;
253 }
254
zend_string_truncate(zend_string * s,size_t len,bool persistent)255 static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, bool persistent)
256 {
257 zend_string *ret;
258
259 ZEND_ASSERT(len <= ZSTR_LEN(s));
260 if (!ZSTR_IS_INTERNED(s)) {
261 if (EXPECTED(GC_REFCOUNT(s) == 1)) {
262 ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
263 ZSTR_LEN(ret) = len;
264 zend_string_forget_hash_val(ret);
265 return ret;
266 }
267 }
268 ret = zend_string_alloc(len, persistent);
269 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1);
270 if (!ZSTR_IS_INTERNED(s)) {
271 GC_DELREF(s);
272 }
273 return ret;
274 }
275
zend_string_safe_realloc(zend_string * s,size_t n,size_t m,size_t l,bool persistent)276 static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, bool persistent)
277 {
278 zend_string *ret;
279
280 if (!ZSTR_IS_INTERNED(s)) {
281 if (GC_REFCOUNT(s) == 1) {
282 ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
283 ZSTR_LEN(ret) = (n * m) + l;
284 zend_string_forget_hash_val(ret);
285 return ret;
286 }
287 }
288 ret = zend_string_safe_alloc(n, m, l, persistent);
289 memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1);
290 if (!ZSTR_IS_INTERNED(s)) {
291 GC_DELREF(s);
292 }
293 return ret;
294 }
295
zend_string_free(zend_string * s)296 static zend_always_inline void zend_string_free(zend_string *s)
297 {
298 if (!ZSTR_IS_INTERNED(s)) {
299 ZEND_ASSERT(GC_REFCOUNT(s) <= 1);
300 pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
301 }
302 }
303
zend_string_efree(zend_string * s)304 static zend_always_inline void zend_string_efree(zend_string *s)
305 {
306 ZEND_ASSERT(!ZSTR_IS_INTERNED(s));
307 ZEND_ASSERT(GC_REFCOUNT(s) <= 1);
308 ZEND_ASSERT(!(GC_FLAGS(s) & IS_STR_PERSISTENT));
309 efree(s);
310 }
311
zend_string_release(zend_string * s)312 static zend_always_inline void zend_string_release(zend_string *s)
313 {
314 if (!ZSTR_IS_INTERNED(s)) {
315 if (GC_DELREF(s) == 0) {
316 pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT);
317 }
318 }
319 }
320
zend_string_release_ex(zend_string * s,bool persistent)321 static zend_always_inline void zend_string_release_ex(zend_string *s, bool persistent)
322 {
323 if (!ZSTR_IS_INTERNED(s)) {
324 if (GC_DELREF(s) == 0) {
325 if (persistent) {
326 ZEND_ASSERT(GC_FLAGS(s) & IS_STR_PERSISTENT);
327 free(s);
328 } else {
329 ZEND_ASSERT(!(GC_FLAGS(s) & IS_STR_PERSISTENT));
330 efree(s);
331 }
332 }
333 }
334 }
335
336 #if defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
337 BEGIN_EXTERN_C()
338 ZEND_API zend_bool ZEND_FASTCALL zend_string_equal_val(zend_string *s1, zend_string *s2);
END_EXTERN_C()339 END_EXTERN_C()
340 #else
341 static zend_always_inline zend_bool zend_string_equal_val(zend_string *s1, zend_string *s2)
342 {
343 return !memcmp(ZSTR_VAL(s1), ZSTR_VAL(s2), ZSTR_LEN(s1));
344 }
345 #endif
346
347 static zend_always_inline zend_bool zend_string_equal_content(zend_string *s1, zend_string *s2)
348 {
349 return ZSTR_LEN(s1) == ZSTR_LEN(s2) && zend_string_equal_val(s1, s2);
350 }
351
zend_string_equals(zend_string * s1,zend_string * s2)352 static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_string *s2)
353 {
354 return s1 == s2 || zend_string_equal_content(s1, s2);
355 }
356
357 #define zend_string_equals_ci(s1, s2) \
358 (ZSTR_LEN(s1) == ZSTR_LEN(s2) && !zend_binary_strcasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2)))
359
360 #define zend_string_equals_literal_ci(str, c) \
361 (ZSTR_LEN(str) == sizeof(c) - 1 && !zend_binary_strcasecmp(ZSTR_VAL(str), ZSTR_LEN(str), (c), sizeof(c) - 1))
362
363 #define zend_string_equals_literal(str, literal) \
364 (ZSTR_LEN(str) == sizeof(literal)-1 && !memcmp(ZSTR_VAL(str), literal, sizeof(literal) - 1))
365
366 /*
367 * DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
368 *
369 * This is Daniel J. Bernstein's popular `times 33' hash function as
370 * posted by him years ago on comp.lang.c. It basically uses a function
371 * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best
372 * known hash functions for strings. Because it is both computed very
373 * fast and distributes very well.
374 *
375 * The magic of number 33, i.e. why it works better than many other
376 * constants, prime or not, has never been adequately explained by
377 * anyone. So I try an explanation: if one experimentally tests all
378 * multipliers between 1 and 256 (as RSE did now) one detects that even
379 * numbers are not usable at all. The remaining 128 odd numbers
380 * (except for the number 1) work more or less all equally well. They
381 * all distribute in an acceptable way and this way fill a hash table
382 * with an average percent of approx. 86%.
383 *
384 * If one compares the Chi^2 values of the variants, the number 33 not
385 * even has the best value. But the number 33 and a few other equally
386 * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great
387 * advantage to the remaining numbers in the large set of possible
388 * multipliers: their multiply operation can be replaced by a faster
389 * operation based on just one shift plus either a single addition
390 * or subtraction operation. And because a hash function has to both
391 * distribute good _and_ has to be very fast to compute, those few
392 * numbers should be preferred and seems to be the reason why Daniel J.
393 * Bernstein also preferred it.
394 *
395 *
396 * -- Ralf S. Engelschall <rse@engelschall.com>
397 */
398
zend_inline_hash_func(const char * str,size_t len)399 static zend_always_inline zend_ulong zend_inline_hash_func(const char *str, size_t len)
400 {
401 zend_ulong hash = Z_UL(5381);
402
403 #if defined(_WIN32) || defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
404 /* Version with multiplication works better on modern CPU */
405 for (; len >= 8; len -= 8, str += 8) {
406 # if defined(__aarch64__) && !defined(WORDS_BIGENDIAN)
407 /* On some architectures it is beneficial to load 8 bytes at a
408 time and extract each byte with a bit field extract instr. */
409 uint64_t chunk;
410
411 memcpy(&chunk, str, sizeof(chunk));
412 hash =
413 hash * 33 * 33 * 33 * 33 +
414 ((chunk >> (8 * 0)) & 0xff) * 33 * 33 * 33 +
415 ((chunk >> (8 * 1)) & 0xff) * 33 * 33 +
416 ((chunk >> (8 * 2)) & 0xff) * 33 +
417 ((chunk >> (8 * 3)) & 0xff);
418 hash =
419 hash * 33 * 33 * 33 * 33 +
420 ((chunk >> (8 * 4)) & 0xff) * 33 * 33 * 33 +
421 ((chunk >> (8 * 5)) & 0xff) * 33 * 33 +
422 ((chunk >> (8 * 6)) & 0xff) * 33 +
423 ((chunk >> (8 * 7)) & 0xff);
424 # else
425 hash =
426 hash * 33 * 33 * 33 * 33 +
427 str[0] * 33 * 33 * 33 +
428 str[1] * 33 * 33 +
429 str[2] * 33 +
430 str[3];
431 hash =
432 hash * 33 * 33 * 33 * 33 +
433 str[4] * 33 * 33 * 33 +
434 str[5] * 33 * 33 +
435 str[6] * 33 +
436 str[7];
437 # endif
438 }
439 if (len >= 4) {
440 hash =
441 hash * 33 * 33 * 33 * 33 +
442 str[0] * 33 * 33 * 33 +
443 str[1] * 33 * 33 +
444 str[2] * 33 +
445 str[3];
446 len -= 4;
447 str += 4;
448 }
449 if (len >= 2) {
450 if (len > 2) {
451 hash =
452 hash * 33 * 33 * 33 +
453 str[0] * 33 * 33 +
454 str[1] * 33 +
455 str[2];
456 } else {
457 hash =
458 hash * 33 * 33 +
459 str[0] * 33 +
460 str[1];
461 }
462 } else if (len != 0) {
463 hash = hash * 33 + *str;
464 }
465 #else
466 /* variant with the hash unrolled eight times */
467 for (; len >= 8; len -= 8) {
468 hash = ((hash << 5) + hash) + *str++;
469 hash = ((hash << 5) + hash) + *str++;
470 hash = ((hash << 5) + hash) + *str++;
471 hash = ((hash << 5) + hash) + *str++;
472 hash = ((hash << 5) + hash) + *str++;
473 hash = ((hash << 5) + hash) + *str++;
474 hash = ((hash << 5) + hash) + *str++;
475 hash = ((hash << 5) + hash) + *str++;
476 }
477 switch (len) {
478 case 7: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
479 case 6: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
480 case 5: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
481 case 4: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
482 case 3: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
483 case 2: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
484 case 1: hash = ((hash << 5) + hash) + *str++; break;
485 case 0: break;
486 EMPTY_SWITCH_DEFAULT_CASE()
487 }
488 #endif
489
490 /* Hash value can't be zero, so we always set the high bit */
491 #if SIZEOF_ZEND_LONG == 8
492 return hash | Z_UL(0x8000000000000000);
493 #elif SIZEOF_ZEND_LONG == 4
494 return hash | Z_UL(0x80000000);
495 #else
496 # error "Unknown SIZEOF_ZEND_LONG"
497 #endif
498 }
499
500 #define ZEND_KNOWN_STRINGS(_) \
501 _(ZEND_STR_FILE, "file") \
502 _(ZEND_STR_LINE, "line") \
503 _(ZEND_STR_FUNCTION, "function") \
504 _(ZEND_STR_CLASS, "class") \
505 _(ZEND_STR_OBJECT, "object") \
506 _(ZEND_STR_TYPE, "type") \
507 _(ZEND_STR_OBJECT_OPERATOR, "->") \
508 _(ZEND_STR_PAAMAYIM_NEKUDOTAYIM, "::") \
509 _(ZEND_STR_ARGS, "args") \
510 _(ZEND_STR_UNKNOWN, "unknown") \
511 _(ZEND_STR_EVAL, "eval") \
512 _(ZEND_STR_INCLUDE, "include") \
513 _(ZEND_STR_REQUIRE, "require") \
514 _(ZEND_STR_INCLUDE_ONCE, "include_once") \
515 _(ZEND_STR_REQUIRE_ONCE, "require_once") \
516 _(ZEND_STR_SCALAR, "scalar") \
517 _(ZEND_STR_ERROR_REPORTING, "error_reporting") \
518 _(ZEND_STR_STATIC, "static") \
519 _(ZEND_STR_THIS, "this") \
520 _(ZEND_STR_VALUE, "value") \
521 _(ZEND_STR_KEY, "key") \
522 _(ZEND_STR_MAGIC_INVOKE, "__invoke") \
523 _(ZEND_STR_PREVIOUS, "previous") \
524 _(ZEND_STR_CODE, "code") \
525 _(ZEND_STR_MESSAGE, "message") \
526 _(ZEND_STR_SEVERITY, "severity") \
527 _(ZEND_STR_STRING, "string") \
528 _(ZEND_STR_TRACE, "trace") \
529 _(ZEND_STR_SCHEME, "scheme") \
530 _(ZEND_STR_HOST, "host") \
531 _(ZEND_STR_PORT, "port") \
532 _(ZEND_STR_USER, "user") \
533 _(ZEND_STR_PASS, "pass") \
534 _(ZEND_STR_PATH, "path") \
535 _(ZEND_STR_QUERY, "query") \
536 _(ZEND_STR_FRAGMENT, "fragment") \
537 _(ZEND_STR_NULL, "NULL") \
538 _(ZEND_STR_BOOLEAN, "boolean") \
539 _(ZEND_STR_INTEGER, "integer") \
540 _(ZEND_STR_DOUBLE, "double") \
541 _(ZEND_STR_ARRAY, "array") \
542 _(ZEND_STR_RESOURCE, "resource") \
543 _(ZEND_STR_CLOSED_RESOURCE, "resource (closed)") \
544 _(ZEND_STR_NAME, "name") \
545 _(ZEND_STR_ARGV, "argv") \
546 _(ZEND_STR_ARGC, "argc") \
547 _(ZEND_STR_ARRAY_CAPITALIZED, "Array") \
548 _(ZEND_STR_BOOL, "bool") \
549 _(ZEND_STR_INT, "int") \
550 _(ZEND_STR_FLOAT, "float") \
551 _(ZEND_STR_CALLABLE, "callable") \
552 _(ZEND_STR_ITERABLE, "iterable") \
553 _(ZEND_STR_VOID, "void") \
554 _(ZEND_STR_FALSE, "false") \
555 _(ZEND_STR_NULL_LOWERCASE, "null") \
556 _(ZEND_STR_MIXED, "mixed") \
557
558
559 typedef enum _zend_known_string_id {
560 #define _ZEND_STR_ID(id, str) id,
561 ZEND_KNOWN_STRINGS(_ZEND_STR_ID)
562 #undef _ZEND_STR_ID
563 ZEND_STR_LAST_KNOWN
564 } zend_known_string_id;
565
566 #endif /* ZEND_STRING_H */
567