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