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