Skip to content

String size refactor take 2 next wave #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
fc16b92
Fix bug #46311: Pointer aliasing issue results in miscompile on gcc4.4
nikic Aug 22, 2013
4db494a
Merge branch 'PHP-5.5'
nikic Aug 22, 2013
e212320
Remove duplicate calls to set filename & lineno for the DTRACE_FUNCTI…
cjbj Aug 20, 2013
b668a26
Fix pgsql notice test failure
nikic Aug 22, 2013
592677d
Fix intl build
nikic Aug 22, 2013
647059a
Merge branch 'PHP-5.5'
nikic Aug 22, 2013
96045e1
Forgot newline in test
nikic Aug 22, 2013
1a88fcc
Remove trailing whitespace in test
nikic Aug 22, 2013
c0d99fd
Apply pgsql notice test fixes to PHP-5.5
nikic Aug 22, 2013
926987b
Merge branch 'PHP-5.5'
nikic Aug 22, 2013
d598747
Fixed other compiler warnings
mbeccati Aug 22, 2013
908da14
Merge branch 'PHP-5.4' into PHP-5.5
mbeccati Aug 22, 2013
80917e5
Merge branch 'PHP-5.5'
mbeccati Aug 22, 2013
320e82b
trivial fix spl_autoload_functions()
weltling Aug 22, 2013
5efaa8f
adapted the function args for ereg
weltling Aug 22, 2013
a61f5bf
Revert "Suppress compliation warning "warning: passing argument 1 of …
cjbj Aug 22, 2013
f2ceb49
Revert "Suppress compliation warning "warning: passing argument 1 of …
cjbj Aug 22, 2013
18282f4
Revert "Suppress compliation warning "warning: passing argument 1 of …
cjbj Aug 22, 2013
7109f36
Suppress compliation warning "warning: passing argument 1 of ‘_efree’…
cjbj Aug 22, 2013
c1ecdfb
Merge branch 'PHP-5.4' into PHP-5.5
cjbj Aug 22, 2013
27954a8
Merge branch 'PHP-5.5'
cjbj Aug 22, 2013
6b474bb
adapted all the function arg formats in ext/zlib
weltling Aug 23, 2013
5ab6d21
Remove duplicate calls to set filename & lineno for the DTRACE_FUNCTI…
cjbj Aug 20, 2013
686402a
Merge branch 'PHP-5.4' into PHP-5.5
nikic Aug 23, 2013
c0856a1
Merge branch 'PHP-5.5'
nikic Aug 23, 2013
f2a4f31
fixed ext/pcre internal stuff
weltling Aug 23, 2013
2a28a30
fix pcre usage in spl
weltling Aug 23, 2013
3d49768
fixed set process_title()
weltling Aug 23, 2013
a2b1546
ensure the test doesn't fail because of tz warning
weltling Aug 23, 2013
77303a3
Merge branch 'PHP-5.5'
weltling Aug 23, 2013
38f9c51
Update NEWS
cjbj Aug 23, 2013
716fc80
Suppress static analyzer warnings in specialized executor
weltling Aug 23, 2013
07fa043
Merge branch 'PHP-5.5'
weltling Aug 23, 2013
644278c
Merge branch 'master' of https://github.com/php/php-src into string_s…
weltling Aug 23, 2013
9382c75
replaced all the arg formats and Z_STRLEN
weltling Aug 24, 2013
2bf8f91
fixed sapi filter usage
weltling Aug 24, 2013
2545fbb
fixed the mb_regex* stuff
weltling Aug 24, 2013
1492bc1
adapted args in ext/intl
weltling Aug 24, 2013
07b87a2
Z_STRLEN vs Z_STRSIZE in ext/intl
weltling Aug 24, 2013
14f8e16
more fixes to ext/intl
weltling Aug 24, 2013
9c81da4
ext/intl further converting
weltling Aug 26, 2013
6e4395b
ext/intl further fixes
weltling Aug 26, 2013
3266be8
fixed ext/iconv
weltling Aug 27, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Zend/zend_dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
}

