Skip to content

Commit 4dd44bc

Browse files
committed
Constify more API char* arguments
1 parent caafc3d commit 4dd44bc

27 files changed

+79
-56
lines changed

ext/com_dotnet/com_olechar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "php_com_dotnet_internal.h"
2727

2828

29-
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, size_t string_len, int codepage)
29+
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(const char *string, size_t string_len, int codepage)
3030
{
3131
OLECHAR *olestring = NULL;
3232
DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS;

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ ITypeLib *php_com_cache_typelib(ITypeLib* TL, char *cache_key, zend_long cache_k
260260
return result;
261261
}
262262

263-
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
263+
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string,
264264
int codepage, int *cached)
265265
{
266266
ITypeLib *TL;

ext/com_dotnet/php_com_dotnet_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index
8282
/* com_olechar.c */
8383
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
8484
size_t *string_len, int codepage);
85-
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
85+
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(const char *string,
8686
size_t string_len, int codepage);
8787

8888

@@ -130,7 +130,7 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
130130
PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1);
131131

132132
/* com_typeinfo.c */
133-
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
133+
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string,
134134
int codepage, int *cached);
135135
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage);
136136
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,

ext/date/php_date.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *us
21872187
#endif
21882188
}
21892189

2190-
PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor) /* {{{ */
2190+
PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size_t time_str_len, const char *format, zval *timezone_object, int ctor) /* {{{ */
21912191
{
21922192
timelib_time *now;
21932193
timelib_tzinfo *tzi = NULL;
@@ -2205,7 +2205,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size
22052205
if (time_str_len == 0) {
22062206
time_str = "";
22072207
}
2208-
dateobj->time = timelib_parse_from_format(format, (char *) time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
2208+
// TODO: drop this const casts
2209+
dateobj->time = timelib_parse_from_format((char *) format, (char *) time_str, time_str_len, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
22092210
} else {
22102211
if (time_str_len == 0) {
22112212
time_str = "now";

ext/date/php_date.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ PHPAPI zend_class_entry *php_date_get_period_ce(void);
131131

132132
/* Functions for creating DateTime objects, and initializing them from a string */
133133
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object);
134-
PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size_t time_str_len, char *format, zval *timezone_object, int ctor);
134+
PHPAPI int php_date_initialize(php_date_obj *dateobj, const char *time_str, size_t time_str_len, const char *format, zval *timezone_object, int ctor);
135135

136136

137137
#endif /* PHP_DATE_H */

ext/json/json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static const char *php_json_get_error_msg(php_json_error_code error_code) /* {{{
195195
}
196196
/* }}} */
197197

198-
PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */
198+
PHP_JSON_API int php_json_decode_ex(zval *return_value, const char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */
199199
{
200200
php_json_parser parser;
201201

ext/json/json_parser.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static const php_json_parser_methods default_parser_methods =
301301

302302
PHP_JSON_API void php_json_parser_init_ex(php_json_parser *parser,
303303
zval *return_value,
304-
char *str,
304+
const char *str,
305305
size_t str_len,
306306
int options,
307307
int max_depth,
@@ -317,7 +317,7 @@ PHP_JSON_API void php_json_parser_init_ex(php_json_parser *parser,
317317

318318
PHP_JSON_API void php_json_parser_init(php_json_parser *parser,
319319
zval *return_value,
320-
char *str,
320+
const char *str,
321321
size_t str_len,
322322
int options,
323323
int max_depth)

ext/json/json_scanner.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int php_json_ucs2_to_int(php_json_scanner *s, int size)
9191
return php_json_ucs2_to_int_ex(s, size, 1);
9292
}
9393

94-
void php_json_scanner_init(php_json_scanner *s, char *str, size_t str_len, int options)
94+
void php_json_scanner_init(php_json_scanner *s, const char *str, size_t str_len, int options)
9595
{
9696
s->cursor = (php_json_ctype *) str;
9797
s->limit = (php_json_ctype *) str + str_len;

ext/json/php_json.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ ZEND_TSRMLS_CACHE_EXTERN()
9898

9999
PHP_JSON_API int php_json_encode_ex(smart_str *buf, zval *val, int options, zend_long depth);
100100
PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options);
101-
PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth);
101+
PHP_JSON_API int php_json_decode_ex(zval *return_value, const char *str, size_t str_len, zend_long options, zend_long depth);
102102

103-
static inline int php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth)
103+
static inline int php_json_decode(zval *return_value, const char *str, int str_len, zend_bool assoc, zend_long depth)
104104
{
105105
return php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth);
106106
}

ext/json/php_json_parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct _php_json_parser {
6161
PHP_JSON_API void php_json_parser_init_ex(
6262
php_json_parser *parser,
6363
zval *return_value,
64-
char *str,
64+
const char *str,
6565
size_t str_len,
6666
int options,
6767
int max_depth,
@@ -70,7 +70,7 @@ PHP_JSON_API void php_json_parser_init_ex(
7070
PHP_JSON_API void php_json_parser_init(
7171
php_json_parser *parser,
7272
zval *return_value,
73-
char *str,
73+
const char *str,
7474
size_t str_len,
7575
int options,
7676
int max_depth);

ext/json/php_json_scanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct _php_json_scanner {
4040
} php_json_scanner;
4141

4242

43-
void php_json_scanner_init(php_json_scanner *scanner, char *str, size_t str_len, int options);
43+
void php_json_scanner_init(php_json_scanner *scanner, const char *str, size_t str_len, int options);
4444
int php_json_scan(php_json_scanner *s);
4545

4646
#endif /* PHP_JSON_SCANNER_H */

ext/openssl/openssl.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6285,7 +6285,14 @@ static int php_openssl_cipher_update(const EVP_CIPHER *cipher_type,
62856285
/* }}} */
62866286

62876287

6288-
PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len, char *method, size_t method_len, char *password, size_t password_len, zend_long options, char *iv, size_t iv_len, zval *tag, zend_long tag_len, char *aad, size_t aad_len)
6288+
PHP_OPENSSL_API zend_string* php_openssl_encrypt(
6289+
const char *data, size_t data_len,
6290+
const char *method, size_t method_len,
6291+
const char *password, size_t password_len,
6292+
zend_long options,
6293+
const char *iv, size_t iv_len,
6294+
zval *tag, zend_long tag_len,
6295+
const char *aad, size_t aad_len)
62896296
{
62906297
const EVP_CIPHER *cipher_type;
62916298
EVP_CIPHER_CTX *cipher_ctx;
@@ -6394,7 +6401,14 @@ PHP_FUNCTION(openssl_encrypt)
63946401
}
63956402
/* }}} */
63966403

6397-
PHP_OPENSSL_API zend_string* php_openssl_decrypt(char *data, size_t data_len, char *method, size_t method_len, char *password, size_t password_len, zend_long options, char *iv, size_t iv_len, char *tag, zend_long tag_len, char *aad, size_t aad_len)
6404+
PHP_OPENSSL_API zend_string* php_openssl_decrypt(
6405+
const char *data, size_t data_len,
6406+
const char *method, size_t method_len,
6407+
const char *password, size_t password_len,
6408+
zend_long options,
6409+
const char *iv, size_t iv_len,
6410+
const char *tag, zend_long tag_len,
6411+
const char *aad, size_t aad_len)
63986412
{
63996413
const EVP_CIPHER *cipher_type;
64006414
EVP_CIPHER_CTX *cipher_ctx;
@@ -6493,7 +6507,7 @@ PHP_FUNCTION(openssl_decrypt)
64936507
}
64946508
/* }}} */
64956509

6496-
PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(char *method)
6510+
PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(const char *method)
64976511
{
64986512
const EVP_CIPHER *cipher_type;
64996513

ext/openssl/php_openssl.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,24 @@ php_stream_transport_factory_func php_openssl_ssl_socket_factory;
9292

9393
void php_openssl_store_errors();
9494

95-
PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(char *method);
95+
PHP_OPENSSL_API zend_long php_openssl_cipher_iv_length(const char *method);
9696
PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long length);
97-
PHP_OPENSSL_API zend_string* php_openssl_encrypt(char *data, size_t data_len,
98-
char *method, size_t method_len, char *password,
99-
size_t password_len, zend_long options, char *iv, size_t iv_len,
100-
zval *tag, zend_long tag_len, char *aad, size_t add_len);
101-
PHP_OPENSSL_API zend_string* php_openssl_decrypt(char *data, size_t data_len,
102-
char *method, size_t method_len, char *password,
103-
size_t password_len, zend_long options, char *iv, size_t iv_len,
104-
char *tag, zend_long tag_len, char *aad, size_t add_len);
97+
PHP_OPENSSL_API zend_string* php_openssl_encrypt(
98+
const char *data, size_t data_len,
99+
const char *method, size_t method_len,
100+
const char *password, size_t password_len,
101+
zend_long options,
102+
const char *iv, size_t iv_len,
103+
zval *tag, zend_long tag_len,
104+
const char *aad, size_t aad_len);
105+
PHP_OPENSSL_API zend_string* php_openssl_decrypt(
106+
const char *data, size_t data_len,
107+
const char *method, size_t method_len,
108+
const char *password, size_t password_len,
109+
zend_long options,
110+
const char *iv, size_t iv_len,
111+
const char *tag, zend_long tag_len,
112+
const char *aad, size_t aad_len);
105113

106114
PHP_MINIT_FUNCTION(openssl);
107115
PHP_MSHUTDOWN_FUNCTION(openssl);

ext/pcre/php_pcre.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static inline void add_offset_pair(
10381038
/* }}} */
10391039

10401040
static void populate_subpat_array(
1041-
zval *subpats, char *subject, PCRE2_SIZE *offsets, zend_string **subpat_names,
1041+
zval *subpats, const char *subject, PCRE2_SIZE *offsets, zend_string **subpat_names,
10421042
uint32_t num_subpats, int count, const PCRE2_SPTR mark, zend_long flags) {
10431043
zend_bool offset_capture = (flags & PREG_OFFSET_CAPTURE) != 0;
10441044
zend_bool unmatched_as_null = (flags & PREG_UNMATCHED_AS_NULL) != 0;
@@ -1531,7 +1531,7 @@ static int preg_get_backref(char **str, int *backref)
15311531

15321532
/* {{{ preg_do_repl_func
15331533
*/
1534-
static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cache *fcc, char *subject, PCRE2_SIZE *offsets, zend_string **subpat_names, uint32_t num_subpats, int count, const PCRE2_SPTR mark, zend_long flags)
1534+
static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cache *fcc, const char *subject, PCRE2_SIZE *offsets, zend_string **subpat_names, uint32_t num_subpats, int count, const PCRE2_SPTR mark, zend_long flags)
15351535
{
15361536
zend_string *result_str;
15371537
zval retval; /* Function return value */
@@ -1596,7 +1596,7 @@ PHPAPI zend_string *php_pcre_replace(zend_string *regex,
15961596
/* }}} */
15971597

15981598
/* {{{ php_pcre_replace_impl() */
1599-
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count)
1599+
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, const char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count)
16001600
{
16011601
uint32_t options; /* Execution options */
16021602
int count; /* Count of matched subpatterns */
@@ -1838,7 +1838,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
18381838
/* }}} */
18391839

18401840
/* {{{ php_pcre_replace_func_impl() */
1841-
static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, size_t subject_len, zend_fcall_info *fci, zend_fcall_info_cache *fcc, size_t limit, size_t *replace_count, zend_long flags)
1841+
static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_string *subject_str, const char *subject, size_t subject_len, zend_fcall_info *fci, zend_fcall_info_cache *fcc, size_t limit, size_t *replace_count, zend_long flags)
18421842
{
18431843
uint32_t options; /* Execution options */
18441844
int count; /* Count of matched subpatterns */

ext/pcre/php_pcre.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include <locale.h>
2727

28-
PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
28+
PHPAPI zend_string *php_pcre_replace(zend_string *regex, zend_string *subject_str, const char *subject, size_t subject_len, zend_string *replace_str, size_t limit, size_t *replace_count);
2929
PHPAPI pcre2_code* pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count);
3030
PHPAPI pcre2_code* pcre_get_compiled_regex_ex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options, uint32_t *coptions);
3131

@@ -53,7 +53,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
5353
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
5454
zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);
5555

56-
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, char *subject, size_t subject_len, zend_string *replace_str,
56+
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *subject_str, const char *subject, size_t subject_len, zend_string *replace_str,
5757
size_t limit, size_t *replace_count);
5858

5959
PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,

ext/pdo/pdo_sql_parser.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
#define YYFILL(n) { RET(PDO_PARSER_EOI); }
3737

3838
typedef struct Scanner {
39-
char *ptr, *cur, *tok, *end;
39+
const char *ptr, *cur, *tok, *end;
4040
} Scanner;
4141

4242
static int scan(Scanner *s)
4343
{
44-
char *cursor = s->cur;
44+
const char *cursor = s->cur;
4545

4646
s->tok = cursor;
4747
/*!re2c
@@ -81,7 +81,7 @@ static void free_param_name(zval *el) {
8181
efree(Z_PTR_P(el));
8282
}
8383

84-
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len,
84+
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, const char *inquery, size_t inquery_len,
8585
char **outquery, size_t *outquery_len)
8686
{
8787
Scanner s;

ext/pdo/php_pdo_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ PDO_API int php_pdo_parse_data_source(const char *data_source,
677677
PDO_API zend_class_entry *php_pdo_get_dbh_ce(void);
678678
PDO_API zend_class_entry *php_pdo_get_exception(void);
679679

680-
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, size_t inquery_len,
680+
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, const char *inquery, size_t inquery_len,
681681
char **outquery, size_t *outquery_len);
682682

683683
PDO_API void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt,

ext/standard/sha1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "sha1.h"
2222
#include "md5.h"
2323

24-
PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest)
24+
PHPAPI void make_sha1_digest(char *sha1str, const unsigned char *digest)
2525
{
2626
make_digest_ex(sha1str, digest, 20);
2727
}

ext/standard/sha1.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ typedef struct {
2929
PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *);
3030
PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t);
3131
PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
32-
PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest);
32+
PHPAPI void make_sha1_digest(char *sha1str, const unsigned char *digest);
3333

3434
#endif

sapi/phpdbg/phpdbg_cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, zend_bool allow_async
737737
return SUCCESS;
738738
} /* }}} */
739739

740-
PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
740+
PHPDBG_API char *phpdbg_read_input(const char *buffered) /* {{{ */
741741
{
742742
char buf[PHPDBG_MAX_CMD];
743743
char *cmd = NULL;

sapi/phpdbg/phpdbg_cmd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ typedef struct {
125125
/*
126126
* Input Management
127127
*/
128-
PHPDBG_API char* phpdbg_read_input(char *buffered);
129-
PHPDBG_API void phpdbg_destroy_input(char**);
128+
PHPDBG_API char *phpdbg_read_input(const char *buffered);
129+
PHPDBG_API void phpdbg_destroy_input(char **input);
130130
PHPDBG_API int phpdbg_ask_user_permission(const char *question);
131131

132132
/**

sapi/phpdbg/phpdbg_print.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void phpdbg_print_opcodes_class(const char *class) {
375375
phpdbg_print_opcodes_ce(ce);
376376
}
377377

378-
PHPDBG_API void phpdbg_print_opcodes(char *function)
378+
PHPDBG_API void phpdbg_print_opcodes(const char *function)
379379
{
380380
if (function == NULL) {
381381
phpdbg_print_opcodes_main();
@@ -401,19 +401,19 @@ PHPDBG_API void phpdbg_print_opcodes(char *function)
401401
}
402402
} ZEND_HASH_FOREACH_END();
403403
} else {
404-
function = zend_str_tolower_dup(function, strlen(function));
404+
char *function_lowercase = zend_str_tolower_dup(function, strlen(function));
405405

406-
if (strstr(function, "::") == NULL) {
407-
phpdbg_print_opcodes_function(function, strlen(function));
406+
if (strstr(function_lowercase, "::") == NULL) {
407+
phpdbg_print_opcodes_function(function_lowercase, strlen(function_lowercase));
408408
} else {
409-
char *method_name, *class_name = strtok(function, "::");
409+
char *method_name, *class_name = strtok(function_lowercase, "::");
410410
if ((method_name = strtok(NULL, "::")) == NULL) {
411411
phpdbg_print_opcodes_class(class_name);
412412
} else {
413413
phpdbg_print_opcodes_method(class_name, method_name);
414414
}
415415
}
416416

417-
efree(function);
417+
efree(function_lowercase);
418418
}
419419
}

sapi/phpdbg/phpdbg_print.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PHPDBG_PRINT(method);
3333
PHPDBG_PRINT(func);
3434
PHPDBG_PRINT(stack);
3535

36-
PHPDBG_API void phpdbg_print_opcodes(char *function);
36+
PHPDBG_API void phpdbg_print_opcodes(const char *function);
3737

3838
extern const phpdbg_command_t phpdbg_print_commands[];
3939

sapi/phpdbg/phpdbg_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,11 @@ static int phpdbg_parse_variable_arg_wrapper(char *name, size_t len, char *keyna
424424
return callback(name, len, keyname, keylen, parent, zv);
425425
}
426426

427-
PHPDBG_API int phpdbg_parse_variable(char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_func callback, zend_bool silent) {
427+
PHPDBG_API int phpdbg_parse_variable(const char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_func callback, zend_bool silent) {
428428
return phpdbg_parse_variable_with_arg(input, len, parent, i, (phpdbg_parse_var_with_arg_func) phpdbg_parse_variable_arg_wrapper, NULL, silent, callback);
429429
}
430430

431-
PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_with_arg_func callback, phpdbg_parse_var_with_arg_func step_cb, zend_bool silent, void *arg) {
431+
PHPDBG_API int phpdbg_parse_variable_with_arg(const char *input, size_t len, HashTable *parent, size_t i, phpdbg_parse_var_with_arg_func callback, phpdbg_parse_var_with_arg_func step_cb, zend_bool silent, void *arg) {
432432
int ret = FAILURE;
433433
zend_bool new_index = 1;
434434
char *last_index = NULL;

0 commit comments

Comments
 (0)