zend_constants.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2016 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: Andi Gutmans <andi@zend.com> |
  16. | Zeev Suraski <zeev@zend.com> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #include "zend.h"
  21. #include "zend_constants.h"
  22. #include "zend_execute.h"
  23. #include "zend_variables.h"
  24. #include "zend_operators.h"
  25. #include "zend_globals.h"
  26. #include "zend_API.h"
  27. void free_zend_constant(zend_constant *c)
  28. {
  29. if (!(c->flags & CONST_PERSISTENT)) {
  30. zval_dtor(&c->value);
  31. }
  32. str_free(c->name);
  33. }
  34. void copy_zend_constant(zend_constant *c)
  35. {
  36. c->name = str_strndup(c->name, c->name_len - 1);
  37. if (!(c->flags & CONST_PERSISTENT)) {
  38. zval_copy_ctor(&c->value);
  39. }
  40. }
  41. void zend_copy_constants(HashTable *target, HashTable *source)
  42. {
  43. zend_constant tmp_constant;
  44. zend_hash_copy(target, source, (copy_ctor_func_t) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
  45. }
  46. static int clean_non_persistent_constant(const zend_constant *c TSRMLS_DC)
  47. {
  48. return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
  49. }
  50. static int clean_non_persistent_constant_full(const zend_constant *c TSRMLS_DC)
  51. {
  52. return (c->flags & CONST_PERSISTENT) ? 0 : 1;
  53. }
  54. static int clean_module_constant(const zend_constant *c, int *module_number TSRMLS_DC)
  55. {
  56. if (c->module_number == *module_number) {
  57. return 1;
  58. } else {
  59. return 0;
  60. }
  61. }
  62. void clean_module_constants(int module_number TSRMLS_DC)
  63. {
  64. zend_hash_apply_with_argument(EG(zend_constants), (apply_func_arg_t) clean_module_constant, (void *) &module_number TSRMLS_CC);
  65. }
  66. int zend_startup_constants(TSRMLS_D)
  67. {
  68. EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
  69. if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
  70. return FAILURE;
  71. }
  72. return SUCCESS;
  73. }
  74. void zend_register_standard_constants(TSRMLS_D)
  75. {
  76. REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
  77. REGISTER_MAIN_LONG_CONSTANT("E_RECOVERABLE_ERROR", E_RECOVERABLE_ERROR, CONST_PERSISTENT | CONST_CS);
  78. REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
  79. REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
  80. REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
  81. REGISTER_MAIN_LONG_CONSTANT("E_STRICT", E_STRICT, CONST_PERSISTENT | CONST_CS);
  82. REGISTER_MAIN_LONG_CONSTANT("E_DEPRECATED", E_DEPRECATED, CONST_PERSISTENT | CONST_CS);
  83. REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
  84. REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
  85. REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
  86. REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
  87. REGISTER_MAIN_LONG_CONSTANT("E_USER_ERROR", E_USER_ERROR, CONST_PERSISTENT | CONST_CS);
  88. REGISTER_MAIN_LONG_CONSTANT("E_USER_WARNING", E_USER_WARNING, CONST_PERSISTENT | CONST_CS);
  89. REGISTER_MAIN_LONG_CONSTANT("E_USER_NOTICE", E_USER_NOTICE, CONST_PERSISTENT | CONST_CS);
  90. REGISTER_MAIN_LONG_CONSTANT("E_USER_DEPRECATED", E_USER_DEPRECATED, CONST_PERSISTENT | CONST_CS);
  91. REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
  92. REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
  93. REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
  94. /* true/false constants */
  95. {
  96. REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST);
  97. REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT | CONST_CT_SUBST);
  98. REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS);
  99. REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS);
  100. }
  101. REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT | CONST_CT_SUBST);
  102. }
  103. int zend_shutdown_constants(TSRMLS_D)
  104. {
  105. zend_hash_destroy(EG(zend_constants));
  106. free(EG(zend_constants));
  107. return SUCCESS;
  108. }
  109. void clean_non_persistent_constants(TSRMLS_D)
  110. {
  111. if (EG(full_tables_cleanup)) {
  112. zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC);
  113. } else {
  114. zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
  115. }
  116. }
  117. ZEND_API void zend_register_null_constant(const char *name, uint name_len, int flags, int module_number TSRMLS_DC)
  118. {
  119. zend_constant c;
  120. ZVAL_NULL(&c.value);
  121. c.flags = flags;
  122. c.name = zend_strndup(name, name_len-1);
  123. c.name_len = name_len;
  124. c.module_number = module_number;
  125. zend_register_constant(&c TSRMLS_CC);
  126. }
  127. ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_bool bval, int flags, int module_number TSRMLS_DC)
  128. {
  129. zend_constant c;
  130. ZVAL_BOOL(&c.value, bval);
  131. c.flags = flags;
  132. c.name = zend_strndup(name, name_len-1);
  133. c.name_len = name_len;
  134. c.module_number = module_number;
  135. zend_register_constant(&c TSRMLS_CC);
  136. }
  137. ZEND_API void zend_register_long_constant(const char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC)
  138. {
  139. zend_constant c;
  140. ZVAL_LONG(&c.value, lval);
  141. c.flags = flags;
  142. c.name = zend_strndup(name, name_len-1);
  143. c.name_len = name_len;
  144. c.module_number = module_number;
  145. zend_register_constant(&c TSRMLS_CC);
  146. }
  147. ZEND_API void zend_register_double_constant(const char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC)
  148. {
  149. zend_constant c;
  150. ZVAL_DOUBLE(&c.value, dval);
  151. c.flags = flags;
  152. c.name = zend_strndup(name, name_len-1);
  153. c.name_len = name_len;
  154. c.module_number = module_number;
  155. zend_register_constant(&c TSRMLS_CC);
  156. }
  157. ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, char *strval, uint strlen, int flags, int module_number TSRMLS_DC)
  158. {
  159. zend_constant c;
  160. ZVAL_STRINGL(&c.value, strval, strlen, 0);
  161. c.flags = flags;
  162. c.name = zend_strndup(name, name_len-1);
  163. c.name_len = name_len;
  164. c.module_number = module_number;
  165. zend_register_constant(&c TSRMLS_CC);
  166. }
  167. ZEND_API void zend_register_string_constant(const char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC)
  168. {
  169. zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number TSRMLS_CC);
  170. }
  171. static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC)
  172. {
  173. int ret;
  174. static char haltoff[] = "__COMPILER_HALT_OFFSET__";
  175. if (!EG(in_execution)) {
  176. return 0;
  177. } else if (name_len == sizeof("__CLASS__")-1 &&
  178. !memcmp(name, "__CLASS__", sizeof("__CLASS__")-1)) {
  179. zend_constant tmp;
  180. /* Returned constants may be cached, so they have to be stored */
  181. if (EG(scope) && EG(scope)->name) {
  182. int const_name_len;
  183. char *const_name;
  184. ALLOCA_FLAG(use_heap)
  185. const_name_len = sizeof("\0__CLASS__") + EG(scope)->name_length;
  186. const_name = do_alloca(const_name_len, use_heap);
  187. memcpy(const_name, "\0__CLASS__", sizeof("\0__CLASS__")-1);
  188. zend_str_tolower_copy(const_name + sizeof("\0__CLASS__")-1, EG(scope)->name, EG(scope)->name_length);
  189. if (zend_hash_find(EG(zend_constants), const_name, const_name_len, (void**)c) == FAILURE) {
  190. zend_hash_add(EG(zend_constants), const_name, const_name_len, (void*)&tmp, sizeof(zend_constant), (void**)c);
  191. memset(*c, 0, sizeof(zend_constant));
  192. Z_STRVAL((**c).value) = estrndup(EG(scope)->name, EG(scope)->name_length);
  193. Z_STRLEN((**c).value) = EG(scope)->name_length;
  194. Z_TYPE((**c).value) = IS_STRING;
  195. }
  196. free_alloca(const_name, use_heap);
  197. } else {
  198. if (zend_hash_find(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void**)c) == FAILURE) {
  199. zend_hash_add(EG(zend_constants), "\0__CLASS__", sizeof("\0__CLASS__"), (void*)&tmp, sizeof(zend_constant), (void**)c);
  200. memset(*c, 0, sizeof(zend_constant));
  201. Z_STRVAL((**c).value) = estrndup("", 0);
  202. Z_STRLEN((**c).value) = 0;
  203. Z_TYPE((**c).value) = IS_STRING;
  204. }
  205. }
  206. return 1;
  207. } else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 &&
  208. !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {
  209. const char *cfilename;
  210. char *haltname;
  211. int len, clen;
  212. cfilename = zend_get_executed_filename(TSRMLS_C);
  213. clen = strlen(cfilename);
  214. /* check for __COMPILER_HALT_OFFSET__ */
  215. zend_mangle_property_name(&haltname, &len, haltoff,
  216. sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0);
  217. ret = zend_hash_find(EG(zend_constants), haltname, len+1, (void **) c);
  218. efree(haltname);
  219. return (ret == SUCCESS);
  220. } else {
  221. return 0;
  222. }
  223. }
  224. ZEND_API int zend_get_constant(const char *name, uint name_len, zval *result TSRMLS_DC)
  225. {
  226. zend_constant *c;
  227. int retval = 1;
  228. char *lookup_name;
  229. if (zend_hash_find(EG(zend_constants), name, name_len+1, (void **) &c) == FAILURE) {
  230. lookup_name = zend_str_tolower_dup(name, name_len);
  231. if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
  232. if (c->flags & CONST_CS) {
  233. retval=0;
  234. }
  235. } else {
  236. retval = zend_get_special_constant(name, name_len, &c TSRMLS_CC);
  237. }
  238. efree(lookup_name);
  239. }
  240. if (retval) {
  241. *result = c->value;
  242. zval_copy_ctor(result);
  243. Z_SET_REFCOUNT_P(result, 1);
  244. Z_UNSET_ISREF_P(result);
  245. }
  246. return retval;
  247. }
  248. ZEND_API int zend_get_constant_ex(const char *name, uint name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC)
  249. {
  250. zend_constant *c;
  251. int retval = 1;
  252. const char *colon;
  253. zend_class_entry *ce = NULL;
  254. char *class_name;
  255. zval **ret_constant;
  256. /* Skip leading \\ */
  257. if (name[0] == '\\') {
  258. name += 1;
  259. name_len -= 1;
  260. }
  261. if ((colon = zend_memrchr(name, ':', name_len)) &&
  262. colon > name && (*(colon - 1) == ':')) {
  263. int class_name_len = colon - name - 1;
  264. int const_name_len = name_len - class_name_len - 2;
  265. const char *constant_name = colon + 1;
  266. char *lcname;
  267. class_name = estrndup(name, class_name_len);
  268. lcname = zend_str_tolower_dup(class_name, class_name_len);
  269. if (!scope) {
  270. if (EG(in_execution)) {
  271. scope = EG(scope);
  272. } else {
  273. scope = CG(active_class_entry);
  274. }
  275. }
  276. if (class_name_len == sizeof("self")-1 &&
  277. !memcmp(lcname, "self", sizeof("self")-1)) {
  278. if (scope) {
  279. ce = scope;
  280. } else {
  281. zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
  282. retval = 0;
  283. }
  284. efree(lcname);
  285. } else if (class_name_len == sizeof("parent")-1 &&
  286. !memcmp(lcname, "parent", sizeof("parent")-1)) {
  287. if (!scope) {
  288. zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
  289. } else if (!scope->parent) {
  290. zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
  291. } else {
  292. ce = scope->parent;
  293. }
  294. efree(lcname);
  295. } else if (class_name_len == sizeof("static")-1 &&
  296. !memcmp(lcname, "static", sizeof("static")-1)) {
  297. if (EG(called_scope)) {
  298. ce = EG(called_scope);
  299. } else {
  300. zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
  301. }
  302. efree(lcname);
  303. } else {
  304. efree(lcname);
  305. ce = zend_fetch_class(class_name, class_name_len, flags TSRMLS_CC);
  306. }
  307. if (retval && ce) {
  308. if (zend_hash_find(&ce->constants_table, constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
  309. retval = 0;
  310. if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
  311. zend_error(E_ERROR, "Undefined class constant '%s::%s'", class_name, constant_name);
  312. }
  313. }
  314. } else if (!ce) {
  315. retval = 0;
  316. }
  317. efree(class_name);
  318. goto finish;
  319. }
  320. /* non-class constant */
  321. if ((colon = zend_memrchr(name, '\\', name_len)) != NULL) {
  322. /* compound constant name */
  323. int prefix_len = colon - name;
  324. int const_name_len = name_len - prefix_len - 1;
  325. const char *constant_name = colon + 1;
  326. char *lcname;
  327. int found_const = 0;
  328. lcname = zend_str_tolower_dup(name, prefix_len);
  329. /* Check for namespace constant */
  330. /* Concatenate lowercase namespace name and constant name */
  331. lcname = erealloc(lcname, prefix_len + 1 + const_name_len + 1);
  332. lcname[prefix_len] = '\\';
  333. memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1);
  334. if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) {
  335. found_const = 1;
  336. } else {
  337. /* try lowercase */
  338. zend_str_tolower(lcname + prefix_len + 1, const_name_len);
  339. if (zend_hash_find(EG(zend_constants), lcname, prefix_len + 1 + const_name_len + 1, (void **) &c) == SUCCESS) {
  340. if ((c->flags & CONST_CS) == 0) {
  341. found_const = 1;
  342. }
  343. }
  344. }
  345. efree(lcname);
  346. if(found_const) {
  347. *result = c->value;
  348. zval_update_constant_ex(&result, 1, NULL TSRMLS_CC);
  349. zval_copy_ctor(result);
  350. Z_SET_REFCOUNT_P(result, 1);
  351. Z_UNSET_ISREF_P(result);
  352. return 1;
  353. }
  354. /* name requires runtime resolution, need to check non-namespaced name */
  355. if ((flags & IS_CONSTANT_UNQUALIFIED) != 0) {
  356. name = constant_name;
  357. name_len = const_name_len;
  358. return zend_get_constant(name, name_len, result TSRMLS_CC);
  359. }
  360. retval = 0;
  361. finish:
  362. if (retval) {
  363. zval_update_constant_ex(ret_constant, 1, ce TSRMLS_CC);
  364. *result = **ret_constant;
  365. zval_copy_ctor(result);
  366. INIT_PZVAL(result);
  367. }
  368. return retval;
  369. }
  370. return zend_get_constant(name, name_len, result TSRMLS_CC);
  371. }
  372. zend_constant *zend_quick_get_constant(const zend_literal *key, ulong flags TSRMLS_DC)
  373. {
  374. zend_constant *c;
  375. if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
  376. key++;
  377. if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
  378. (c->flags & CONST_CS) != 0) {
  379. if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
  380. key++;
  381. if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE) {
  382. key++;
  383. if (zend_hash_quick_find(EG(zend_constants), Z_STRVAL(key->constant), Z_STRLEN(key->constant) + 1, key->hash_value, (void **) &c) == FAILURE ||
  384. (c->flags & CONST_CS) != 0) {
  385. key--;
  386. if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
  387. return NULL;
  388. }
  389. }
  390. }
  391. } else {
  392. key--;
  393. if (!zend_get_special_constant(Z_STRVAL(key->constant), Z_STRLEN(key->constant), &c TSRMLS_CC)) {
  394. return NULL;
  395. }
  396. }
  397. }
  398. }
  399. return c;
  400. }
  401. ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
  402. {
  403. char *lowercase_name = NULL;
  404. char *name;
  405. int ret = SUCCESS;
  406. ulong chash;
  407. #if 0
  408. printf("Registering constant for module %d\n", c->module_number);
  409. #endif
  410. if (!(c->flags & CONST_CS)) {
  411. /* keep in mind that c->name_len already contains the '\0' */
  412. lowercase_name = estrndup(c->name, c->name_len-1);
  413. zend_str_tolower(lowercase_name, c->name_len-1);
  414. lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
  415. name = lowercase_name;
  416. } else {
  417. char *slash = strrchr(c->name, '\\');
  418. if (slash) {
  419. lowercase_name = estrndup(c->name, c->name_len-1);
  420. zend_str_tolower(lowercase_name, slash-c->name);
  421. lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
  422. name = lowercase_name;
  423. } else {
  424. name = c->name;
  425. }
  426. }
  427. chash = str_hash(name, c->name_len-1);
  428. /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */
  429. if ((c->name_len == sizeof("__COMPILER_HALT_OFFSET__")
  430. && !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1))
  431. || zend_hash_quick_add(EG(zend_constants), name, c->name_len, chash, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
  432. /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
  433. if (c->name[0] == '\0' && c->name_len > sizeof("\0__COMPILER_HALT_OFFSET__")
  434. && memcmp(name, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
  435. name++;
  436. }
  437. zend_error(E_NOTICE,"Constant %s already defined", name);
  438. str_free(c->name);
  439. if (!(c->flags & CONST_PERSISTENT)) {
  440. zval_dtor(&c->value);
  441. }
  442. ret = FAILURE;
  443. }
  444. if (lowercase_name) {
  445. str_efree(lowercase_name);
  446. }
  447. return ret;
  448. }
  449. /*
  450. * Local variables:
  451. * tab-width: 4
  452. * c-basic-offset: 4
  453. * indent-tabs-mode: t
  454. * End:
  455. */