Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed ZE specific compile warnings (Bug #55629)

  • Loading branch information...
commit e43ff1359ef20dc7f055d8f34227ade1bff9a0a4 1 parent 9b881b6
Dmitry Stogov authored
Showing with 371 additions and 366 deletions.
  1. +10 −10 Zend/zend.c
  2. +7 −7 Zend/zend.h
  3. +53 −52 Zend/zend_API.c
  4. +30 −30 Zend/zend_API.h
  5. +4 −4 Zend/zend_alloc.c
  6. +2 −2 Zend/zend_alloc.h
  7. +24 −22 Zend/zend_builtin_functions.c
  8. +1 −1  Zend/zend_closures.c
  9. +23 −21 Zend/zend_compile.c
  10. +12 −12 Zend/zend_compile.h
  11. +4 −3 Zend/zend_constants.c
  12. +2 −2 Zend/zend_exceptions.c
  13. +2 −2 Zend/zend_execute.c
  14. +4 −4 Zend/zend_execute.h
  15. +12 −11 Zend/zend_execute_API.c
  16. +1 −1  Zend/zend_gc.h
  17. +9 −9 Zend/zend_hash.c
  18. +2 −2 Zend/zend_hash.h
  19. +9 −9 Zend/zend_highlight.c
  20. +4 −4 Zend/zend_indent.c
  21. +1 −1  Zend/zend_interfaces.c
  22. +1 −1  Zend/zend_interfaces.h
  23. +1 −3 Zend/zend_iterators.c
  24. +1 −1  Zend/zend_language_scanner.h
  25. +14 −13 Zend/zend_language_scanner.l
  26. +2 −2 Zend/zend_list.c
  27. +6 −6 Zend/zend_object_handlers.c
  28. +6 −6 Zend/zend_object_handlers.h
  29. +13 −17 Zend/zend_opcode.c
  30. +1 −1  Zend/zend_stream.c
  31. +1 −1  Zend/zend_stream.h
  32. +1 −1  Zend/zend_string.c
  33. +2 −2 Zend/zend_string.h
  34. +1 −1  Zend/zend_types.h
  35. +5 −5 Zend/zend_vm_def.h
  36. +5 −5 Zend/zend_vm_execute.h
  37. +1 −1  ext/dom/node.c
  38. +1 −1  ext/pdo/pdo_dbh.c
  39. +2 −2 ext/pdo/pdo_stmt.c
  40. +7 −7 ext/phar/func_interceptors.c
  41. +3 −3 ext/phar/phar.c
  42. +4 −4 ext/phar/phar_object.c
  43. +3 −3 ext/phar/util.c
  44. +12 −12 ext/reflection/php_reflection.c
  45. +2 −2 ext/session/session.c
  46. +2 −2 ext/soap/php_encoding.c
  47. +2 −2 ext/standard/array.c
  48. +1 −1  ext/standard/assert.c
  49. +1 −1  ext/standard/head.c
  50. +6 −4 ext/standard/http.c
  51. +1 −1  ext/standard/mail.c
  52. +2 −2 ext/standard/php_string.h
  53. +6 −6 ext/standard/string.c
  54. +2 −1  ext/standard/user_filters.c
  55. +11 −11 ext/standard/var.c
  56. +2 −2 ext/wddx/wddx.c
  57. +1 −1  main/SAPI.c
  58. +2 −2 main/fopen_wrappers.c
  59. +4 −4 main/main.c
  60. +1 −1  main/output.c
  61. +2 −2 main/php_output.h
  62. +10 −10 main/php_variables.c
  63. +1 −1  main/streams/plain_wrapper.c
  64. +3 −3 sapi/cli/php_cli.c
View
20 Zend/zend.c
@@ -63,7 +63,7 @@ ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRML
void (*zend_on_timeout)(int seconds TSRMLS_DC);
-static void (*zend_message_dispatcher_p)(long message, void *data TSRMLS_DC);
+static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC);
static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
@@ -157,7 +157,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
case HASH_KEY_IS_STRING:
if (is_object) {
- char *prop_name, *class_name;
+ const char *prop_name, *class_name;
int mangled = zend_unmangle_property_name(string_key, str_len - 1, &class_name, &prop_name);
ZEND_PUTS_EX(prop_name);
@@ -349,7 +349,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
case IS_OBJECT:
{
HashTable *properties = NULL;
- char *class_name = NULL;
+ const char *class_name = NULL;
zend_uint clen;
if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
@@ -361,7 +361,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
zend_printf("%s Object (", "Unknown Class");
}
if (class_name) {
- efree(class_name);
+ efree((char*)class_name);
}
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
properties = Z_OBJPROP_P(expr);
@@ -407,7 +407,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
case IS_OBJECT:
{
HashTable *properties;
- char *class_name = NULL;
+ const char *class_name = NULL;
zend_uint clen;
int is_temp;
@@ -421,7 +421,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
}
ZEND_PUTS_EX(" Object\n");
if (class_name) {
- efree(class_name);
+ efree((char*)class_name);
}
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
break;
@@ -616,7 +616,7 @@ static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p
void zend_init_opcodes_handlers(void);
-static zend_bool php_auto_globals_create_globals(char *name, uint name_len TSRMLS_DC) /* {{{ */
+static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */
{
zval *globals;
@@ -956,7 +956,7 @@ void zend_deactivate(TSRMLS_D) /* {{{ */
/* }}} */
BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC) /* {{{ */
+ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */
{
if (zend_message_dispatcher_p) {
zend_message_dispatcher_p(message, data TSRMLS_CC);
@@ -999,7 +999,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
zval ***params;
zval *retval;
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
- char *error_filename;
+ const char *error_filename;
uint error_lineno;
zval *orig_user_error_handler;
zend_bool in_compilation;
@@ -1307,7 +1307,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */
{
- char *cur_filename;
+ const char *cur_filename;
int cur_lineno;
char *compiled_string_description;
View
14 Zend/zend.h
@@ -422,12 +422,12 @@ typedef struct _zend_serialize_data zend_serialize_data;
typedef struct _zend_unserialize_data zend_unserialize_data;
struct _zend_trait_method_reference {
- char* method_name;
+ const char* method_name;
unsigned int mname_len;
zend_class_entry *ce;
- char* class_name;
+ const char* class_name;
unsigned int cname_len;
};
typedef struct _zend_trait_method_reference zend_trait_method_reference;
@@ -447,7 +447,7 @@ struct _zend_trait_alias {
/**
* name for method to be added
*/
- char* alias;
+ const char* alias;
unsigned int alias_len;
/**
@@ -511,10 +511,10 @@ struct _zend_class_entry {
union {
struct {
- char *filename;
+ const char *filename;
zend_uint line_start;
zend_uint line_end;
- char *doc_comment;
+ const char *doc_comment;
zend_uint doc_comment_len;
} user;
struct {
@@ -530,7 +530,7 @@ typedef struct _zend_utility_functions {
int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
int (*write_function)(const char *str, uint str_length);
FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC);
- void (*message_handler)(long message, void *data TSRMLS_DC);
+ void (*message_handler)(long message, const void *data TSRMLS_DC);
#ifndef ZEND_SIGNALS
void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
@@ -714,7 +714,7 @@ END_EXTERN_C()
#endif
BEGIN_EXTERN_C()
-ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC);
+ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC);
ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents);
END_EXTERN_C()
View
105 Zend/zend_API.c
@@ -192,8 +192,8 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array TS
ZEND_API void zend_wrong_param_count(TSRMLS_D) /* {{{ */
{
- char *space;
- char *class_name = get_active_class_name(&space TSRMLS_CC);
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name(TSRMLS_C));
}
@@ -299,7 +299,7 @@ static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TS
}
/* }}} */
-static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */
+static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */
{
const char *spec_walk = *spec;
char c = *spec_walk++;
@@ -665,14 +665,15 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const cha
static int zend_parse_arg(int arg_num, zval **arg, va_list *va, const char **spec, int quiet TSRMLS_DC) /* {{{ */
{
- char *expected_type = NULL, *error = NULL;
+ const char *expected_type = NULL;
+ char *error = NULL;
int severity = E_WARNING;
expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity TSRMLS_CC);
if (expected_type) {
if (!quiet && (*expected_type || error)) {
- char *space;
- char *class_name = get_active_class_name(&space TSRMLS_CC);
+ const char *space;
+ const char *class_name = get_active_class_name(&space TSRMLS_CC);
if (error) {
zend_error(severity, "%s%s%s() expects parameter %d %s",
@@ -735,7 +736,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (have_varargs) {
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted",
class_name,
class_name[0] ? "::" : "",
@@ -755,7 +756,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
default:
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters",
class_name,
class_name[0] ? "::" : "",
@@ -778,7 +779,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) {
if (!quiet) {
zend_function *active_function = EG(current_execute_data)->function_state.function;
- char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given",
class_name,
class_name[0] ? "::" : "",
@@ -856,8 +857,8 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
int __num_args = (num_args); \
\
if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \
- char *__space; \
- char * __class_name = get_active_class_name(&__space TSRMLS_CC); \
+ const char *__space; \
+ const char * __class_name = get_active_class_name(&__space TSRMLS_CC); \
zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \
__class_name, __space, \
get_active_function_name(TSRMLS_C), __num_args); \
@@ -1004,7 +1005,7 @@ static int zend_merge_property(zval **value TSRMLS_DC, int num_args, va_list arg
* because it may call __set from the uninitialized object otherwise. */
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC) /* {{{ */
{
- zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj);
+ const zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj);
zend_class_entry *old_scope = EG(scope);
EG(scope) = Z_OBJCE_P(obj);
@@ -1924,7 +1925,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
HashTable *target_function_table = function_table;
int error_type;
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL, *__callstatic = NULL, *__tostring = NULL;
- char *lowercase_name;
+ const char *lowercase_name;
int fname_len;
const char *lc_class_name = NULL;
int class_name_len = 0;
@@ -2011,13 +2012,13 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
} else {
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
- efree(lc_class_name);
+ efree((char*)lc_class_name);
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
return FAILURE;
}
if (!internal_function->handler) {
if (scope) {
- efree(lc_class_name);
+ efree((char*)lc_class_name);
}
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
@@ -2079,7 +2080,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
if (unload) { /* before unloading, display all remaining bad function in the module */
if (scope) {
- efree(lc_class_name);
+ efree((char*)lc_class_name);
}
while (ptr->fname) {
fname_len = strlen(ptr->fname);
@@ -2087,7 +2088,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (zend_hash_exists(target_function_table, lowercase_name, fname_len+1)) {
zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
}
- efree(lowercase_name);
+ efree((char*)lowercase_name);
ptr++;
}
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
@@ -2167,7 +2168,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
}
__isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
- efree(lc_class_name);
+ efree((char*)lc_class_name);
}
return SUCCESS;
}
@@ -2394,7 +2395,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class
}
zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length);
- lowercase_name = zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC);
+ lowercase_name = (char*)zend_new_interned_string(lowercase_name, class_entry->name_length + 1, 1 TSRMLS_CC);
if (IS_INTERNED(lowercase_name)) {
zend_hash_quick_update(CG(class_table), lowercase_name, class_entry->name_length+1, INTERNED_HASH(lowercase_name), &class_entry, sizeof(zend_class_entry *), NULL);
} else {
@@ -2768,7 +2769,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
!instanceof_function(ce_org, fcc->function_handler->common.scope TSRMLS_CC))) {
if ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- efree(fcc->function_handler->common.function_name);
+ efree((char*)fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -2944,7 +2945,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- efree(fcc->function_handler->common.function_name);
+ efree((char*)fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -3022,7 +3023,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, zval *object_ptr, uint ch
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- efree(fcc->function_handler->common.function_name);
+ efree((char*)fcc->function_handler->common.function_name);
}
efree(fcc->function_handler);
}
@@ -3100,7 +3101,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
fcc.function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
if (fcc.function_handler->type != ZEND_OVERLOADED_FUNCTION) {
- efree(fcc.function_handler->common.function_name);
+ efree((char*)fcc.function_handler->common.function_name);
}
efree(fcc.function_handler);
}
@@ -3286,10 +3287,10 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */
}
/* }}} */
-ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC) /* {{{ */
{
zend_property_info property_info, *property_info_ptr;
- char *interned_name;
+ const char *interned_name;
ulong h = zend_get_hash_value(name, name_length+1);
if (!(access_type & ZEND_ACC_PPP_MASK)) {
@@ -3365,9 +3366,9 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in
interned_name = zend_new_interned_string(property_info.name, property_info.name_length+1, 0 TSRMLS_CC);
if (interned_name != property_info.name) {
if (ce->type == ZEND_USER_CLASS) {
- efree(property_info.name);
+ efree((char*)property_info.name);
} else {
- free(property_info.name);
+ free((char*)property_info.name);
}
property_info.name = interned_name;
}
@@ -3386,13 +3387,13 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, in
}
/* }}} */
-ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC) /* {{{ */
{
return zend_declare_property_ex(ce, name, name_length, property, access_type, NULL, 0 TSRMLS_CC);
}
/* }}} */
-ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
@@ -3406,7 +3407,7 @@ ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int na
}
/* }}} */
-ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
@@ -3421,7 +3422,7 @@ ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int na
}
/* }}} */
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
@@ -3436,7 +3437,7 @@ ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int na
}
/* }}} */
-ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
@@ -3451,7 +3452,7 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int
}
/* }}} */
-ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, const char *value, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
int len = strlen(value);
@@ -3468,7 +3469,7 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
}
/* }}} */
-ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
@@ -3572,7 +3573,7 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char
}
/* }}} */
-ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
{
zval *property;
zend_class_entry *old_scope = EG(scope);
@@ -3580,7 +3581,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->write_property) {
- char *class_name;
+ const char *class_name;
zend_uint class_name_len;
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
@@ -3596,7 +3597,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
}
/* }}} */
-ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3608,7 +3609,7 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
}
/* }}} */
-ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3620,7 +3621,7 @@ ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, c
}
/* }}} */
-ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3632,7 +3633,7 @@ ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, c
}
/* }}} */
-ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3644,7 +3645,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
}
/* }}} */
-ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3656,7 +3657,7 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object,
}
/* }}} */
-ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3668,7 +3669,7 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
}
/* }}} */
-ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC) /* {{{ */
{
zval **property;
zend_class_entry *old_scope = EG(scope);
@@ -3703,7 +3704,7 @@ ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, in
}
/* }}} */
-ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3715,7 +3716,7 @@ ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *nam
}
/* }}} */
-ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3727,7 +3728,7 @@ ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *nam
}
/* }}} */
-ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3739,7 +3740,7 @@ ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *nam
}
/* }}} */
-ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3751,7 +3752,7 @@ ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *n
}
/* }}} */
-ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3763,7 +3764,7 @@ ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *n
}
/* }}} */
-ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_len TSRMLS_DC) /* {{{ */
{
zval *tmp;
@@ -3775,7 +3776,7 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *
}
/* }}} */
-ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
+ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
{
zval *property, *value;
zend_class_entry *old_scope = EG(scope);
@@ -3783,7 +3784,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->read_property) {
- char *class_name;
+ const char *class_name;
zend_uint class_name_len;
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
@@ -3800,7 +3801,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
}
/* }}} */
-ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
+ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC) /* {{{ */
{
zval **property;
zend_class_entry *old_scope = EG(scope);
View
60 Zend/zend_API.h
@@ -295,14 +295,14 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
ZEND_API const char *zend_get_module_version(const char *module_name);
ZEND_API int zend_get_module_started(const char *module_name);
-ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC);
-ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, const char *value, int access_type TSRMLS_DC);
-ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_ex(zend_class_entry *ce, const char *name, int name_length, zval *property, int access_type, const char *doc_comment, int doc_comment_len TSRMLS_DC);
+ZEND_API int zend_declare_property_null(zend_class_entry *ce, const char *name, int name_length, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_long(zend_class_entry *ce, const char *name, int name_length, long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_string(zend_class_entry *ce, const char *name, int name_length, const char *value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, const char *name, int name_length, const char *value, int value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, const char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, const char *name, size_t name_length TSRMLS_DC);
@@ -313,25 +313,25 @@ ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, const cha
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char *name, size_t name_length, const char *value TSRMLS_DC);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
-ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
-ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
-ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
-ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
-ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
-ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value TSRMLS_DC);
-ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, const char *value, int value_length TSRMLS_DC);
-
-ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
-ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
-ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
-ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
-ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
-ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, const char *value TSRMLS_DC);
-ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, const char *value, int value_length TSRMLS_DC);
-
-ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
-
-ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
+ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zval *value TSRMLS_DC);
+ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, const char *name, int name_length TSRMLS_DC);
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC);
+ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, int name_length, long value TSRMLS_DC);
+ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC);
+ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value TSRMLS_DC);
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
+
+ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, int name_length, zval *value TSRMLS_DC);
+ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, int name_length TSRMLS_DC);
+ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC);
+ZEND_API int zend_update_static_property_long(zend_class_entry *scope, const char *name, int name_length, long value TSRMLS_DC);
+ZEND_API int zend_update_static_property_double(zend_class_entry *scope, const char *name, int name_length, double value TSRMLS_DC);
+ZEND_API int zend_update_static_property_string(zend_class_entry *scope, const char *name, int name_length, const char *value TSRMLS_DC);
+ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const char *name, int name_length, const char *value, int value_length TSRMLS_DC);
+
+ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, int name_length, zend_bool silent TSRMLS_DC);
+
+ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zend_class_entry *zend_get_class_entry(const zval *zobject TSRMLS_DC);
ZEND_API int zend_get_object_classname(const zval *object, const char **class_name, zend_uint *class_name_len TSRMLS_DC);
@@ -502,11 +502,11 @@ ZEND_API int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci
ZEND_API int zend_set_hash_symbol(zval *symbol, const char *name, int name_length, zend_bool is_ref, int num_symbol_tables, ...);
-ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, char *name, int name_len, ulong hash_value TSRMLS_DC);
+ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC);
-ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC);
+ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC);
-ZEND_API int zend_delete_global_variable_ex(char *name, int name_len, ulong hash_value TSRMLS_DC);
+ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC);
ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC);
View
8 Zend/zend_alloc.c
@@ -344,9 +344,9 @@ typedef struct _zend_mm_block_info {
#if ZEND_DEBUG
typedef struct _zend_mm_debug_info {
- char *filename;
+ const char *filename;
uint lineno;
- char *orig_filename;
+ const char *orig_filename;
uint orig_lineno;
size_t size;
#if ZEND_MM_HEAP_PROTECTION
@@ -460,7 +460,7 @@ struct _zend_mm_heap {
sizeof(zend_mm_free_block*) * 2 - \
sizeof(zend_mm_small_free_block))
-#define ZEND_MM_REST_BLOCK ((zend_mm_free_block*)(zend_uintptr_t)(1))
+#define ZEND_MM_REST_BLOCK ((zend_mm_free_block**)(zend_uintptr_t)(1))
#define ZEND_MM_MAX_REST_BLOCKS 16
@@ -1750,7 +1750,7 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
heap->reserve = NULL;
}
if (heap->overflow == 0) {
- char *error_filename;
+ const char *error_filename;
uint error_lineno;
TSRMLS_FETCH();
if (zend_is_compiling(TSRMLS_C)) {
View
4 Zend/zend_alloc.h
@@ -44,9 +44,9 @@
typedef struct _zend_leak_info {
void *addr;
size_t size;
- char *filename;
+ const char *filename;
uint lineno;
- char *orig_filename;
+ const char *orig_filename;
uint orig_lineno;
} zend_leak_info;
View
46 Zend/zend_builtin_functions.c
@@ -744,7 +744,7 @@ ZEND_FUNCTION(defined)
ZEND_FUNCTION(get_class)
{
zval *obj = NULL;
- char *name = "";
+ const char *name = "";
zend_uint name_len = 0;
int dup;
@@ -792,7 +792,7 @@ ZEND_FUNCTION(get_parent_class)
{
zval *arg;
zend_class_entry *ce = NULL;
- char *name;
+ const char *name;
zend_uint name_length;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &arg) == FAILURE) {
@@ -974,7 +974,8 @@ ZEND_FUNCTION(get_object_vars)
zval **value;
HashTable *properties;
HashPosition pos;
- char *key, *prop_name, *class_name;
+ char *key;
+ const char *prop_name, *class_name;
uint key_len;
ulong num_index;
zend_object *zobj;
@@ -1120,7 +1121,7 @@ ZEND_FUNCTION(method_exists)
&& memcmp(lcname, ZEND_INVOKE_FUNC_NAME, sizeof(ZEND_INVOKE_FUNC_NAME)-1) == 0) ? 1 : 0);
efree(lcname);
- efree(((zend_internal_function*)func)->function_name);
+ efree((char*)((zend_internal_function*)func)->function_name);
efree(func);
return;
}
@@ -1450,6 +1451,7 @@ ZEND_FUNCTION(crash)
ZEND_FUNCTION(get_included_files)
{
char *entry;
+
if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -1854,7 +1856,7 @@ ZEND_FUNCTION(zend_thread_id)
Get the resource type name for a given resource */
ZEND_FUNCTION(get_resource_type)
{
- char *resource_type;
+ const char *resource_type;
zval *z_resource_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_resource_type) == FAILURE) {
@@ -2037,11 +2039,11 @@ ZEND_FUNCTION(debug_print_backtrace)
{
zend_execute_data *ptr, *skip;
int lineno, frameno = 0;
- char *function_name;
- char *filename;
+ const char *function_name;
+ const char *filename;
const char *class_name = NULL;
char *call_type;
- char *include_filename = NULL;
+ const char *include_filename = NULL;
zval *arg_array = NULL;
int indent = 0;
long options = 0;
@@ -2148,7 +2150,7 @@ ZEND_FUNCTION(debug_print_backtrace)
if (build_filename_arg && include_filename) {
MAKE_STD_ZVAL(arg_array);
array_init(arg_array);
- add_next_index_string(arg_array, include_filename, 1);
+ add_next_index_string(arg_array, (char*)include_filename, 1);
}
call_type = NULL;
}
@@ -2187,7 +2189,7 @@ ZEND_FUNCTION(debug_print_backtrace)
ptr = skip->prev_execute_data;
++indent;
if (free_class_name) {
- efree(free_class_name);
+ efree((char*)free_class_name);
}
}
}
@@ -2198,10 +2200,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
{
zend_execute_data *ptr, *skip;
int lineno, frameno = 0;
- char *function_name;
- char *filename;
- char *class_name;
- char *include_filename = NULL;
+ const char *function_name;
+ const char *filename;
+ const char *class_name;
+ const char *include_filename = NULL;
zval *stack_frame;
ptr = EG(current_execute_data);
@@ -2237,7 +2239,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if (skip->op_array) {
filename = skip->op_array->filename;
lineno = skip->opline->lineno;
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), filename, 1);
+ add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)filename, 1);
add_assoc_long_ex(stack_frame, "line", sizeof("line"), lineno);
/* try to fetch args only if an FCALL was just made - elsewise we're in the middle of a function
@@ -2254,7 +2256,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
break;
}
if (prev->op_array) {
- add_assoc_string_ex(stack_frame, "file", sizeof("file"), prev->op_array->filename, 1);
+ add_assoc_string_ex(stack_frame, "file", sizeof("file"), (char*)prev->op_array->filename, 1);
add_assoc_long_ex(stack_frame, "line", sizeof("line"), prev->opline->lineno);
break;
}
@@ -2266,17 +2268,17 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
function_name = ptr->function_state.function->common.function_name;
if (function_name) {
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
+ add_assoc_string_ex(stack_frame, "function", sizeof("function"), (char*)function_name, 1);
if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) {
if (ptr->function_state.function->common.scope) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
+ add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1);
} else {
zend_uint class_name_len;
int dup;
dup = zend_get_object_classname(ptr->object, &class_name, &class_name_len TSRMLS_CC);
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), class_name, dup);
+ add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)class_name, dup);
}
if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) {
@@ -2286,7 +2288,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
add_assoc_string_ex(stack_frame, "type", sizeof("type"), "->", 1);
} else if (ptr->function_state.function->common.scope) {
- add_assoc_string_ex(stack_frame, "class", sizeof("class"), ptr->function_state.function->common.scope->name, 1);
+ add_assoc_string_ex(stack_frame, "class", sizeof("class"), (char*)ptr->function_state.function->common.scope->name, 1);
add_assoc_string_ex(stack_frame, "type", sizeof("type"), "::", 1);
}
@@ -2340,11 +2342,11 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
if we have called include in the frame above - this is the file we have included.
*/
- add_next_index_string(arg_array, include_filename, 1);
+ add_next_index_string(arg_array, (char*)include_filename, 1);
add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array);
}
- add_assoc_string_ex(stack_frame, "function", sizeof("function"), function_name, 1);
+ add_assoc_string_ex(stack_frame, "function", sizeof("function"), (char*)function_name, 1);
}
add_next_index_zval(return_value, stack_frame);
View
2  Zend/zend_closures.c
@@ -71,7 +71,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
efree(arguments);
/* destruct the function also, then - we have allocated it in get_method */
- efree(func->internal_function.function_name);
+ efree((char*)func->internal_function.function_name);
efree(func);
}
/* }}} */
View
44 Zend/zend_compile.c
@@ -129,7 +129,7 @@ static void zend_destroy_property_info(zend_property_info *property_info) /* {{{
{
str_efree(property_info->name);
if (property_info->doc_comment) {
- efree(property_info->doc_comment);
+ efree((char*)property_info->doc_comment);
}
}
/* }}} */
@@ -137,7 +137,7 @@ static void zend_destroy_property_info(zend_property_info *property_info) /* {{{
static void zend_destroy_property_info_internal(zend_property_info *property_info) /* {{{ */
{
- str_free(property_info->name);
+ str_free((char*)property_info->name);
}
/* }}} */
@@ -145,7 +145,7 @@ static void build_runtime_defined_function_key(zval *result, const char *name, i
{
char char_pos_buf[32];
uint char_pos_len;
- char *filename;
+ const char *filename;
char_pos_len = zend_sprintf(char_pos_buf, "%p", LANG_SCNG(yy_text));
if (CG(active_op_array)->filename) {
@@ -344,7 +344,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, const zval *zv,
{
if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) {
zval *z = (zval*)zv;
- Z_STRVAL_P(z) = zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC);
+ Z_STRVAL_P(z) = (char*)zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC);
}
CONSTANT_EX(op_array, literal_position) = *zv;
Z_SET_REFCOUNT(CONSTANT_EX(op_array, literal_position), 2);
@@ -412,7 +412,8 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC
int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ */
{
int ret;
- char *lc_name, *ns_separator;
+ char *lc_name;
+ const char *ns_separator;
int lc_len;
zval c;
int lc_literal;
@@ -431,7 +432,7 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS
lc_literal = zend_add_literal(CG(active_op_array), &c TSRMLS_CC);
CALCULATE_LITERAL_HASH(lc_literal);
- ns_separator = (char *) zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1;
+ ns_separator = zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1;
lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv));
lc_name = zend_str_tolower_dup(ns_separator, lc_len);
ZVAL_STRINGL(&c, lc_name, lc_len, 0);
@@ -479,7 +480,8 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D
int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unqualified TSRMLS_DC) /* {{{ */
{
int ret, tmp_literal;
- char *name, *tmp_name, *ns_separator;
+ char *name, *tmp_name;
+ const char *ns_separator;
int name_len, ns_len;
zval c;
@@ -678,7 +680,7 @@ void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar
CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode != ZEND_BEGIN_SILENCE)) {
result->op_type = IS_CV;
result->u.op.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len, hash TSRMLS_CC);
- varname->u.constant.value.str.val = CG(active_op_array)->vars[result->u.op.var].name;
+ varname->u.constant.value.str.val = (char*)CG(active_op_array)->vars[result->u.op.var].name;
result->EA = 0;
return;
}
@@ -1536,7 +1538,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
int name_len = function_name->u.constant.value.str.len;
int function_begin_line = function_token->u.op.opline_num;
zend_uint fn_flags;
- char *lcname;
+ const char *lcname;
zend_bool orig_interactive;
ALLOCA_FLAG(use_heap)
@@ -1852,7 +1854,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con
} else {
var.op_type = IS_CV;
var.u.op.var = lookup_cv(CG(active_op_array), varname->u.constant.value.str.val, varname->u.constant.value.str.len, 0 TSRMLS_CC);
- varname->u.constant.value.str.val = CG(active_op_array)->vars[var.u.op.var].name;
+ Z_STRVAL(varname->u.constant) = (char*)CG(active_op_array)->vars[var.u.op.var].name;
var.EA = 0;
if (CG(active_op_array)->vars[var.u.op.var].hash_value == THIS_HASHVAL &&
Z_STRLEN(varname->u.constant) == sizeof("this")-1 &&
@@ -1913,7 +1915,7 @@ void zend_do_receive_arg(zend_uchar op, znode *varname, const znode *offset, con
if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type->u.constant), Z_STRLEN(class_type->u.constant))) {
zend_resolve_class_name(class_type, opline->extended_value, 1 TSRMLS_CC);
}
- class_type->u.constant.value.str.val = zend_new_interned_string(class_type->u.constant.value.str.val, class_type->u.constant.value.str.len + 1, 1 TSRMLS_CC);
+ Z_STRVAL(class_type->u.constant) = (char*)zend_new_interned_string(class_type->u.constant.value.str.val, class_type->u.constant.value.str.len + 1, 1 TSRMLS_CC);
cur_arg_info->class_name = class_type->u.constant.value.str.val;
cur_arg_info->class_name_len = class_type->u.constant.value.str.len;
if (op == ZEND_RECV_INIT) {
@@ -2749,7 +2751,7 @@ void zend_do_begin_catch(znode *try_token, znode *class_name, znode *catch_var,
opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), &catch_class.u.constant TSRMLS_CC);
opline->op2_type = IS_CV;
opline->op2.var = lookup_cv(CG(active_op_array), catch_var->u.constant.value.str.val, catch_var->u.constant.value.str.len, 0 TSRMLS_CC);
- catch_var->u.constant.value.str.val = CG(active_op_array)->vars[opline->op2.var].name;
+ Z_STRVAL(catch_var->u.constant) = (char*)CG(active_op_array)->vars[opline->op2.var].name;
opline->result.num = 0; /* 1 means it's the last catch in the block */
try_token->u.op.opline_num = catch_op_number;
@@ -2964,7 +2966,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
}
if (fe->common.arg_info[i].class_name
&& strcasecmp(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)!=0) {
- char *colon;
+ const char *colon;
if (fe->common.type != ZEND_USER_FUNCTION) {
return 0;
@@ -3935,7 +3937,7 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
free(resulting_table);
}
-static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */
+static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, const char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */
{
size_t i;
zend_property_info *coliding_prop;
@@ -3955,10 +3957,10 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
zend_property_info *property_info;
zend_property_info *coliding_prop;
zval compare_result;
- char* prop_name;
+ const char* prop_name;
int prop_name_length;
ulong prop_hash;
- char* class_name_unused;
+ const char* class_name_unused;
zend_bool prop_found;
zend_bool not_compatible;
zval* prop_value;
@@ -4890,7 +4892,7 @@ static int zend_strnlen(const char* s, int maxlen) /* {{{ */
}
/* }}} */
-ZEND_API int zend_unmangle_property_name(char *mangled_property, int len, char **class_name, char **prop_name) /* {{{ */
+ZEND_API int zend_unmangle_property_name(const char *mangled_property, int len, const char **class_name, const char **prop_name) /* {{{ */
{
int class_name_len;
@@ -4965,7 +4967,7 @@ void zend_do_declare_property(const znode *var_name, const znode *value, zend_ui
void zend_do_declare_class_constant(znode *var_name, const znode *value TSRMLS_DC) /* {{{ */
{
zval *property;
- char *cname = NULL;
+ const char *cname = NULL;
int result;
if(Z_TYPE(value->u.constant) == IS_CONSTANT_ARRAY) {
@@ -6047,7 +6049,7 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC) /* {{{ */
}
if (CG(multibyte)) {
- zend_encoding *new_encoding, *old_encoding;
+ const zend_encoding *new_encoding, *old_encoding;
zend_encoding_filter old_input_filter;
CG(encoding_declared) = 1;
@@ -6464,7 +6466,7 @@ int zend_get_class_fetch_type(const char *class_name, uint class_name_len) /* {{
}
/* }}} */
-ZEND_API char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) /* {{{ */
+ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len) /* {{{ */
{
if (name_len) {
*name_len = op_array->vars[var].name_len;
@@ -6595,7 +6597,7 @@ void zend_do_use(znode *ns_name, znode *new_name, int is_global TSRMLS_DC) /* {{
if (new_name) {
name = &new_name->u.constant;
} else {
- char *p;
+ const char *p;
/* The form "use A\B" is eqivalent to "use A\B as B".
So we extract the last part of compound name to use as a new_name */
View
24 Zend/zend_compile.h
@@ -209,11 +209,11 @@ char *zend_visibility_string(zend_uint fn_flags);
typedef struct _zend_property_info {
zend_uint flags;
- char *name;
+ const char *name;
int name_length;
ulong h;
int offset;
- char *doc_comment;
+ const char *doc_comment;
int doc_comment_len;
zend_class_entry *ce;
} zend_property_info;
@@ -244,7 +244,7 @@ typedef struct _zend_internal_function_info {
} zend_internal_function_info;
typedef struct _zend_compiled_variable {
- char *name;
+ const char *name;
int name_len;
ulong hash_value;
} zend_compiled_variable;
@@ -252,7 +252,7 @@ typedef struct _zend_compiled_variable {
struct _zend_op_array {
/* Common elements */
zend_uchar type;
- char *function_name;
+ const char *function_name;
zend_class_entry *scope;
zend_uint fn_flags;
union _zend_function *prototype;
@@ -282,10 +282,10 @@ struct _zend_op_array {
zend_uint this_var;
- char *filename;
+ const char *filename;
zend_uint line_start;
zend_uint line_end;
- char *doc_comment;
+ const char *doc_comment;
zend_uint doc_comment_len;
zend_uint early_binding; /* the linked list of delayed declarations */
@@ -305,7 +305,7 @@ struct _zend_op_array {
typedef struct _zend_internal_function {
/* Common elements */
zend_uchar type;
- char * function_name;
+ const char * function_name;
zend_class_entry *scope;
zend_uint fn_flags;
union _zend_function *prototype;
@@ -325,7 +325,7 @@ typedef union _zend_function {
struct {
zend_uchar type; /* never used */
- char *function_name;
+ const char *function_name;
zend_class_entry *scope;
zend_uint fn_flags;
union _zend_function *prototype;
@@ -415,7 +415,7 @@ ZEND_API size_t zend_get_scanned_file_offset(TSRMLS_D);
void zend_resolve_non_class_name(znode *element_name, zend_bool check_namespace TSRMLS_DC);
void zend_resolve_class_name(znode *class_name, ulong fetch_type, int check_ns_name TSRMLS_DC);
-ZEND_API char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len);
+ZEND_API const char* zend_get_compiled_variable_name(const zend_op_array *op_array, zend_uint var, int* name_len);
#ifdef ZTS
const char *zend_get_zendtext(TSRMLS_D);
@@ -650,7 +650,7 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce);
void zend_class_add_ref(zend_class_entry **ce);
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, const char *src1, int src1_length, const char *src2, int src2_length, int internal);
-ZEND_API int zend_unmangle_property_name(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name);
+ZEND_API int zend_unmangle_property_name(const char *mangled_property, int mangled_property_len, const char **class_name, const char **prop_name);
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
@@ -670,9 +670,9 @@ ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC)
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
int zend_get_class_fetch_type(const char *class_name, uint class_name_len);
-typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC);
+typedef zend_bool (*zend_auto_global_callback)(const char *name, uint name_len TSRMLS_DC);
typedef struct _zend_auto_global {
- char *name;
+ const char *name;
uint name_len;
zend_auto_global_callback auto_global_callback;
zend_bool jit;
View
7 Zend/zend_constants.c
@@ -233,7 +233,8 @@ static int zend_get_halt_offset_constant(const char *name, uint name_len, zend_c
return 0;
} else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 &&
!memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {
- char *cfilename, *haltname;
+ const char *cfilename;
+ char *haltname;
int len, clen;
cfilename = zend_get_executed_filename(TSRMLS_C);
@@ -462,7 +463,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
/* keep in mind that c->name_len already contains the '\0' */
lowercase_name = estrndup(c->name, c->name_len-1);
zend_str_tolower(lowercase_name, c->name_len-1);
- lowercase_name = zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
+ lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
name = lowercase_name;
chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0;
} else {
@@ -470,7 +471,7 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
if(slash) {
lowercase_name = estrndup(c->name, c->name_len-1);
zend_str_tolower(lowercase_name, slash-c->name);
- lowercase_name = zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
+ lowercase_name = (char*)zend_new_interned_string(lowercase_name, c->name_len, 1 TSRMLS_CC);
name = lowercase_name;
chash = IS_INTERNED(lowercase_name) ? INTERNED_HASH(lowercase_name) : 0;
View
4 Zend/zend_exceptions.c
@@ -430,7 +430,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STR("Array, ");
break;
case IS_OBJECT: {
- char *class_name;
+ const char *class_name;
zend_uint class_name_len;
int dup;
@@ -440,7 +440,7 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z
TRACE_APPEND_STRL(class_name, class_name_len);
if(!dup) {
- efree(class_name);
+ efree((char*)class_name);
}
TRACE_APPEND_STR("), ");
View
4 Zend/zend_execute.c
@@ -574,10 +574,10 @@ ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ul
}
}
-ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, char *given_kind TSRMLS_DC)
+ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
- char *fname = zf->common.function_name;
+ const char *fname = zf->common.function_name;
char *fsep;
const char *fclass;
View
8 Zend/zend_execute.h
@@ -75,7 +75,7 @@ ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name,
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC);
-ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, char *given_kind TSRMLS_DC);
+ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC);
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC)
{
@@ -377,9 +377,9 @@ void execute_new_code(TSRMLS_D);
/* services */
-ZEND_API char *get_active_class_name(char **space TSRMLS_DC);
-ZEND_API char *get_active_function_name(TSRMLS_D);
-ZEND_API char *zend_get_executed_filename(TSRMLS_D);
+ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
+ZEND_API const char *get_active_function_name(TSRMLS_D);
+ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
View
23 Zend/zend_execute_API.c
@@ -341,7 +341,7 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
/* }}} */
/* return class name and "::" or "". */
-ZEND_API char *get_active_class_name(char **space TSRMLS_DC) /* {{{ */
+ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC) /* {{{ */
{
if (!zend_is_executing(TSRMLS_C)) {
if (space) {
@@ -369,14 +369,14 @@ ZEND_API char *get_active_class_name(char **space TSRMLS_DC) /* {{{ */
}
/* }}} */
-ZEND_API char *get_active_function_name(TSRMLS_D) /* {{{ */
+ZEND_API const char *get_active_function_name(TSRMLS_D) /* {{{ */
{
if (!zend_is_executing(TSRMLS_C)) {
return NULL;
}
switch (EG(current_execute_data)->function_state.function->type) {
case ZEND_USER_FUNCTION: {
- char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name;
+ const char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name;
if (function_name) {
return function_name;
@@ -394,7 +394,7 @@ ZEND_API char *get_active_function_name(TSRMLS_D) /* {{{ */
}
/* }}} */
-ZEND_API char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
+ZEND_API const char *zend_get_executed_filename(TSRMLS_D) /* {{{ */
{
if (EG(active_op_array)) {
return EG(active_op_array)->filename;
@@ -515,7 +515,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
char *actual = Z_STRVAL_P(p);
- if ((colon = zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
+ if ((colon = (char*)zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1);
if (inline_change) {
@@ -615,8 +615,9 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
continue;
}
if (!zend_get_constant_ex(str_index, str_index_len - 3, &const_value, scope, str_index[str_index_len - 2] TSRMLS_CC)) {
- char *actual, *save = str_index;
- if ((colon = zend_memrchr(str_index, ':', str_index_len - 3))) {
+ char *actual;
+ const char *save = str_index;
+ if ((colon = (char*)zend_memrchr(str_index, ':', str_index_len - 3))) {
zend_error(E_ERROR, "Undefined class constant '%s'", str_index);
str_index_len -= ((colon - str_index) + 1);
str_index = colon;
@@ -1003,7 +1004,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- efree(EX(function_state).function->common.function_name);
+ efree((char*)EX(function_state).function->common.function_name);
}
efree(EX(function_state).function);
@@ -1686,7 +1687,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC) /* {{{ */
}
/* }}} */
-ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
+ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
{
if (zend_hash_quick_del(ht, name, name_len, hash_value) == SUCCESS) {
name_len--;
@@ -1709,7 +1710,7 @@ ZEND_API void zend_delete_variable(zend_execute_data *ex, HashTable *ht, char *n
}
/* }}} */
-ZEND_API int zend_delete_global_variable_ex(char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
+ZEND_API int zend_delete_global_variable_ex(const char *name, int name_len, ulong hash_value TSRMLS_DC) /* {{{ */
{
zend_execute_data *ex;
@@ -1734,7 +1735,7 @@ ZEND_API int zend_delete_global_variable_ex(char *name, int name_len, ulong hash
}
/* }}} */
-ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_delete_global_variable(const char *name, int name_len TSRMLS_DC) /* {{{ */
{
return zend_delete_global_variable_ex(name, name_len, zend_inline_hash_func(name, name_len + 1) TSRMLS_CC);
}
View
2  Zend/zend_gc.h
@@ -84,7 +84,7 @@ typedef struct _gc_root_buffer {
zend_object_handle handle; /* must be 0 for zval */
union {
zval *pz;
- zend_object_handlers *handlers;
+ const zend_object_handlers *handlers;
} u;
} gc_root_buffer;
View
18 Zend/zend_hash.c
@@ -248,14 +248,14 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe
if (!p) {
return FAILURE;
}
- p->arKey = (char*)arKey;
+ p->arKey = arKey;
} else {
p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
if (!p) {
return FAILURE;
}
- p->arKey = (char*)(p + 1);
- memcpy(p->arKey, arKey, nKeyLength);
+ p->arKey = (const char*)(p + 1);
+ memcpy((char*)p->arKey, arKey, nKeyLength);
}
p->nKeyLength = nKeyLength;
INIT_DATA(ht, p, pData, nDataSize);
@@ -325,14 +325,14 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
if (!p) {
return FAILURE;
}
- p->arKey = (char*)arKey;
+ p->arKey = arKey;
} else {
p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
if (!p) {
return FAILURE;
}
- p->arKey = (char*)(p + 1);
- memcpy(p->arKey, arKey, nKeyLength);
+ p->arKey = (const char*)(p + 1);
+ memcpy((char*)p->arKey, arKey, nKeyLength);
}
p->nKeyLength = nKeyLength;
@@ -1157,7 +1157,7 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, char **str_index,
if (duplicate) {
*str_index = estrndup(p->arKey, p->nKeyLength - 1);
} else {
- *str_index = p->arKey;
+ *str_index = (char*)p->arKey;
}
if (str_length) {
*str_length = p->nKeyLength;
@@ -1402,8 +1402,8 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, const
if (IS_INTERNED(str_index)) {
p->arKey = str_index;
} else {
- p->arKey = (char*)(p+1);
- memcpy(p->arKey, str_index, str_length);
+ p->arKey = (const char*)(p+1);
+ memcpy((char*)p->arKey, str_index, str_length);
}
}
View
4 Zend/zend_hash.h
@@ -60,7 +60,7 @@ typedef struct bucket {
struct bucket *pListLast;
struct bucket *pNext;
struct bucket *pLast;
- char *arKey;
+ const char *arKey;
} Bucket;
typedef struct _hashtable {
@@ -83,7 +83,7 @@ typedef struct _hashtable {
typedef struct _zend_hash_key {
- char *arKey;
+ const char *arKey;
uint nKeyLength;
ulong h;
} zend_hash_key;
View
18 Zend/zend_highlight.c
@@ -56,12 +56,12 @@ ZEND_API void zend_html_putc(char c)
ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC)
{
- const char *ptr=s, *end=s+len;
- char *filtered;
- int filtered_len;
+ const unsigned char *ptr = (const unsigned char*)s, *end = ptr + len;
+ unsigned char *filtered;
+ size_t filtered_len;
if (LANG_SCNG(output_filter)) {
- LANG_SCNG(output_filter)(&filtered, &filtered_len, s, len TSRMLS_CC);
+ LANG_SCNG(output_filter)(&filtered, &filtered_len, ptr, len TSRMLS_CC);
ptr = filtered;
end = filtered + filtered_len;
}
@@ -115,7 +115,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
next_color = syntax_highlighter_ini->highlight_string;
break;
case T_WHITESPACE:
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */
+ zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */
token.type = 0;
continue;
break;
@@ -138,7 +138,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
}
}
- zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
+ zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
if (token.type == IS_STRING) {
switch (token_type) {
@@ -187,11 +187,11 @@ ZEND_API void zend_strip(TSRMLS_D)
continue;
case T_END_HEREDOC:
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
efree(token.value.str.val);
/* read the following character, either newline or ; */
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
}
zend_write("\n", sizeof("\n") - 1);
prev_space = 1;
@@ -199,7 +199,7 @@ ZEND_API void zend_strip(TSRMLS_D)
continue;
default:
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
break;
}
View
8 Zend/zend_indent.c
@@ -64,7 +64,7 @@ ZEND_API void zend_indent()
while ((token_type=lex_scan(&token TSRMLS_CC))) {
switch (token_type) {
case T_INLINE_HTML:
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
break;
case T_WHITESPACE: {
token.type = 0;
@@ -118,16 +118,16 @@ ZEND_API void zend_indent()
} else {
handle_whitespace(emit_whitespace);
}
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
break;
}
} else {
handle_whitespace(emit_whitespace);
if (in_string) {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
/* a part of a string */
} else {
- zend_write(LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
+ zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
}
}
break;
View
2  Zend/zend_interfaces.c
@@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
-ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
+ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
{
int result;
zend_fcall_info fci;
View
2  Zend/zend_interfaces.h
@@ -38,7 +38,7 @@ typedef struct _zend_user_iterator {
zval *value;
} zend_user_iterator;
-ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
+ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval **retval_ptr_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
View
4 Zend/zend_iterators.c
@@ -51,9 +51,7 @@ static zend_object_handlers iterator_object_handlers = {
ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
{
INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
- if (!IS_INTERNED(zend_iterator_class_entry.name)) {
- free(zend_iterator_class_entry.name);
- }
+ str_free(zend_iterator_class_entry.name);
zend_iterator_class_entry.name = "__iterator_wrapper";
}
View
2  Zend/zend_language_scanner.h
@@ -56,7 +56,7 @@ int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC);
ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC);
-ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC);
+ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding TSRMLS_DC);
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding TSRMLS_DC);
END_EXTERN_C()
View
27 Zend/zend_language_scanner.l
@@ -469,7 +469,8 @@ ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding TSR
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
{
- char *file_path = NULL, *buf;
+ const char *file_path = NULL;
+ char *buf;
size_t size, offset = 0;
/* The shebang line was read, get the current position to obtain the buffer start */
@@ -497,7 +498,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
if (size != -1) {
if (CG(multibyte)) {
- SCNG(script_org) = buf;
+ SCNG(script_org) = (unsigned char*)buf;
SCNG(script_org_size) = size;
SCNG(script_filtered) = NULL;
@@ -508,7 +509,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
zend_error_noreturn(E_COMPILE_ERROR, "Could not convert the script from the detected "
"encoding \"%s\" to a compatible encoding", zend_multibyte_get_encoding_name(LANG_SCNG(script_encoding)));
}
- buf = SCNG(script_filtered);
+ buf = (char*)SCNG(script_filtered);
size = SCNG(script_filtered_size);
}
}
@@ -663,7 +664,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
size = str->value.str.len;
if (CG(multibyte)) {
- SCNG(script_org) = buf;
+ SCNG(script_org) = (unsigned char*)buf;
SCNG(script_org_size) = size;
SCNG(script_filtered) = NULL;
@@ -674,7 +675,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
zend_error_noreturn(E_COMPILE_ERROR, "Could not convert the script from the detected "
"encoding \"%s\" to a compatible encoding", zend_multibyte_get_encoding_name(LANG_SCNG(script_encoding)));
}
- buf = SCNG(script_filtered);
+ buf = (char*)SCNG(script_filtered);
size = SCNG(script_filtered_size);
}
}
@@ -820,7 +821,7 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
return SUCCESS;
}
-ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, zend_encoding *old_encoding TSRMLS_DC)
+ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding TSRMLS_DC)
{
size_t length;
unsigned char *new_yy_start;
@@ -1552,7 +1553,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__CLASS__" {
- char *class_name = NULL;
+ const char *class_name = NULL;
if (CG(active_class_entry)
&& (ZEND_ACC_TRAIT ==
@@ -1579,7 +1580,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__TRAIT__" {
- char *trait_name = NULL;
+ const char *trait_name = NULL;
if (CG(active_class_entry)
&& (ZEND_ACC_TRAIT ==
@@ -1599,7 +1600,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__FUNCTION__" {
- char *func_name = NULL;
+ const char *func_name = NULL;
if (CG(active_op_array)) {
func_name = CG(active_op_array)->function_name;
@@ -1615,8 +1616,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<ST_IN_SCRIPTING>"__METHOD__" {
- char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
- char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
+ const char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL;
+ const char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL;
size_t len = 0;
if (class_name) {
@@ -1691,7 +1692,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}
<INITIAL>"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"'php'"){WHITESPACE}*">" {
- YYCTYPE *bracket = zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
+ YYCTYPE *bracket = (YYCTYPE*)zend_memrchr(yytext, '<', yyleng - (sizeof("script language=php>") - 1));
if (bracket != SCNG(yy_text)) {
/* Handle previously scanned HTML, as possible <script> tags found are assumed to not be PHP's */
@@ -1780,7 +1781,7 @@ inline_char_handler:
if (YYCURSOR < YYLIMIT) {
switch (*YYCURSOR) {
case '?':
- if (CG(short_tags) || !strncasecmp(YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
+ if (CG(short_tags) || !strncasecmp((char*)YYCURSOR + 1, "php", 3) || (*(YYCURSOR + 1) == '=')) { /* Assume [ \t\n\r] follows "php" */
break;
}
continue;
View
4 Zend/zend_list.c
@@ -113,8 +113,8 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
void *resource;
va_list resource_types;
int i;
- char *space;
- char *class_name;
+ const char *space;
+ const char *class_name;
if (default_id==-1) { /* use id */
if (!passed_id) {
View
12 Zend/zend_object_handlers.c
@@ -325,10 +325,10 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce
}
/* }}} */
-ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */
+ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
- char *class_name, *prop_name;
+ const char *class_name, *prop_name;
zval member;
zend_unmangle_property_name(prop_info_name, prop_info_name_len, &class_name, &prop_name);
@@ -1105,7 +1105,7 @@ static inline union _zend_function *zend_get_user_callstatic_function(zend_class
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
-ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_function *fbc = NULL;
char *lc_class_name, *lc_function_name = NULL;
@@ -1194,7 +1194,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *f
}
/* }}} */
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_property_info *property_info;
ulong hash_value;
@@ -1243,7 +1243,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
}
/* }}} */
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
{
zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
return 0;
@@ -1439,7 +1439,7 @@ zend_class_entry *zend_std_object_get_class(const zval *object TSRMLS_DC) /* {{{
}
/* }}} */
-int zend_std_object_get_class_name(const zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */
+int zend_std_object_get_class_name(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) /* {{{ */
{
zend_object *zobj;
zend_class_entry *ce;
View
12 Zend/zend_object_handlers.h
@@ -87,7 +87,7 @@ typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp TS
/* args on stack! */
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
-typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS);
+typedef int (*zend_object_call_method_t)(const char *method, INTERNAL_FUNCTION_PARAMETERS);
typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len, const struct _zend_literal *key TSRMLS_DC);
typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC);
@@ -98,7 +98,7 @@ typedef void (*zend_object_delete_obj_t)(zval *object TSRMLS_DC);
typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC);
typedef zend_class_entry *(*zend_object_get_class_entry_t)(const zval *object TSRMLS_DC);
-typedef int (*zend_object_get_class_name_t)(const zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
+typedef int (*zend_object_get_class_name_t)(const zval *object, const char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC);
/* Cast an object to some other type
@@ -144,9 +144,9 @@ struct _zend_object_handlers {
extern ZEND_API zend_object_handlers std_object_handlers;
BEGIN_EXTERN_C()
-ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
-ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, const char *function_name_strval, int function_name_strlen, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, zend_bool silent, const struct _zend_literal *key TSRMLS_DC);
+ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, const char *property_name, int property_name_len, const struct _zend_literal *key TSRMLS_DC);
ZEND_API union _zend_function *zend_std_get_constructor(zval *object TSRMLS_DC);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC);
ZEND_API HashTable *zend_std_get_properties(zval *object TSRMLS_DC);
@@ -163,7 +163,7 @@ ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce,
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
-ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC);
+ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info_name, int prop_info_name_len TSRMLS_DC);
ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS);
END_EXTERN_C()
View
30 Zend/zend_opcode.c
@@ -223,16 +223,16 @@ void _destroy_zend_class_traits_info(zend_class_entry *ce)
while (ce->trait_aliases[i]) {