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