if (DTRACE_FUNCTION_ENTRY_ENABLED() || DTRACE_FUNCTION_RETURN_ENABLED()) {
filename = dtrace_get_executed_filename(TSRMLS_C);
classname = get_active_class_name(&scope TSRMLS_CC);
funcname = get_active_function_name(TSRMLS_C);
lineno = zend_get_executed_lineno(TSRMLS_C);
}

if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static zend_always_inline void zend_vm_stack_clear_multiple(int nested TSRMLS_DC
void **end = p - (int)(zend_uintptr_t)*p;

while (p != end) {
zval *q = *(zval **)(--p);
zval *q = (zval *) *(--p);
*p = NULL;
i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
}
Expand Down
7 changes: 7 additions & 0 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

#ifdef ZEND_WIN32
# pragma warning(once : 4101)
# pragma warning(once : 6235)
# pragma warning(once : 6237)
# pragma warning(once : 6239)
# pragma warning(once : 6240)
# pragma warning(once : 6285)
# pragma warning(once : 6286)
# pragma warning(once : 6326)
#endif
static user_opcode_handler_t zend_user_opcode_handlers[256] = {
(user_opcode_handler_t)NULL,
Expand Down
20 changes: 19 additions & 1 deletion Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -1216,8 +1216,26 @@ function gen_vm($def, $skel) {
// Insert header
out($f, $GLOBALS['header_text']);

out($f, "#ifdef ZEND_WIN32\n");
// Suppress free_op1 warnings on Windows
out($f, "#ifdef ZEND_WIN32\n# pragma warning(once : 4101)\n#endif\n");
out($f, "# pragma warning(once : 4101)\n");
if (ZEND_VM_SPEC) {
// Suppress (<non-zero constant> || <expression>) warnings on windows
out($f, "# pragma warning(once : 6235)\n");
// Suppress (<zero> && <expression>) warnings on windows
out($f, "# pragma warning(once : 6237)\n");
// Suppress (<non-zero constant> && <expression>) warnings on windows
out($f, "# pragma warning(once : 6239)\n");
// Suppress (<expression> && <non-zero constant>) warnings on windows
out($f, "# pragma warning(once : 6240)\n");
// Suppress (<non-zero constant> || <non-zero constant>) warnings on windows
out($f, "# pragma warning(once : 6285)\n");
// Suppress (<non-zero constant> || <expression>) warnings on windows
out($f, "# pragma warning(once : 6286)\n");
// Suppress constant with constant comparsion warnings on windows
out($f, "# pragma warning(once : 6326)\n");
}
out($f, "#endif\n");

// Support for ZEND_USER_OPCODE
out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");
Expand Down
2 changes: 2 additions & 0 deletions ext/date/tests/bug65184.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
die("skip Test is valid for Windows");
}
?>
--INI--
date.timezone = UTC
--FILE--
<?php
setlocale(LC_ALL, 'Japanese_Japan.932');
Expand Down
16 changes: 8 additions & 8 deletions ext/ereg/ereg.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
zval **regex, /* Regular expression */
**array = NULL; /* Optional register array */
char *findin; /* String to apply expression to */
int findin_len;
zend_str_size_int findin_len;
regex_t re;
regmatch_t *subs;
int err, match_len, string_len;
Expand All @@ -302,7 +302,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
char *string = NULL;
int argc = ZEND_NUM_ARGS();

if (zend_parse_parameters(argc TSRMLS_CC, "Zs|Z", &regex, &findin, &findin_len, &array) == FAILURE) {
if (zend_parse_parameters(argc TSRMLS_CC, "ZS|Z", &regex, &findin, &findin_len, &array) == FAILURE) {
return;
}

Expand Down Expand Up @@ -555,9 +555,9 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
char *string;
char *replace;
char *ret;
int arg_string_len;
zend_str_size_int arg_string_len;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZs", &arg_pattern, &arg_replace, &arg_string, &arg_string_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZS", &arg_pattern, &arg_replace, &arg_string, &arg_string_len) == FAILURE) {
return;
}

Expand Down Expand Up @@ -632,10 +632,10 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
regex_t re;
regmatch_t subs[1];
char *spliton, *str, *strp, *endp;
int spliton_len, str_len;
zend_str_size_int spliton_len, str_len;
int err, size, copts = 0;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) {
return;
}

