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