Expand Down Expand Up @@ -731,11 +731,11 @@ PHP_FUNCTION(spliti)
PHP_EREG_API PHP_FUNCTION(sql_regcase)
{
char *string, *tmp;
int string_len;
zend_str_size_int string_len;
unsigned char c;
register int i, j;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &string, &string_len) == FAILURE) {
return;
}

Expand Down
73 changes: 37 additions & 36 deletions ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
size_t ini_in_left;
const char *ini_in_p;
size_t out_reserved = 4;
int dummy;
zend_str_size_int dummy;

smart_str_appendc(pretval, 'B');
char_cnt--;
Expand Down Expand Up @@ -1723,7 +1723,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
case '\r': case '\n': case ' ': case '\t': {
char *decoded_text;
size_t decoded_text_len;
int dummy;
zend_str_size_int dummy;

switch (enc_scheme) {
case PHP_ICONV_ENC_SCHEME_BASE64:
Expand Down Expand Up @@ -1958,15 +1958,15 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset,
PHP_FUNCTION(iconv_strlen)
{
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
char *str;
int str_len;
zend_str_size_int str_len;

php_iconv_err_t err;

unsigned int retval;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S",
&str, &str_len, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
}
Expand All @@ -1991,16 +1991,16 @@ PHP_FUNCTION(iconv_strlen)
PHP_FUNCTION(iconv_substr)
{
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
char *str;
int str_len;
zend_str_size_int str_len;
long offset, length = 0;

php_iconv_err_t err;

smart_str retval = {0};

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|lS",
&str, &str_len, &offset, &length,
&charset, &charset_len) == FAILURE) {
RETURN_FALSE;
Expand Down Expand Up @@ -2031,18 +2031,18 @@ PHP_FUNCTION(iconv_substr)
PHP_FUNCTION(iconv_strpos)
{
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
char *haystk;
int haystk_len;
zend_str_size_int haystk_len;
char *ndl;
int ndl_len;
zend_str_size_int ndl_len;
long offset = 0;

php_iconv_err_t err;

unsigned int retval;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|lS",
&haystk, &haystk_len, &ndl, &ndl_len,
&offset, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
Expand Down Expand Up @@ -2079,17 +2079,17 @@ PHP_FUNCTION(iconv_strpos)
PHP_FUNCTION(iconv_strrpos)
{
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
char *haystk;
int haystk_len;
zend_str_size_int haystk_len;
char *ndl;
int ndl_len;
zend_str_size_int ndl_len;

php_iconv_err_t err;

unsigned int retval;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|S",
&haystk, &haystk_len, &ndl, &ndl_len,
&charset, &charset_len) == FAILURE) {
RETURN_FALSE;
Expand Down Expand Up @@ -2121,9 +2121,9 @@ PHP_FUNCTION(iconv_strrpos)
PHP_FUNCTION(iconv_mime_encode)
{
const char *field_name = NULL;
int field_name_len;
zend_str_size_int field_name_len;
const char *field_value = NULL;
int field_value_len;
zend_str_size_int field_value_len;
zval *pref = NULL;
zval tmp_zv, *tmp_zv_p = NULL;
smart_str retval = {0};
Expand All @@ -2135,7 +2135,7 @@ PHP_FUNCTION(iconv_mime_encode)
const char *lfchars = "\r\n";
php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|a",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|a",
&field_name, &field_name_len, &field_value, &field_value_len,
&pref) == FAILURE) {

Expand All @@ -2146,7 +2146,7 @@ PHP_FUNCTION(iconv_mime_encode)
zval **ppval;

if (zend_hash_find(Z_ARRVAL_P(pref), "scheme", sizeof("scheme"), (void **)&ppval) == SUCCESS) {
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRLEN_PP(ppval) > 0) {
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRSIZE_PP(ppval) > 0) {
switch (Z_STRVAL_PP(ppval)[0]) {
case 'B': case 'b':
scheme_id = PHP_ICONV_ENC_SCHEME_BASE64;
Expand All @@ -2160,24 +2160,24 @@ PHP_FUNCTION(iconv_mime_encode)
}

if (zend_hash_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset"), (void **)&ppval) == SUCCESS) {
if (Z_STRLEN_PP(ppval) >= ICONV_CSNMAXLEN) {
if (Z_STRSIZE_PP(ppval) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}

if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRLEN_PP(ppval) > 0) {
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRSIZE_PP(ppval) > 0) {
in_charset = Z_STRVAL_PP(ppval);
}
}


if (zend_hash_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset"), (void **)&ppval) == SUCCESS) {
if (Z_STRLEN_PP(ppval) >= ICONV_CSNMAXLEN) {
if (Z_STRSIZE_PP(ppval) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
RETURN_FALSE;
}

if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRLEN_PP(ppval) > 0) {
if (Z_TYPE_PP(ppval) == IS_STRING && Z_STRSIZE_PP(ppval) > 0) {
out_charset = Z_STRVAL_PP(ppval);
}
}
Expand Down Expand Up @@ -2241,16 +2241,16 @@ PHP_FUNCTION(iconv_mime_encode)
PHP_FUNCTION(iconv_mime_decode)
{
char *encoded_str;
int encoded_str_len;
zend_str_size_int encoded_str_len;
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
long mode = 0;

smart_str retval = {0};

php_iconv_err_t err;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) {

RETURN_FALSE;
Expand Down Expand Up @@ -2282,14 +2282,14 @@ PHP_FUNCTION(iconv_mime_decode)
PHP_FUNCTION(iconv_mime_decode_headers)
{
const char *encoded_str;
int encoded_str_len;
zend_str_size_int encoded_str_len;
char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zend_str_size_int charset_len = 0;
long mode = 0;

php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|lS",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) {

RETURN_FALSE;
Expand Down Expand Up @@ -2380,10 +2380,10 @@ PHP_NAMED_FUNCTION(php_if_iconv)
{
char *in_charset, *out_charset, *in_buffer, *out_buffer;
size_t out_len;
int in_charset_len = 0, out_charset_len = 0, in_buffer_len;
zend_str_size_int in_charset_len = 0, out_charset_len = 0, in_buffer_len;
php_iconv_err_t err;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss",
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSS",
&in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer, &in_buffer_len) == FAILURE)
return;

Expand Down Expand Up @@ -2411,9 +2411,10 @@ PHP_NAMED_FUNCTION(php_if_iconv)
PHP_FUNCTION(iconv_set_encoding)
{
char *type, *charset;
int type_len, charset_len =0, retval;
zend_str_size_int type_len, charset_len =0;
int retval;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &type, &type_len, &charset, &charset_len) == FAILURE)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &type, &type_len, &charset, &charset_len) == FAILURE)
return;

if (charset_len >= ICONV_CSNMAXLEN) {
Expand Down Expand Up @@ -2444,9 +2445,9 @@ PHP_FUNCTION(iconv_set_encoding)
PHP_FUNCTION(iconv_get_encoding)
{
char *type = "all";
int type_len = sizeof("all")-1;
zend_str_size_int type_len = sizeof("all")-1;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S", &type, &type_len) == FAILURE)
return;

if (!strcasecmp("all", type)) {
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/breakiterator/breakiterator_iterators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_
* No need to do anything, the engine increments ->index */

const char *s = Z_STRVAL_P(bio->text);
int32_t slen = Z_STRLEN_P(bio->text),
int32_t slen = Z_STRSIZE_P(bio->text),
len;
char *res;

Expand Down Expand Up @@ -251,7 +251,7 @@ U_CFUNC zend_object_value IntlPartsIterator_object_create(zend_class_entry *ce T
}

U_CFUNC zend_function *IntlPartsIterator_get_method(zval **object_ptr,
char *method, int method_len, const zend_literal *key TSRMLS_DC)
char *method, zend_str_size_int method_len, const zend_literal *key TSRMLS_DC)
{
zend_literal local_literal = {0};
zend_function *ret;
Expand Down
Loading