diff options
author | Anatol Belski <ab@php.net> | 2014-08-19 08:07:31 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-19 08:07:31 +0200 |
commit | 63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc (patch) | |
tree | e561a58d6e084c5e4cbdde1f84aed16cf4724383 /ext | |
parent | 1e8273964fbd517a2eb9e560f9cdb4afffa0c034 (diff) | |
download | php-git-63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc.tar.gz |
basic macro replacements, all at once
Diffstat (limited to 'ext')
219 files changed, 4398 insertions, 4398 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 4b8c7c5f18..af302b0503 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -525,7 +525,7 @@ PHP_FUNCTION(bccomp) bc_str2num(&first, left, scale TSRMLS_CC); bc_str2num(&second, right, scale TSRMLS_CC); - RETVAL_LONG(bc_compare(first, second)); + RETVAL_INT(bc_compare(first, second)); bc_free_num(&first); bc_free_num(&second); diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index db4e834a20..a3697c73b6 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -393,7 +393,7 @@ static PHP_FUNCTION(bzopen) /* If it's not a resource its a string containing the filename to open */ if (Z_TYPE_P(file) == IS_STRING) { - if (Z_STRLEN_P(file) == 0) { + if (Z_STRSIZE_P(file) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty"); RETURN_FALSE; } @@ -527,7 +527,7 @@ static PHP_FUNCTION(bzcompress) error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor); if (error != BZ_OK) { STR_FREE(dest); - RETURN_LONG(error); + RETURN_INT(error); } else { /* Copy the buffer, we have perhaps allocate a lot more than we need, so we erealloc() the buffer to the proper size */ @@ -586,7 +586,7 @@ static PHP_FUNCTION(bzdecompress) efree(dest); } else { /* real error */ efree(dest); - RETVAL_LONG(error); + RETVAL_INT(error); } BZ2_bzDecompressEnd(&bzs); @@ -621,7 +621,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) /* Determine what to return */ switch (opt) { case PHP_BZ_ERRNO: - RETURN_LONG(errnum); + RETURN_INT(errnum); break; case PHP_BZ_ERRSTR: RETURN_STRING((char*)errstr); @@ -629,7 +629,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) case PHP_BZ_ERRBOTH: array_init(return_value); - add_assoc_long (return_value, "errno", errnum); + add_assoc_int (return_value, "errno", errnum); add_assoc_string(return_value, "errstr", (char*)errstr); break; } diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index ea3b0de692..f32226bc84 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -380,11 +380,11 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi zval tmp; ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); - if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_LVAL_P(tmpzval)); + convert_to_int(&tmp); + if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_IVAL_P(tmpzval)); } else { - blockSize100k = Z_LVAL(tmp); + blockSize100k = Z_IVAL(tmp); } } @@ -393,12 +393,12 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi zval tmp; ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); - if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_IVAL(tmp)); } else { - workFactor = Z_LVAL(tmp); + workFactor = Z_IVAL(tmp); } } } diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 99adfd3563..d5eff4b90a 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd) RETURN_FALSE; } - RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); + RETURN_INT(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); } /* }}} */ @@ -64,7 +64,7 @@ PHP_FUNCTION(jdtounix) RETURN_FALSE; } - RETURN_LONG(uday * 24 * 3600); + RETURN_INT(uday * 24 * 3600); } /* }}} */ diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 6590eee903..bea7669284 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -225,31 +225,31 @@ static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú"; PHP_MINIT_FUNCTION(calendar) { - REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); /* constants for jddayofweek */ - REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); /* constants for jdmonthname */ - REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); /* constants for easter calculation */ - REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); /* constants for Jewish date formatting */ - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -279,7 +279,7 @@ static void _php_cal_info(int cal, zval *ret) add_assoc_zval(ret, "months", &months); add_assoc_zval(ret, "abbrevmonths", &smonths); - add_assoc_long(ret, "maxdaysinmonth", calendar->max_days_in_month); + add_assoc_int(ret, "maxdaysinmonth", calendar->max_days_in_month); add_assoc_string(ret, "calname", calendar->name); add_assoc_string(ret, "calsymbol", calendar->symbol); @@ -360,7 +360,7 @@ PHP_FUNCTION(cal_days_in_month) } } - RETURN_LONG(sdn_next - sdn_start); + RETURN_INT(sdn_next - sdn_start); } /* }}} */ @@ -379,7 +379,7 @@ PHP_FUNCTION(cal_to_jd) RETURN_FALSE; } - RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day)); + RETURN_INT(cal_conversion_table[cal].to_jd(year, month, day)); } /* }}} */ @@ -409,13 +409,13 @@ PHP_FUNCTION(cal_from_jd) snprintf(date, sizeof(date), "%i/%i/%i", month, day, year); add_assoc_string(return_value, "date", date); - add_assoc_long(return_value, "month", month); - add_assoc_long(return_value, "day", day); - add_assoc_long(return_value, "year", year); + add_assoc_int(return_value, "month", month); + add_assoc_int(return_value, "day", day); + add_assoc_int(return_value, "year", year); /* day of week */ dow = DayOfWeek(jd); - add_assoc_long(return_value, "dow", dow); + add_assoc_int(return_value, "dow", dow); add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]); add_assoc_string(return_value, "dayname", DayNameLong[dow]); /* month name */ @@ -459,7 +459,7 @@ PHP_FUNCTION(gregoriantojd) RETURN_FALSE; } - RETURN_LONG(GregorianToSdn(year, month, day)); + RETURN_INT(GregorianToSdn(year, month, day)); } /* }}} */ @@ -492,7 +492,7 @@ PHP_FUNCTION(juliantojd) RETURN_FALSE; } - RETURN_LONG(JulianToSdn(year, month, day)); + RETURN_INT(JulianToSdn(year, month, day)); } /* }}} */ @@ -640,7 +640,7 @@ PHP_FUNCTION(jewishtojd) RETURN_FALSE; } - RETURN_LONG(JewishToSdn(year, month, day)); + RETURN_INT(JewishToSdn(year, month, day)); } /* }}} */ @@ -673,7 +673,7 @@ PHP_FUNCTION(frenchtojd) RETURN_FALSE; } - RETURN_LONG(FrenchToSdn(year, month, day)); + RETURN_INT(FrenchToSdn(year, month, day)); } /* }}} */ @@ -702,7 +702,7 @@ PHP_FUNCTION(jddayofweek) break; case CAL_DOW_DAYNO: default: - RETURN_LONG(day); + RETURN_INT(day); break; } } diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c index 82c0aa633c..f0e7d276c5 100644 --- a/ext/calendar/easter.c +++ b/ext/calendar/easter.c @@ -115,7 +115,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) } else { /* return the days after March 21 */ result = easter; } - ZVAL_LONG(return_value, result); + ZVAL_INT(return_value, result); } /* {{{ proto int easter_date([int year]) diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 6d3b15876f..7f1cadabde 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance) "Server", sizeof("Server")-1))) { convert_to_string_ex(tmp); server_name = Z_STRVAL_P(tmp); - server_name_len = Z_STRLEN_P(tmp); + server_name_len = Z_STRSIZE_P(tmp); ctx = CLSCTX_REMOTE_SERVER; } @@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance) "Username", sizeof("Username")-1))) { convert_to_string_ex(tmp); user_name = Z_STRVAL_P(tmp); - user_name_len = Z_STRLEN_P(tmp); + user_name_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Password", sizeof("Password")-1))) { convert_to_string_ex(tmp); password = Z_STRVAL_P(tmp); - password_len = Z_STRLEN_P(tmp); + password_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Domain", sizeof("Domain")-1))) { convert_to_string_ex(tmp); domain_name = Z_STRVAL_P(tmp); - domain_name_len = Z_STRLEN_P(tmp); + domain_name_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Flags", sizeof("Flags")-1))) { - convert_to_long_ex(tmp); - ctx = (CLSCTX)Z_LVAL_P(tmp); + convert_to_int_ex(tmp); + ctx = (CLSCTX)Z_IVAL_P(tmp); } } @@ -427,7 +427,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, } if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) { - *dispid = Z_LVAL_P(tmp); + *dispid = Z_IVAL_P(tmp); return S_OK; } @@ -456,7 +456,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, ALLOC_HASHTABLE(obj->id_of_name_cache); zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0); } - ZVAL_LONG(&tmp, *dispid); + ZVAL_INT(&tmp, *dispid); zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp); } diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 0ba33a9b1a..ce891ebf3e 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -381,7 +381,7 @@ PHP_MINIT_FUNCTION(com_dotnet) REGISTER_INI_ENTRIES(); -#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) +#define COM_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) COM_CONST(CLSCTX_INPROC_SERVER); COM_CONST(CLSCTX_INPROC_HANDLER); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 0d83a86648..791aaeb5cc 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -44,7 +44,7 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc convert_to_string_ex(member); - res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC); if (res == SUCCESS) { @@ -71,7 +71,7 @@ static void com_property_write(zval *object, zval *member, zval *value, void **c VariantInit(&v); convert_to_string_ex(member); - if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -98,10 +98,10 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T VariantClear(&v); } } else if (V_ISARRAY(&obj->v)) { - convert_to_long(offset); + convert_to_int(offset); if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { - if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) { + if (php_com_safearray_get_elem(&obj->v, &v, Z_IVAL_P(offset) TSRMLS_CC)) { php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC); VariantClear(&v); } @@ -144,8 +144,8 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D vt = V_VT(&obj->v) & ~VT_ARRAY; } - convert_to_long(offset); - indices = Z_LVAL_P(offset); + convert_to_int(offset); + indices = Z_IVAL_P(offset); VariantInit(&v); php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC); @@ -197,7 +197,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void if (V_VT(&obj->v) == VT_DISPATCH) { convert_to_string_ex(member); - if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid TSRMLS_CC))) { + if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), &dispid TSRMLS_CC))) { /* TODO: distinguish between property and method! */ return 1; } @@ -491,7 +491,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC) } switch(type) { - case IS_LONG: + case IS_INT: vt = VT_INT; break; case IS_DOUBLE: diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 7da10f1b66..80323a8797 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -78,7 +78,7 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC) if (I->key == (ulong)-1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 66e3dec640..4a85a7c8df 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -506,7 +506,7 @@ CPH_METHOD(GetMaxStreamSize) php_com_throw_exception(res, NULL TSRMLS_CC); } else { /* TODO: handle 64 bit properly */ - RETURN_LONG((LONG)size.QuadPart); + RETURN_INT((LONG)size.QuadPart); } } /* }}} */ diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 9b3716f43a..d8aabeeca0 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * VariantInit(&v); res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, + Z_STRSIZE(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, proxy->dimensions, args, 0 TSRMLS_CC); if (res == SUCCESS) { @@ -134,7 +134,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* the SafeArray case */ /* offset/index must be an integer */ - convert_to_long(offset); + convert_to_int(offset); sa = V_ARRAY(&proxy->obj->v); dims = SafeArrayGetDim(sa); @@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * SafeArrayGetLBound(sa, proxy->dimensions, &lbound); SafeArrayGetUBound(sa, proxy->dimensions, &ubound); - if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) { + if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC); return rv; } @@ -166,12 +166,12 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_long(&proxy->indices[i]); - indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + indices[i] = Z_IVAL(proxy->indices[i]); } /* add user-supplied index */ - indices[dims-1] = Z_LVAL_P(offset); + indices[dims-1] = Z_IVAL_P(offset); /* now fetch the value */ if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { @@ -225,7 +225,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM convert_to_string(&proxy->indices[0]); VariantInit(&v); if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, + Z_STRSIZE(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, args, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -240,13 +240,13 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM indices = safe_emalloc(dims, sizeof(LONG), 0); /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_long(&proxy->indices[i]); - indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + indices[i] = Z_IVAL(proxy->indices[i]); } /* add user-supplied index */ - convert_to_long(offset); - indices[dims-1] = Z_LVAL_P(offset); + convert_to_int(offset); + indices[dims-1] = Z_IVAL_P(offset); if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) { vt = V_VT(&proxy->obj->v) & ~VT_ARRAY; @@ -516,7 +516,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC if (I->key == -1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } @@ -560,8 +560,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0); for (i = 0; i < proxy->dimensions; i++) { - convert_to_long(&proxy->indices[i]); - I->indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + I->indices[i] = Z_IVAL(proxy->indices[i]); } SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin); diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 46a3cbd5a1..0cb8c4de28 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -208,9 +208,9 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa /* register the constant */ php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC); - if (Z_TYPE(value) == IS_LONG) { + if (Z_TYPE(value) == IS_INT) { c.flags = mode; - ZVAL_LONG(&c.value, Z_LVAL(value)); + ZVAL_INT(&c.value, Z_IVAL(value)); c.module_number = 0; zend_register_constant(&c TSRMLS_CC); } diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index f7dbdd5efa..ee013ee0e7 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -145,9 +145,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep safe_array_from_zval(v, z, codepage TSRMLS_CC); break; - case IS_LONG: + case IS_INT: V_VT(v) = VT_I4; - V_I4(v) = Z_LVAL_P(z); + V_I4(v) = Z_IVAL_P(z); break; case IS_DOUBLE: @@ -157,11 +157,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep case IS_STRING: V_VT(v) = VT_BSTR; - olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC); + olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRSIZE_P(z), codepage TSRMLS_CC); if (CP_UTF8 == codepage) { V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR)); } else { - V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR)); + V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRSIZE_P(z) * sizeof(OLECHAR)); } efree(olestring); break; @@ -187,28 +187,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa ZVAL_NULL(z); break; case VT_UI1: - ZVAL_LONG(z, (long)V_UI1(v)); + ZVAL_INT(z, (long)V_UI1(v)); break; case VT_I1: - ZVAL_LONG(z, (long)V_I1(v)); + ZVAL_INT(z, (long)V_I1(v)); break; case VT_UI2: - ZVAL_LONG(z, (long)V_UI2(v)); + ZVAL_INT(z, (long)V_UI2(v)); break; case VT_I2: - ZVAL_LONG(z, (long)V_I2(v)); + ZVAL_INT(z, (long)V_I2(v)); break; case VT_UI4: /* TODO: promote to double if large? */ - ZVAL_LONG(z, (long)V_UI4(v)); + ZVAL_INT(z, (long)V_UI4(v)); break; case VT_I4: - ZVAL_LONG(z, (long)V_I4(v)); + ZVAL_INT(z, (long)V_I4(v)); break; case VT_INT: - ZVAL_LONG(z, V_INT(v)); + ZVAL_INT(z, V_INT(v)); break; case VT_UINT: /* TODO: promote to double if large? */ - ZVAL_LONG(z, (long)V_UINT(v)); + ZVAL_INT(z, (long)V_UINT(v)); break; case VT_R4: ZVAL_DOUBLE(z, (double)V_R4(v)); @@ -909,7 +909,7 @@ PHP_FUNCTION(variant_cmp) return; } - ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags)); + ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags)); VariantClear(&left_val); VariantClear(&right_val); @@ -948,7 +948,7 @@ PHP_FUNCTION(variant_date_to_timestamp) tmv.tm_isdst = -1; tzset(); - RETVAL_LONG(mktime(&tmv)); + RETVAL_INT(mktime(&tmv)); } VariantClear(&vres); @@ -1010,7 +1010,7 @@ PHP_FUNCTION(variant_get_type) } obj = CDNO_FETCH(zobj); - RETURN_LONG(V_VT(&obj->v)); + RETURN_INT(V_VT(&obj->v)); } /* }}} */ diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index a55c767423..45eab34a69 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames( ret = DISP_E_UNKNOWNNAME; rgDispId[i] = 0; } else { - rgDispId[i] = Z_LVAL_P(tmp); + rgDispId[i] = Z_IVAL_P(tmp); } efree(name); @@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid( /* Lookup the name in the hash */ if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) { trace("found it\n"); - *pid = Z_LVAL_P(tmp); + *pid = Z_IVAL_P(tmp); ret = S_OK; } @@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { /* TODO: add support for overloaded objects */ - trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRLEN_P(name), wFlags, pdp->cArgs); + trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRSIZE_P(name), wFlags, pdp->cArgs); /* convert args into zvals. * Args are in reverse order */ @@ -283,9 +283,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( * and expose it as a COM exception */ if (wFlags & DISPATCH_PROPERTYGET) { - retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, 1 TSRMLS_CC); + retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, 1 TSRMLS_CC); } else if (wFlags & DISPATCH_PROPERTYPUT) { - zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name), ¶ms[0] TSRMLS_CC); + zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name), ¶ms[0] TSRMLS_CC); } else if (wFlags & DISPATCH_METHOD) { zend_try { retval = &rv; @@ -385,7 +385,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername( FETCH_DISP("GetMemberName"); if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { - OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRLEN_P(name), COMG(code_page) TSRMLS_CC); + OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRSIZE_P(name), COMG(code_page) TSRMLS_CC); *pbstrName = SysAllocString(olestr); efree(olestr); return S_OK; @@ -466,7 +466,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) zend_hash_get_current_key_ex(Z_OBJPROP(disp->object), &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_LONG) { + if (keytype == HASH_KEY_IS_INT) { snprintf(namebuf, sizeof(namebuf), "%d", pid); name = STR_INIT(namebuf, strlen(namebuf), 0); } else { @@ -486,7 +486,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_LONG(&tmp2, pid); + ZVAL_INT(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); STR_RELEASE(name); @@ -501,7 +501,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_LONG) { + if (keytype == HASH_KEY_IS_INT) { snprintf(namebuf, sizeof(namebuf), "%d", pid); name = STR_INIT(namebuf, strlen(namebuf), 0); } else { @@ -521,7 +521,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_LONG(&tmp2, pid); + ZVAL_INT(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); STR_RELEASE(name); @@ -604,11 +604,11 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si while (HASH_KEY_NON_EXISTENT != (keytype = zend_hash_get_current_key_ex(id_to_name, &name, &pid, 0, &pos))) { - if (keytype == HASH_KEY_IS_LONG) { + if (keytype == HASH_KEY_IS_INT) { ntmp = zend_hash_get_current_data_ex(id_to_name, &pos); - ZVAL_LONG(&tmp, pid); + ZVAL_INT(&tmp, pid); zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp); } diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index 8f116b86d3..e9ccc9f3de 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -146,11 +146,11 @@ static PHP_MINFO_FUNCTION(ctype) zval *c, tmp; \ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \ return; \ - if (Z_TYPE_P(c) == IS_LONG) { \ - if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c))); \ - } else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \ + if (Z_TYPE_P(c) == IS_INT) { \ + if (Z_IVAL_P(c) <= 255 && Z_IVAL_P(c) >= 0) { \ + RETURN_BOOL(iswhat(Z_IVAL_P(c))); \ + } else if (Z_IVAL_P(c) >= -128 && Z_IVAL_P(c) < 0) { \ + RETURN_BOOL(iswhat(Z_IVAL_P(c) + 256)); \ } \ tmp = *c; \ zval_copy_ctor(&tmp); \ @@ -159,18 +159,18 @@ static PHP_MINFO_FUNCTION(ctype) tmp = *c; \ } \ if (Z_TYPE(tmp) == IS_STRING) { \ - char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \ + char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRSIZE(tmp); \ if (e == p) { \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ while (p < e) { \ if(!iswhat((int)*(unsigned char *)(p++))) { \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ } \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_TRUE; \ } else { \ RETURN_FALSE; \ diff --git a/ext/curl/interface.c b/ext/curl/interface.c index b45e7efc83..5985d92993 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -154,7 +154,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err; -#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (long) v); +#define CAAL(s, v) add_assoc_int_ex(return_value, s, sizeof(s) - 1, (long) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : "")); #define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : STR_EMPTY_ALLOC()); @@ -612,7 +612,7 @@ PHP_MINFO_FUNCTION(curl) } /* }}} */ -#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) +#define REGISTER_CURL_CONSTANT(__c) REGISTER_INT_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) /* {{{ PHP_MINIT_FUNCTION */ @@ -1318,10 +1318,10 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - length = Z_LVAL(retval); + length = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); @@ -1371,10 +1371,10 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string) if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - rval = Z_LVAL(retval); + rval = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1410,10 +1410,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); - ZVAL_LONG(&argv[1], (long)dltotal); - ZVAL_LONG(&argv[2], (long)dlnow); - ZVAL_LONG(&argv[3], (long)ultotal); - ZVAL_LONG(&argv[4], (long)ulnow); + ZVAL_INT(&argv[1], (long)dltotal); + ZVAL_INT(&argv[2], (long)dlnow); + ZVAL_INT(&argv[3], (long)ultotal); + ZVAL_INT(&argv[4], (long)ulnow); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1431,10 +1431,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - if (0 != Z_LVAL(retval)) { + if (0 != Z_IVAL(retval)) { rval = 1; } } @@ -1475,7 +1475,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) Z_ADDREF(argv[0]); ZVAL_RES(&argv[1], t->res); Z_ADDREF(argv[1]); - ZVAL_LONG(&argv[2], (int)size * nmemb); + ZVAL_INT(&argv[2], (int)size * nmemb); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1497,7 +1497,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) #endif } else if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) == IS_STRING) { - length = MIN((int) (size * nmemb), Z_STRLEN(retval)); + length = MIN((int) (size * nmemb), Z_STRSIZE(retval)); memcpy(data, Z_STRVAL(retval), length); } zval_ptr_dtor(&retval); @@ -1562,10 +1562,10 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - length = Z_LVAL(retval); + length = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1616,16 +1616,16 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRING(&argv[1], prompt); - ZVAL_LONG(&argv[2], buflen); + ZVAL_INT(&argv[2], buflen); error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION"); } else if (Z_TYPE(retval) == IS_STRING) { - if (Z_STRLEN(retval) > buflen) { + if (Z_STRSIZE(retval) > buflen) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle"); } else { - memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1); + memcpy(buf, Z_STRVAL(retval), Z_STRSIZE(retval) + 1); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func)); @@ -1993,8 +1993,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / switch (option) { /* Long options */ case CURLOPT_SSL_VERIFYHOST: - convert_to_long(zvalue); - if (Z_LVAL_P(zvalue) == 1) { + convert_to_int(zvalue); + if (Z_IVAL_P(zvalue) == 1) { #if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead"); #else @@ -2148,19 +2148,19 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if CURLOPT_MUTE != 0 case CURLOPT_MUTE: #endif - convert_to_long_ex(zvalue); + convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM >= 0x71304 if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) && - (PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_P(zvalue) & CURLPROTO_FILE)) { + (PG(open_basedir) && *PG(open_basedir)) && (Z_IVAL_P(zvalue) & CURLPROTO_FILE)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set"); return 1; } #endif - error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); break; case CURLOPT_SAFE_UPLOAD: - convert_to_long_ex(zvalue); - ch->safe_upload = (Z_LVAL_P(zvalue) != 0); + convert_to_int_ex(zvalue); + ch->safe_upload = (Z_IVAL_P(zvalue) != 0); break; /* String options */ @@ -2222,7 +2222,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #endif { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } /* Curl nullable string options */ @@ -2245,7 +2245,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / error = curl_easy_setopt(ch->cp, option, NULL); } else { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } break; } @@ -2253,12 +2253,12 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / /* Curl private option */ case CURLOPT_PRIVATE: convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 1 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 1 TSRMLS_CC); /* Curl url option */ case CURLOPT_URL: convert_to_string_ex(zvalue); - return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue) TSRMLS_CC); + return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue) TSRMLS_CC); /* Curl file handle options */ case CURLOPT_FILE: @@ -2436,16 +2436,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / break; case CURLOPT_FOLLOWLOCATION: - convert_to_long_ex(zvalue); + convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM < 0x071304 if (PG(open_basedir) && *PG(open_basedir)) { - if (Z_LVAL_P(zvalue) != 0) { + if (Z_IVAL_P(zvalue) != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set"); return FAILURE; } } #endif - error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); break; case CURLOPT_HEADERFUNCTION: @@ -2476,7 +2476,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / char *postval; /* Pretend we have a string_key here */ if (!string_key) { - string_key = zend_long_to_str(num_key); + string_key = zend_int_to_str(num_key); } else { STR_ADDREF(string_key); } @@ -2498,11 +2498,11 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / } prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { type = Z_STRVAL_P(prop); } prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { filename = Z_STRVAL_P(prop); } error = curl_formadd(&first, &last, @@ -2533,13 +2533,13 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / php_error_docref("curl.curlfile" TSRMLS_CC, E_DEPRECATED, "The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead"); - name = estrndup(postval, Z_STRLEN_P(current)); + name = estrndup(postval, Z_STRSIZE_P(current)); if ((type = php_memnstr(name, ";type=", sizeof(";type=") - 1, - name + Z_STRLEN_P(current)))) { + name + Z_STRSIZE_P(current)))) { *type = '\0'; } if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1, - name + Z_STRLEN_P(current)))) { + name + Z_STRSIZE_P(current)))) { *filename = '\0'; } /* open_basedir check */ @@ -2560,7 +2560,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / CURLFORM_COPYNAME, string_key->val, CURLFORM_NAMELENGTH, (long)string_key->len, CURLFORM_COPYCONTENTS, postval, - CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_P(current), + CURLFORM_CONTENTSLENGTH, (long)Z_STRSIZE_P(current), CURLFORM_END); } @@ -2581,17 +2581,17 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if LIBCURL_VERSION_NUM >= 0x071101 convert_to_string_ex(zvalue); /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_P(zvalue)); #else char *post = NULL; convert_to_string_ex(zvalue); - post = estrndup(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue)); + post = estrndup(Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue)); zend_llist_add_element(&ch->to_free->str, &post); curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); #endif } break; @@ -2619,8 +2619,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / break; case CURLOPT_RETURNTRANSFER: - convert_to_long_ex(zvalue); - if (Z_LVAL_P(zvalue)) { + convert_to_int_ex(zvalue); + if (Z_IVAL_P(zvalue)) { ch->handlers->write->method = PHP_CURL_RETURN; } else { ch->handlers->write->method = PHP_CURL_STDOUT; @@ -2639,15 +2639,15 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */ case CURLOPT_MAX_RECV_SPEED_LARGE: case CURLOPT_MAX_SEND_SPEED_LARGE: - convert_to_long_ex(zvalue); - error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_IVAL_P(zvalue)); break; #endif #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ case CURLOPT_POSTREDIR: - convert_to_long_ex(zvalue); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_LVAL_P(zvalue) & CURL_REDIR_POST_ALL); + convert_to_int_ex(zvalue); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_IVAL_P(zvalue) & CURL_REDIR_POST_ALL); break; #endif @@ -2684,16 +2684,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / { convert_to_string_ex(zvalue); - if (Z_STRLEN_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { + if (Z_STRSIZE_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { return FAILURE; } - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } case CURLINFO_HEADER_OUT: - convert_to_long_ex(zvalue); - if (Z_LVAL_P(zvalue) == 1) { + convert_to_int_ex(zvalue); + if (Z_IVAL_P(zvalue) == 1) { curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug); curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch); curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1); @@ -3029,7 +3029,7 @@ PHP_FUNCTION(curl_getinfo) long code = 0; if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { - RETURN_LONG(code); + RETURN_INT(code); } else { RETURN_FALSE; } @@ -3103,7 +3103,7 @@ PHP_FUNCTION(curl_errno) ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_LONG(ch->err.no); + RETURN_INT(ch->err.no); } /* }}} */ @@ -3373,7 +3373,7 @@ PHP_FUNCTION(curl_pause) ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_LONG(curl_easy_pause(ch->cp, bitmask)); + RETURN_INT(curl_easy_pause(ch->cp, bitmask)); } /* }}} */ #endif diff --git a/ext/curl/multi.c b/ext/curl/multi.c index 5550972bba..58c33c141c 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -92,7 +92,7 @@ PHP_FUNCTION(curl_multi_add_handle) zend_llist_add_element(&mh->easyh, &tmp_val); - RETURN_LONG((long)curl_multi_add_handle(mh->multi, ch->cp)); + RETURN_INT((long)curl_multi_add_handle(mh->multi, ch->cp)); } /* }}} */ @@ -140,7 +140,7 @@ PHP_FUNCTION(curl_multi_remove_handle) ZEND_FETCH_RESOURCE(mh, php_curlm *, z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); ZEND_FETCH_RESOURCE(ch, php_curl *, z_ch, -1, le_curl_name, le_curl); - RETVAL_LONG((long)curl_multi_remove_handle(mh->multi, ch->cp)); + RETVAL_INT((long)curl_multi_remove_handle(mh->multi, ch->cp)); zend_llist_del_element(&mh->easyh, &z_ch, (int (*)(void *, void *))curl_compare_resources); } @@ -183,9 +183,9 @@ PHP_FUNCTION(curl_multi_select) curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); if (maxfd == -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); + RETURN_INT(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } /* }}} */ @@ -218,12 +218,12 @@ PHP_FUNCTION(curl_multi_exec) } } - convert_to_long_ex(z_still_running); - still_running = Z_LVAL_P(z_still_running); + convert_to_int_ex(z_still_running); + still_running = Z_IVAL_P(z_still_running); result = curl_multi_perform(mh->multi, &still_running); - ZVAL_LONG(z_still_running, still_running); + ZVAL_INT(z_still_running, still_running); - RETURN_LONG(result); + RETURN_INT(result); } /* }}} */ @@ -271,12 +271,12 @@ PHP_FUNCTION(curl_multi_info_read) } if (zmsgs_in_queue) { zval_dtor(zmsgs_in_queue); - ZVAL_LONG(zmsgs_in_queue, queued_msgs); + ZVAL_INT(zmsgs_in_queue, queued_msgs); } array_init(return_value); - add_assoc_long(return_value, "msg", tmp_msg->msg); - add_assoc_long(return_value, "result", tmp_msg->data.result); + add_assoc_int(return_value, "msg", tmp_msg->msg); + add_assoc_int(return_value, "result", tmp_msg->data.result); /* find the original easy curl handle */ { @@ -386,8 +386,8 @@ static int _php_curl_multi_setopt(php_curlm *mh, long option, zval *zvalue, zval #if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */ case CURLMOPT_MAXCONNECTS: #endif - convert_to_long_ex(zvalue); - error = curl_multi_setopt(mh->multi, option, Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_multi_setopt(mh->multi, option, Z_IVAL_P(zvalue)); break; default: diff --git a/ext/curl/share.c b/ext/curl/share.c index 5983579f08..ed62b83076 100644 --- a/ext/curl/share.c +++ b/ext/curl/share.c @@ -73,8 +73,8 @@ static int _php_curl_share_setopt(php_curlsh *sh, long option, zval *zvalue, zva switch (option) { case CURLSHOPT_SHARE: case CURLSHOPT_UNSHARE: - convert_to_long_ex(zvalue); - error = curl_share_setopt(sh->share, option, Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_share_setopt(sh->share, option, Z_IVAL_P(zvalue)); break; default: diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 7b675ac6ac..1d106160dc 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -217,10 +217,10 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); convert_to_string_ex(group); convert_to_string_ex(name); - if (Z_STRLEN_P(group) == 0) { + if (Z_STRSIZE_P(group) == 0) { *key_str = Z_STRVAL_P(name); *key_free = NULL; - return Z_STRLEN_P(name); + return Z_STRSIZE_P(name); } len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name)); *key_free = *key_str; @@ -232,8 +232,8 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS ZVAL_COPY(&tmp, key); convert_to_string(&tmp); - *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); - len = Z_STRLEN(tmp); + *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + len = Z_STRSIZE(tmp); zval_ptr_dtor(&tmp); return len; @@ -646,7 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else if (Z_REFCOUNTED(args[i])) { Z_ADDREF(args[i]); } - keylen += Z_STRLEN(args[i]); + keylen += Z_STRSIZE(args[i]); } if (persistent) { @@ -658,8 +658,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) keylen = 0; for(i = 0; i < ac; i++) { - memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i])); - keylen += Z_STRLEN(args[i]); + memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); + keylen += Z_STRSIZE(args[i]); } /* try to find if we already have this link in our persistent list */ diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c index 8ee5d95f22..9f16cb4cd2 100644 --- a/ext/dba/dba_db1.c +++ b/ext/dba/dba_db1.c @@ -51,8 +51,8 @@ DBA_OPEN_FUNC(db1) int filemode = 0644; if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } gmode = 0; diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c index 60aa37f93a..c4c17a1661 100644 --- a/ext/dba/dba_db2.c +++ b/ext/dba/dba_db2.c @@ -72,8 +72,8 @@ DBA_OPEN_FUNC(db2) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c index 95a1e51fe0..5ed6f502cc 100644 --- a/ext/dba/dba_db3.c +++ b/ext/dba/dba_db3.c @@ -81,8 +81,8 @@ DBA_OPEN_FUNC(db3) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } #ifdef DB_FCNTL_LOCKING diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index 94a6c95e81..a927c49ee5 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -118,8 +118,8 @@ DBA_OPEN_FUNC(db4) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if ((err=db_create(&dbp, NULL, 0)) == 0) { diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c index f65a79bcc7..5d5a234670 100644 --- a/ext/dba/dba_dbm.c +++ b/ext/dba/dba_dbm.c @@ -60,8 +60,8 @@ DBA_OPEN_FUNC(dbm) int filemode = 0644; if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if(info->mode == DBA_TRUNC) { diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c index d2c4a2f367..c5a2bccee0 100644 --- a/ext/dba/dba_gdbm.c +++ b/ext/dba/dba_gdbm.c @@ -54,8 +54,8 @@ DBA_OPEN_FUNC(gdbm) return FAILURE; /* not possible */ if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c index 417446759c..6805c45d9f 100644 --- a/ext/dba/dba_ndbm.c +++ b/ext/dba/dba_ndbm.c @@ -59,8 +59,8 @@ DBA_OPEN_FUNC(ndbm) } if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } dbf = dbm_open(info->path, gmode, filemode); diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index d4d4c62c4a..7276ba6942 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -126,7 +126,7 @@ typedef struct dba_handler { DBA_SYNC_FUNC(x); \ DBA_INFO_FUNC(x) -#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p) +#define VALLEN(p) Z_STRVAL_PP(p), Z_STRSIZE_PP(p) PHP_FUNCTION(dba_open); PHP_FUNCTION(dba_popen); diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 2ef6352f20..f3966df6a7 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -139,7 +139,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval TSRMLS_DC) xmlFree(content); } - ZVAL_LONG(retval, length); + ZVAL_INT(retval, length); return SUCCESS; } diff --git a/ext/dom/document.c b/ext/dom/document.c index b2c3274063..86373fe388 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -388,7 +388,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC) return FAILURE; } - standalone = zval_get_long(newval); + standalone = zval_get_int(newval); docp->standalone = ZEND_NORMALIZE_BOOL(standalone); return SUCCESS; @@ -1575,7 +1575,7 @@ PHP_FUNCTION(dom_document_save) if (bytes == -1) { RETURN_FALSE; } - RETURN_LONG(bytes); + RETURN_INT(bytes); } /* }}} end dom_document_save */ @@ -1723,7 +1723,7 @@ PHP_FUNCTION(dom_document_xinclude) } if (err) { - RETVAL_LONG(err); + RETVAL_INT(err); } else { RETVAL_FALSE; } @@ -2087,7 +2087,7 @@ PHP_FUNCTION(dom_document_save_html_file) if (bytes == -1) { RETURN_FALSE; } - RETURN_LONG(bytes); + RETURN_INT(bytes); } /* }}} end dom_document_save_html_file */ diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 22d0ab0ee3..9abe2c7c20 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -158,7 +158,7 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key T zval *object = &iterator->intern.data; if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) { - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } else { dom_object *intern = Z_DOMOBJ_P(&iterator->curobj); diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 13acf5cbce..91ae6a1282 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -113,7 +113,7 @@ int dom_namednodemap_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_LONG(retval, count); + ZVAL_INT(retval, count); return SUCCESS; } diff --git a/ext/dom/node.c b/ext/dom/node.c index a35139bcad..07f610c63b 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -375,9 +375,9 @@ int dom_node_node_type_read(dom_object *obj, zval *retval TSRMLS_DC) /* Specs dictate that they are both type XML_DOCUMENT_TYPE_NODE */ if (nodep->type == XML_DTD_NODE) { - ZVAL_LONG(retval, XML_DOCUMENT_TYPE_NODE); + ZVAL_INT(retval, XML_DOCUMENT_TYPE_NODE); } else { - ZVAL_LONG(retval, nodep->type); + ZVAL_INT(retval, nodep->type); } return SUCCESS; @@ -1815,7 +1815,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ bytes = xmlOutputBufferClose(buf); if (mode == 1 && (ret >= 0)) { - RETURN_LONG(bytes); + RETURN_INT(bytes); } } } @@ -1872,7 +1872,7 @@ PHP_METHOD(domnode, getLineNo) DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern); - RETURN_LONG(xmlGetLineNo(nodep)); + RETURN_INT(xmlGetLineNo(nodep)); } /* }}} */ diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 3ef43f2ac7..5d45ad6edd 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -91,7 +91,7 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_LONG(retval, count); + ZVAL_INT(retval, count); return SUCCESS; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 8314e5c808..f328ba7708 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(dom) INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions); dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_int(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry); @@ -860,56 +860,56 @@ PHP_MINIT_FUNCTION(dom) zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers); #endif - REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); #ifdef XML_GLOBAL_NAMESPACE - REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); /* DOMException Codes */ - REGISTER_LONG_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); php_libxml_register_export(dom_node_class_entry, php_dom_export_node); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 93a38614ce..8351946038 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -524,7 +524,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) { zend_string *str = zval_get_string(entry); - ZVAL_LONG(&new_string,1); + ZVAL_INT(&new_string,1); zend_hash_update(intern->registered_phpfunctions, str, &new_string); zend_hash_move_forward(Z_ARRVAL_P(array_value)); STR_RELEASE(str); @@ -535,7 +535,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XPATHOBJ_P(id); - ZVAL_LONG(&new_string, 1); + ZVAL_INT(&new_string, 1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; } else { diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index e1449560f5..5f4dcb6ee4 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -289,8 +289,8 @@ PHP_MINIT_FUNCTION(enchant) { le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant_broker", module_number); le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant_dict", module_number); - REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 127cb30941..57545bf42c 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif) { REGISTER_INI_ENTRIES(); if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) { - REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); } else { - REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); } return SUCCESS; } @@ -2020,16 +2020,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_long(&array, b, (int)(info_value->s[b])); + add_index_int(&array, b, (int)(info_value->s[b])); } break; } case TAG_FMT_USHORT: case TAG_FMT_ULONG: if (l==1) { - add_assoc_long(&tmpi, name, (int)info_value->u); + add_assoc_int(&tmpi, name, (int)info_value->u); } else { - add_index_long(&array, ap, (int)info_value->u); + add_index_int(&array, ap, (int)info_value->u); } break; @@ -2046,16 +2046,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_long(&array, ap, (int)info_value->s[b]); + add_index_int(&array, ap, (int)info_value->s[b]); } break; } case TAG_FMT_SSHORT: case TAG_FMT_SLONG: if (l==1) { - add_assoc_long(&tmpi, name, info_value->i); + add_assoc_int(&tmpi, name, info_value->i); } else { - add_index_long(&array, ap, info_value->i); + add_index_int(&array, ap, info_value->i); } break; @@ -4129,12 +4129,12 @@ PHP_FUNCTION(exif_thumbnail) } zval_dtor(p_width); zval_dtor(p_height); - ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); - ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); + ZVAL_INT(p_width, ImageInfo.Thumbnail.width); + ZVAL_INT(p_height, ImageInfo.Thumbnail.height); } if (arg_c >= 4) { zval_dtor(p_imagetype); - ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); + ZVAL_INT(p_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG @@ -4175,7 +4175,7 @@ PHP_FUNCTION(exif_imagetype) if (itype == IMAGE_FILETYPE_UNKNOWN) { RETURN_FALSE; } else { - ZVAL_LONG(return_value, itype); + ZVAL_INT(return_value, itype); } } /* }}} */ diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index a612e04280..dac7ccbce9 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -226,19 +226,19 @@ PHP_MINIT_FUNCTION(finfo) le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number); - REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); -/* REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ - REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); +/* REGISTER_INT_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ + REGISTER_INT_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); #ifdef MAGIC_PRESERVE_ATIME - REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); #endif #ifdef MAGIC_RAW - REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); #endif return SUCCESS; @@ -433,7 +433,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime switch (Z_TYPE_P(what)) { case IS_STRING: buffer = Z_STRVAL_P(what); - buffer_len = Z_STRLEN_P(what); + buffer_len = Z_STRSIZE_P(what); mode = FILEINFO_MODE_FILE; break; diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index ef0cbb3891..b0e29c2b91 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -2110,11 +2110,11 @@ magiccheck(struct magic_set *ms, struct magic *m) /* Free haystack */ efree(haystack); - if (Z_LVAL(retval) < 0) { + if (Z_IVAL(retval) < 0) { zval_ptr_dtor(&subpats); zval_ptr_dtor(&pattern); return -1; - } else if ((Z_LVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { + } else if ((Z_IVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { /* Need to fetch global match which equals pmatch[0] */ zval *pzval; HashTable *ht = Z_ARRVAL(subpats); @@ -2156,16 +2156,16 @@ magiccheck(struct magic_set *ms, struct magic *m) continue; } ZVAL_DUP(&offsetcopy, offset); - convert_to_long(&offsetcopy); + convert_to_int(&offsetcopy); pattern_offset = &offsetcopy; } ZEND_HASH_FOREACH_END(); zval_dtor(&tmpcopy); if ((pattern_match != NULL) && (pattern_offset != NULL)) { - ms->search.s += Z_LVAL_P(pattern_offset); /* this is where the match starts */ - ms->search.offset += Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */ - ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */; + ms->search.s += Z_IVAL_P(pattern_offset); /* this is where the match starts */ + ms->search.offset += Z_IVAL_P(pattern_offset); /* this is where the match starts as size_t */ + ms->search.rm_len = Z_STRSIZE_P(pattern_match) /* This is the length of the matched pattern */; v = 0; zval_ptr_dtor(pattern_match); diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 6e723638aa..092e9ad0a8 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -211,72 +211,72 @@ PHP_MINIT_FUNCTION(filter) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); sapi_register_input_filter(php_sapi_filter, php_sapi_filter_init TSRMLS_CC); @@ -466,11 +466,11 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int if (retval) { if (new_val_len) { - *new_val_len = Z_STRLEN(new_var); + *new_val_len = Z_STRSIZE(new_var); } efree(*val); - if (Z_STRLEN(new_var)) { - *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var)); + if (Z_STRSIZE(new_var)) { + *val = estrndup(Z_STRVAL(new_var), Z_STRSIZE(new_var)); } else { *val = estrdup(""); } @@ -669,10 +669,10 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); php_filter_call(return_value, FILTER_DEFAULT, NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); - } else if (Z_TYPE_P(op) == IS_LONG) { + } else if (Z_TYPE_P(op) == IS_INT) { zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); - php_filter_call(return_value, Z_LVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); + php_filter_call(return_value, Z_IVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); } else if (Z_TYPE_P(op) == IS_ARRAY) { array_init(return_value); @@ -729,8 +729,8 @@ PHP_FUNCTION(filter_input) long filter_flags = 0; zval *option, *opt, *def; if (filter_args) { - if (Z_TYPE_P(filter_args) == IS_LONG) { - filter_flags = Z_LVAL_P(filter_args); + if (Z_TYPE_P(filter_args) == IS_INT) { + filter_flags = Z_IVAL_P(filter_args); } else if (Z_TYPE_P(filter_args) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(filter_args), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -796,7 +796,7 @@ PHP_FUNCTION(filter_input_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { RETURN_FALSE; } @@ -806,8 +806,8 @@ PHP_FUNCTION(filter_input_array) long filter_flags = 0; zval *option; if (op) { - if (Z_TYPE_P(op) == IS_LONG) { - filter_flags = Z_LVAL_P(op); + if (Z_TYPE_P(op) == IS_INT) { + filter_flags = Z_IVAL_P(op); } else if (Z_TYPE_P(op) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(op), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -841,7 +841,7 @@ PHP_FUNCTION(filter_var_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { RETURN_FALSE; } @@ -880,7 +880,7 @@ PHP_FUNCTION(filter_id) for (i = 0; i < size; ++i) { if (strcmp(filter_list[i].name, filter) == 0) { - RETURN_LONG(filter_list[i].id); + RETURN_INT(filter_list[i].id); } } diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index 4eec7b9119..869b412d4e 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -118,13 +118,13 @@ } #define PHP_FILTER_GET_LONG_OPT(zv, opt) { \ - if (Z_TYPE_P(zv) != IS_LONG) { \ + if (Z_TYPE_P(zv) != IS_INT) { \ zval ___tmp; \ ZVAL_DUP(&___tmp, zv); \ - convert_to_long(&___tmp); \ - opt = Z_LVAL(___tmp); \ + convert_to_int(&___tmp); \ + opt = Z_IVAL(___tmp); \ } else { \ - opt = Z_LVAL_P(zv); \ + opt = Z_IVAL_P(zv); \ } \ } diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index e2c743fd13..9884d01401 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -56,7 +56,7 @@ if ((option_val = zend_hash_str_find(HASH_OF(option_array), option_name, sizeof(option_name) - 1)) != NULL) { \ if (Z_TYPE_P(option_val) == IS_STRING) { \ var_name = Z_STRVAL_P(option_val); \ - var_name##_len = Z_STRLEN_P(option_val); \ + var_name##_len = Z_STRSIZE_P(option_val); \ var_name##_set = 1; \ } \ } \ @@ -106,8 +106,8 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret return -1; } - if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ - || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { + if ((end - str > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */ + || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_ZEND_INT - 1) && *str > '2')) { /* overflow */ return -1; } @@ -197,7 +197,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ FETCH_LONG_OPTION(max_range, "max_range"); option_flags = flags; - len = Z_STRLEN_P(value); + len = Z_STRSIZE_P(value); if (len == 0) { RETURN_VALIDATION_FAILED @@ -241,7 +241,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } else { zval_ptr_dtor(value); - ZVAL_LONG(value, ctx_value); + ZVAL_INT(value, ctx_value); return; } } @@ -250,7 +250,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *str = Z_STRVAL_P(value); - int len = Z_STRLEN_P(value); + int len = Z_STRSIZE_P(value); int ret; PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); @@ -332,7 +332,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int first, n; - len = Z_STRLEN_P(value); + len = Z_STRSIZE_P(value); str = Z_STRVAL_P(value); PHP_FILTER_TRIM_DEFAULT(str, len); @@ -398,7 +398,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ *p = 0; switch (is_numeric_string(num, p - num, &lval, &dval, 0)) { - case IS_LONG: + case IS_INT: zval_ptr_dtor(value); ZVAL_DOUBLE(value, lval); break; @@ -443,7 +443,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if (!re) { RETURN_VALIDATION_FAILED } - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -455,16 +455,16 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { php_url *url; - int old_len = Z_STRLEN_P(value); + int old_len = Z_STRSIZE_P(value); php_filter_url(value, flags, option_array, charset TSRMLS_CC); - if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) { + if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRSIZE_P(value)) { RETURN_VALIDATION_FAILED } /* Use parse_url - if it returns false, we return NULL */ - url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRLEN_P(value)); + url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value)); if (url == NULL) { RETURN_VALIDATION_FAILED @@ -543,7 +543,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ /* The maximum length of an e-mail address is 320 octets, per RFC 2821. */ - if (Z_STRLEN_P(value) > 320) { + if (Z_STRSIZE_P(value) > 320) { RETURN_VALIDATION_FAILED } @@ -554,7 +554,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } STR_RELEASE(sregexp); - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -688,9 +688,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int ip[4]; int mode; - if (memchr(Z_STRVAL_P(value), ':', Z_STRLEN_P(value))) { + if (memchr(Z_STRVAL_P(value), ':', Z_STRSIZE_P(value))) { mode = FORMAT_IPV6; - } else if (memchr(Z_STRVAL_P(value), '.', Z_STRLEN_P(value))) { + } else if (memchr(Z_STRVAL_P(value), '.', Z_STRSIZE_P(value))) { mode = FORMAT_IPV4; } else { RETURN_VALIDATION_FAILED @@ -706,7 +706,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ switch (mode) { case FORMAT_IPV4: - if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRLEN_P(value), ip)) { + if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRSIZE_P(value), ip)) { RETURN_VALIDATION_FAILED } @@ -738,18 +738,18 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ case FORMAT_IPV6: { int res = 0; - res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC); + res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRSIZE_P(value) TSRMLS_CC); if (res < 1) { RETURN_VALIDATION_FAILED } /* Check flags */ if (flags & FILTER_FLAG_NO_PRIV_RANGE) { - if (Z_STRLEN_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { + if (Z_STRSIZE_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { RETURN_VALIDATION_FAILED } } if (flags & FILTER_FLAG_NO_RES_RANGE) { - switch (Z_STRLEN_P(value)) { + switch (Z_STRSIZE_P(value)) { case 1: case 0: break; case 2: @@ -763,7 +763,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } break; default: - if (Z_STRLEN_P(value) >= 5) { + if (Z_STRSIZE_P(value) >= 5) { if ( !strncasecmp("fe8", Z_STRVAL_P(value), 3) || !strncasecmp("fe9", Z_STRVAL_P(value), 3) || @@ -774,10 +774,10 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } } if ( - (Z_STRLEN_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || - (Z_STRLEN_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || - (Z_STRLEN_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || - (Z_STRLEN_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) + (Z_STRSIZE_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || + (Z_STRSIZE_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || + (Z_STRSIZE_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || + (Z_STRSIZE_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) ) { RETURN_VALIDATION_FAILED } @@ -792,7 +792,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *input = Z_STRVAL_P(value); - int input_len = Z_STRLEN_P(value); + int input_len = Z_STRSIZE_P(value); int tokens, length, i, offset, exp_separator_set, exp_separator_len; char separator; char *exp_separator; diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index c93633418f..e41b704933 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -30,11 +30,11 @@ typedef unsigned long filter_map[256]; static void php_filter_encode_html(zval *value, const unsigned char *chars) { smart_str str = {0}; - int len = Z_STRLEN_P(value); + int len = Z_STRSIZE_P(value); unsigned char *s = (unsigned char *)Z_STRVAL_P(value); unsigned char *e = s + len; - if (Z_STRLEN_P(value) == 0) { + if (Z_STRSIZE_P(value) == 0) { return; } @@ -87,10 +87,10 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const memset(tmp, 1, 32); } */ - str = STR_ALLOC(3 * Z_STRLEN_P(value), 0); + str = STR_ALLOC(3 * Z_STRSIZE_P(value), 0); p = str->val; s = Z_STRVAL_P(value); - e = s + Z_STRLEN_P(value); + e = s + Z_STRSIZE_P(value); while (s < e) { if (tmp[*s]) { @@ -120,9 +120,9 @@ static void php_filter_strip(zval *value, long flags) } str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRLEN_P(value) + 1, 0); + buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRLEN_P(value); i++) { + for (i = 0; i < Z_STRSIZE_P(value); i++) { if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) { } else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) { } else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) { @@ -162,9 +162,9 @@ static void filter_map_apply(zval *value, filter_map *map) zend_string *buf; str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRLEN_P(value) + 1, 0); + buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRLEN_P(value); i++) { + for (i = 0; i < Z_STRSIZE_P(value); i++) { if ((*map)[str[i]]) { buf->val[c] = str[i]; ++c; @@ -185,7 +185,7 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) unsigned char enc[256] = {0}; if (IS_INTERNED(Z_STR_P(value))) { - ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRLEN_P(value)); + ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRSIZE_P(value)); } /* strip high/strip low ( see flags )*/ @@ -207,8 +207,8 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) php_filter_encode_html(value, enc); /* strip tags, implicitly also removes \0 chars */ - new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0, 1); - Z_STRLEN_P(value) = new_len; + new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), NULL, NULL, 0, 1); + Z_STRSIZE_P(value) = new_len; if (new_len == 0) { zval_dtor(value); @@ -264,7 +264,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) } else { quotes = ENT_NOQUOTES; } - buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); + buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); } @@ -274,7 +274,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) { /* Only if no flags are set (optimization) */ - if (flags != 0 && Z_STRLEN_P(value) > 0) { + if (flags != 0 && Z_STRSIZE_P(value) > 0) { unsigned char enc[256] = {0}; php_filter_strip(value, flags); @@ -290,7 +290,7 @@ void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) } php_filter_encode_html(value, enc); - } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) { + } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRSIZE_P(value) == 0) { zval_dtor(value); ZVAL_NULL(value); } @@ -373,7 +373,7 @@ void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL) zend_string *buf; /* just call php_addslashes quotes */ - buf = php_addslashes(Z_STRVAL_P(value), Z_STRLEN_P(value), 0 TSRMLS_CC); + buf = php_addslashes(Z_STRVAL_P(value), Z_STRSIZE_P(value), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 1bf485f4ed..c247c96dd2 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -308,16 +308,16 @@ static void ftp_destructor_ftpbuf(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(ftp) { le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number); - REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); return SUCCESS; } @@ -619,7 +619,7 @@ PHP_FUNCTION(ftp_chmod) RETURN_FALSE; } - RETURN_LONG(mode); + RETURN_INT(mode); } /* }}} */ @@ -817,10 +817,10 @@ PHP_FUNCTION(ftp_nb_fget) if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(ret); + RETURN_INT(ret); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -967,7 +967,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; VCWD_UNLINK(local); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(PHP_FTP_FAILED); + RETURN_INT(PHP_FTP_FAILED); } if (ret == PHP_FTP_FINISHED){ @@ -975,7 +975,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -995,7 +995,7 @@ PHP_FUNCTION(ftp_nb_continue) if (!ftp->nb) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue."); - RETURN_LONG(PHP_FTP_FAILED); + RETURN_INT(PHP_FTP_FAILED); } if (ftp->direction) { @@ -1013,7 +1013,7 @@ PHP_FUNCTION(ftp_nb_continue) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1108,10 +1108,10 @@ PHP_FUNCTION(ftp_nb_fput) if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == PHP_FTP_FAILED)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(ret); + RETURN_INT(ret); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1225,7 +1225,7 @@ PHP_FUNCTION(ftp_nb_put) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1245,7 +1245,7 @@ PHP_FUNCTION(ftp_size) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file size */ - RETURN_LONG(ftp_size(ftp, file)); + RETURN_INT(ftp_size(ftp, file)); } /* }}} */ @@ -1265,7 +1265,7 @@ PHP_FUNCTION(ftp_mdtm) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file mod time */ - RETURN_LONG(ftp_mdtm(ftp, file)); + RETURN_INT(ftp_mdtm(ftp, file)); } /* }}} */ @@ -1379,16 +1379,16 @@ PHP_FUNCTION(ftp_set_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - if (Z_TYPE_P(z_value) != IS_LONG) { + if (Z_TYPE_P(z_value) != IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option TIMEOUT_SEC expects value of type long, %s given", zend_zval_type_name(z_value)); RETURN_FALSE; } - if (Z_LVAL_P(z_value) <= 0) { + if (Z_IVAL_P(z_value) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0"); RETURN_FALSE; } - ftp->timeout_sec = Z_LVAL_P(z_value); + ftp->timeout_sec = Z_IVAL_P(z_value); RETURN_TRUE; break; case PHP_FTP_OPT_AUTOSEEK: @@ -1424,7 +1424,7 @@ PHP_FUNCTION(ftp_get_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - RETURN_LONG(ftp->timeout_sec); + RETURN_INT(ftp->timeout_sec); break; case PHP_FTP_OPT_AUTOSEEK: RETURN_BOOL(ftp->autoseek); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index d7994476f0..ea29bf8ca9 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1142,93 +1142,93 @@ PHP_MINIT_FUNCTION(gd) #endif REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); /* special colours for gd */ - REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); /* for imagefilledarc */ - REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); /* GD2 image format types */ - REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_GD_BUNDLED) - REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); #endif /* Section Filters */ - REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); /* End Section Filters */ #ifdef GD_VERSION_STRING @@ -1236,9 +1236,9 @@ PHP_MINIT_FUNCTION(gd) #endif #if defined(GD_MAJOR_VERSION) && defined(GD_MINOR_VERSION) && defined(GD_RELEASE_VERSION) && defined(GD_EXTRA_VERSION) - REGISTER_LONG_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("GD_EXTRA_VERSION", GD_EXTRA_VERSION, CONST_CS | CONST_PERSISTENT); #endif @@ -1250,13 +1250,13 @@ PHP_MINIT_FUNCTION(gd) * /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup. * as error, use the values for now... */ - REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -1515,7 +1515,7 @@ PHP_FUNCTION(imageloadfont) * that overlap with the old fonts (with indices 1-5). The first * list index given out is always 1. */ - RETURN_LONG(Z_RES_HANDLE_P(ind) + 5); + RETURN_INT(Z_RES_HANDLE_P(ind) + 5); } /* }}} */ @@ -1538,13 +1538,13 @@ PHP_FUNCTION(imagesetstyle) stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0); ZEND_HASH_FOREACH_VAL(HASH_OF(styles), item) { - if (Z_TYPE_P(item) != IS_LONG) { + if (Z_TYPE_P(item) != IS_INT) { zval lval; ZVAL_COPY(&lval, item); - convert_to_long(&lval); - stylearr[index++] = Z_LVAL(lval); + convert_to_int(&lval); + stylearr[index++] = Z_IVAL(lval); } else { - stylearr[index++] = Z_LVAL_P(item); + stylearr[index++] = Z_IVAL_P(item); } } ZEND_HASH_FOREACH_END(); @@ -1830,7 +1830,7 @@ PHP_FUNCTION(imagecolorallocatealpha) if (ct < 0) { RETURN_FALSE; } - RETURN_LONG((long)ct); + RETURN_INT((long)ct); } /* }}} */ @@ -1848,7 +1848,7 @@ PHP_FUNCTION(imagecolorresolvealpha) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorResolveAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1866,7 +1866,7 @@ PHP_FUNCTION(imagecolorclosestalpha) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosestAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorClosestAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1884,7 +1884,7 @@ PHP_FUNCTION(imagecolorexactalpha) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorExactAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorExactAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -2182,7 +2182,7 @@ PHP_FUNCTION(imagetypes) return; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -2251,7 +2251,7 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct gdImagePtr im; gdIOCtx *io_ctx; - io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0); + io_ctx = gdNewDynamicCtxEx(Z_STRSIZE_P(data), Z_STRVAL_P(data), 0); if (!io_ctx) { return NULL; @@ -2284,7 +2284,7 @@ PHP_FUNCTION(imagecreatefromstring) } convert_to_string_ex(data); - if (Z_STRLEN_P(data) < 8) { + if (Z_STRSIZE_P(data) < 8) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string or invalid image"); RETURN_FALSE; } @@ -2808,7 +2808,7 @@ PHP_FUNCTION(imagecolorallocate) if (ct < 0) { RETURN_FALSE; } - RETURN_LONG(ct); + RETURN_INT(ct); } /* }}} */ @@ -2846,14 +2846,14 @@ PHP_FUNCTION(imagecolorat) if (gdImageTrueColor(im)) { if (im->tpixels && gdImageBoundsSafe(im, x, y)) { - RETURN_LONG(gdImageTrueColorPixel(im, x, y)); + RETURN_INT(gdImageTrueColorPixel(im, x, y)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y); RETURN_FALSE; } } else { if (im->pixels && gdImageBoundsSafe(im, x, y)) { - RETURN_LONG(im->pixels[y][x]); + RETURN_INT(im->pixels[y][x]); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y); RETURN_FALSE; @@ -2876,7 +2876,7 @@ PHP_FUNCTION(imagecolorclosest) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosest(im, red, green, blue)); + RETURN_INT(gdImageColorClosest(im, red, green, blue)); } /* }}} */ @@ -2894,7 +2894,7 @@ PHP_FUNCTION(imagecolorclosesthwb) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue)); + RETURN_INT(gdImageColorClosestHWB(im, red, green, blue)); } /* }}} */ @@ -2944,7 +2944,7 @@ PHP_FUNCTION(imagecolorresolve) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorResolve(im, red, green, blue)); + RETURN_INT(gdImageColorResolve(im, red, green, blue)); } /* }}} */ @@ -2962,7 +2962,7 @@ PHP_FUNCTION(imagecolorexact) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorExact(im, red, green, blue)); + RETURN_INT(gdImageColorExact(im, red, green, blue)); } /* }}} */ @@ -3014,10 +3014,10 @@ PHP_FUNCTION(imagecolorsforindex) if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) { array_init(return_value); - add_assoc_long(return_value,"red", gdImageRed(im,col)); - add_assoc_long(return_value,"green", gdImageGreen(im,col)); - add_assoc_long(return_value,"blue", gdImageBlue(im,col)); - add_assoc_long(return_value,"alpha", gdImageAlpha(im,col)); + add_assoc_int(return_value,"red", gdImageRed(im,col)); + add_assoc_int(return_value,"green", gdImageGreen(im,col)); + add_assoc_int(return_value,"blue", gdImageBlue(im,col)); + add_assoc_int(return_value,"alpha", gdImageAlpha(im,col)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col); RETURN_FALSE; @@ -3264,7 +3264,7 @@ PHP_FUNCTION(imagecolorstotal) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorsTotal(im)); + RETURN_INT(gdImageColorsTotal(im)); } /* }}} */ @@ -3287,7 +3287,7 @@ PHP_FUNCTION(imagecolortransparent) gdImageColorTransparent(im, COL); } - RETURN_LONG(gdImageGetTransparent(im)); + RETURN_INT(gdImageGetTransparent(im)); } /* }}} */ @@ -3310,7 +3310,7 @@ PHP_FUNCTION(imageinterlace) gdImageInterlace(im, INT); } - RETURN_LONG(gdImageGetInterlaced(im)); + RETURN_INT(gdImageGetInterlaced(im)); } /* }}} */ @@ -3354,23 +3354,23 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) for (i = 0; i < npoints; i++) { if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2))) != NULL) { - if (Z_TYPE_P(var) != IS_LONG) { + if (Z_TYPE_P(var) != IS_INT) { zval lval; ZVAL_COPY(&lval, var); - convert_to_long(&lval); - points[i].x = Z_LVAL(lval); + convert_to_int(&lval); + points[i].x = Z_IVAL(lval); } else { - points[i].x = Z_LVAL_P(var); + points[i].x = Z_IVAL_P(var); } } if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2) + 1)) != NULL) { - if (Z_TYPE_P(var) != IS_LONG) { + if (Z_TYPE_P(var) != IS_INT) { zval lval; ZVAL_COPY(&lval, var); - convert_to_long(&lval); - points[i].y = Z_LVAL(lval); + convert_to_int(&lval); + points[i].y = Z_IVAL(lval); } else { - points[i].y = Z_LVAL_P(var); + points[i].y = Z_IVAL_P(var); } } } @@ -3457,7 +3457,7 @@ static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) } font = php_find_gd_font(SIZE TSRMLS_CC); - RETURN_LONG(arg ? font->h : font->w); + RETURN_INT(arg ? font->h : font->w); } /* }}} */ @@ -3736,7 +3736,7 @@ PHP_FUNCTION(imagesx) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageSX(im)); + RETURN_INT(gdImageSX(im)); } /* }}} */ @@ -3753,7 +3753,7 @@ PHP_FUNCTION(imagesy) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageSY(im)); + RETURN_INT(gdImageSY(im)); } /* }}} */ @@ -3878,7 +3878,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* return array with the text's bounding box */ for (i = 0; i < 8; i++) { - add_next_index_long(return_value, brect[i]); + add_next_index_int(return_value, brect[i]); } } /* }}} */ @@ -3994,7 +3994,7 @@ PHP_FUNCTION(imagepscopyfont) nf_ind->extend = 1; l_ind = zend_list_insert(nf_ind, le_ps_font TSRMLS_CC); - RETURN_LONG(l_ind); + RETURN_INT(l_ind); } */ /* }}} */ @@ -4231,10 +4231,10 @@ PHP_FUNCTION(imagepstext) array_init(return_value); - add_next_index_long(return_value, str_img->metrics.leftSideBearing); - add_next_index_long(return_value, str_img->metrics.descent); - add_next_index_long(return_value, str_img->metrics.rightSideBearing); - add_next_index_long(return_value, str_img->metrics.ascent); + add_next_index_int(return_value, str_img->metrics.leftSideBearing); + add_next_index_int(return_value, str_img->metrics.descent); + add_next_index_int(return_value, str_img->metrics.rightSideBearing); + add_next_index_int(return_value, str_img->metrics.ascent); } /* }}} */ @@ -4330,10 +4330,10 @@ PHP_FUNCTION(imagepsbbox) /* printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); } /* }}} */ #endif @@ -4972,13 +4972,13 @@ PHP_FUNCTION(imagecrop) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") -1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.x = Z_LVAL(lval); + convert_to_int(&lval); + rect.x = Z_IVAL(lval); } else { - rect.x = Z_LVAL_P(tmp); + rect.x = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -4986,13 +4986,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.y = Z_LVAL(lval); + convert_to_int(&lval); + rect.y = Z_IVAL(lval); } else { - rect.y = Z_LVAL_P(tmp); + rect.y = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5000,13 +5000,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.width = Z_LVAL(lval); + convert_to_int(&lval); + rect.width = Z_IVAL(lval); } else { - rect.width = Z_LVAL_P(tmp); + rect.width = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5014,13 +5014,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.height = Z_LVAL(lval); + convert_to_int(&lval); + rect.height = Z_IVAL(lval); } else { - rect.height = Z_LVAL_P(tmp); + rect.height = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5147,8 +5147,8 @@ PHP_FUNCTION(imageaffine) for (i = 0; i < nelems; i++) { if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) { switch (Z_TYPE_P(zval_affine_elem)) { - case IS_LONG: - affine[i] = Z_LVAL_P(zval_affine_elem); + case IS_INT: + affine[i] = Z_IVAL_P(zval_affine_elem); break; case IS_DOUBLE: affine[i] = Z_DVAL_P(zval_affine_elem); @@ -5170,13 +5170,13 @@ PHP_FUNCTION(imageaffine) if (z_rect != NULL) { if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.x = Z_LVAL(lval); + convert_to_int(&lval); + rect.x = Z_IVAL(lval); } else { - rect.x = Z_LVAL_P(tmp); + rect.x = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -5184,13 +5184,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.y = Z_LVAL(lval); + convert_to_int(&lval); + rect.y = Z_IVAL(lval); } else { - rect.y = Z_LVAL_P(tmp); + rect.y = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5198,13 +5198,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.width = Z_LVAL(lval); + convert_to_int(&lval); + rect.width = Z_IVAL(lval); } else { - rect.width = Z_LVAL_P(tmp); + rect.width = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5212,13 +5212,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.height = Z_LVAL(lval); + convert_to_int(&lval); + rect.height = Z_IVAL(lval); } else { - rect.height = Z_LVAL_P(tmp); + rect.height = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5365,8 +5365,8 @@ PHP_FUNCTION(imageaffinematrixconcat) for (i = 0; i < 6; i++) { if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_LONG: - m1[i] = Z_LVAL_P(tmp); + case IS_INT: + m1[i] = Z_IVAL_P(tmp); break; case IS_DOUBLE: m1[i] = Z_DVAL_P(tmp); @@ -5386,8 +5386,8 @@ PHP_FUNCTION(imageaffinematrixconcat) } if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_LONG: - m2[i] = Z_LVAL_P(tmp); + case IS_INT: + m2[i] = Z_IVAL_P(tmp); break; case IS_DOUBLE: m2[i] = Z_DVAL_P(tmp); diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 17ec39d087..01cdf71aa4 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -407,9 +407,9 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* gmpnum = GET_GMP_FROM_ZVAL(readobj); gmp_strval(writeobj, gmpnum, 10); return SUCCESS; - case IS_LONG: + case IS_INT: gmpnum = GET_GMP_FROM_ZVAL(readobj); - ZVAL_LONG(writeobj, mpz_get_si(gmpnum)); + ZVAL_INT(writeobj, mpz_get_si(gmpnum)); return SUCCESS; case IS_DOUBLE: gmpnum = GET_GMP_FROM_ZVAL(readobj); @@ -452,7 +452,7 @@ static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */ /* }}} */ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2 TSRMLS_DC) { - long shift = zval_get_long(op2); + long shift = zval_get_int(op2); if (shift < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shift cannot be negative"); @@ -523,7 +523,7 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { gmp_cmp(result, op1, op2 TSRMLS_CC); if (Z_TYPE_P(result) == IS_FALSE) { - ZVAL_LONG(result, 1); + ZVAL_INT(result, 1); } return SUCCESS; } @@ -631,9 +631,9 @@ ZEND_MINIT_FUNCTION(gmp) gmp_object_handlers.do_operation = gmp_do_operation; gmp_object_handlers.compare = gmp_compare; - REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); #ifdef mpir_version REGISTER_STRING_CONSTANT("GMP_MPIR_VERSION", (char *)mpir_version, CONST_CS | CONST_PERSISTENT); #endif @@ -679,10 +679,10 @@ ZEND_MODULE_INFO_D(gmp) static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) { switch (Z_TYPE_P(val)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: { - mpz_set_si(gmpnumber, zval_get_long(val)); + mpz_set_si(gmpnumber, zval_get_int(val)); return SUCCESS; } case IS_STRING: { @@ -690,7 +690,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) int skip_lead = 0; int ret; - if (Z_STRLEN_P(val) > 2) { + if (Z_STRSIZE_P(val) > 2) { if (numstr[0] == '0') { if (numstr[1] == 'x' || numstr[1] == 'X') { base = 16; @@ -759,7 +759,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (Z_TYPE_P(b_arg) == IS_LONG) { + if (Z_TYPE_P(b_arg) == IS_INT) { use_si = 1; temp_b.is_used = 0; } else { @@ -767,7 +767,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { } if (use_si) { - res = mpz_cmp_si(gmpnum_a, Z_LVAL_P(b_arg)); + res = mpz_cmp_si(gmpnum_a, Z_IVAL_P(b_arg)); } else { res = mpz_cmp(gmpnum_a, gmpnum_b); } @@ -775,7 +775,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); - RETURN_LONG(res); + RETURN_INT(res); } /* }}} */ @@ -790,7 +790,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { use_ui = 1; temp_b.is_used = 0; } else { @@ -800,7 +800,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_LVAL_P(b_arg) == 0); + b_is_zero = (Z_IVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -816,7 +816,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - gmp_ui_op(gmpnum_result, gmpnum_a, (unsigned long) Z_LVAL_P(b_arg)); + gmp_ui_op(gmpnum_result, gmpnum_a, (unsigned long) Z_IVAL_P(b_arg)); } else { gmp_op(gmpnum_result, gmpnum_a, gmpnum_b); } @@ -838,7 +838,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { /* use _ui function */ use_ui = 1; temp_b.is_used = 0; @@ -849,7 +849,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_LVAL_P(b_arg) == 0); + b_is_zero = (Z_IVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -870,7 +870,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval add_next_index_zval(return_value, &result2); if (use_ui) { - gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) Z_LVAL_P(b_arg)); + gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) Z_IVAL_P(b_arg)); } else { gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b); } @@ -919,7 +919,7 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una mpz_ptr gmpnum_result; INIT_GMP_RETVAL(gmpnum_result); - gmp_op(gmpnum_result, zval_get_long(a_arg)); + gmp_op(gmpnum_result, zval_get_int(a_arg)); } /* }}} */ @@ -965,7 +965,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(gmp_op(gmpnum_a)); + RETVAL_INT(gmp_op(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -985,7 +985,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - RETVAL_LONG(gmp_op(gmpnum_a, gmpnum_b)); + RETVAL_INT(gmp_op(gmpnum_a, gmpnum_b)); FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); @@ -1028,9 +1028,9 @@ ZEND_FUNCTION(gmp_intval) } if (IS_GMP(gmpnumber_arg)) { - RETVAL_LONG(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); + RETVAL_INT(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); } else { - RETVAL_LONG(zval_get_long(gmpnumber_arg)); + RETVAL_INT(zval_get_int(gmpnumber_arg)); } } /* }}} */ @@ -1226,7 +1226,7 @@ ZEND_FUNCTION(gmp_fact) RETURN_FALSE; } } else { - if (zval_get_long(a_arg) < 0) { + if (zval_get_int(a_arg) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); RETURN_FALSE; } @@ -1255,8 +1255,8 @@ ZEND_FUNCTION(gmp_pow) } INIT_GMP_RETVAL(gmpnum_result); - if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) { - mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp); + if (Z_TYPE_P(base_arg) == IS_INT && Z_IVAL_P(base_arg) >= 0) { + mpz_ui_pow_ui(gmpnum_result, Z_IVAL_P(base_arg), exp); } else { FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); mpz_pow_ui(gmpnum_result, gmpnum_base, exp); @@ -1280,7 +1280,7 @@ ZEND_FUNCTION(gmp_powm) FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); - if (Z_TYPE_P(exp_arg) == IS_LONG && Z_LVAL_P(exp_arg) >= 0) { + if (Z_TYPE_P(exp_arg) == IS_INT && Z_IVAL_P(exp_arg) >= 0) { use_ui = 1; temp_exp.is_used = 0; } else { @@ -1305,7 +1305,7 @@ ZEND_FUNCTION(gmp_powm) INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - mpz_powm_ui(gmpnum_result, gmpnum_base, (unsigned long) Z_LVAL_P(exp_arg), gmpnum_mod); + mpz_powm_ui(gmpnum_result, gmpnum_base, (unsigned long) Z_IVAL_P(exp_arg), gmpnum_mod); } else { mpz_powm(gmpnum_result, gmpnum_base, gmpnum_exp, gmpnum_mod); FREE_GMP_TEMP(temp_exp); @@ -1488,7 +1488,7 @@ ZEND_FUNCTION(gmp_prob_prime) FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a); - RETVAL_LONG(mpz_probab_prime_p(gmpnum_a, reps)); + RETVAL_INT(mpz_probab_prime_p(gmpnum_a, reps)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1604,7 +1604,7 @@ ZEND_FUNCTION(gmp_sign) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_sgn(gmpnum_a)); + RETVAL_INT(mpz_sgn(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1789,7 +1789,7 @@ ZEND_FUNCTION(gmp_scan0) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_scan0(gmpnum_a, start)); + RETVAL_INT(mpz_scan0(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1814,7 +1814,7 @@ ZEND_FUNCTION(gmp_scan1) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_scan1(gmpnum_a, start)); + RETVAL_INT(mpz_scan1(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ diff --git a/ext/hash/hash.c b/ext/hash/hash.c index fe02cbe83f..dceb4d0ca8 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -436,14 +436,14 @@ PHP_FUNCTION(hash_update_stream) if ((n = php_stream_read(stream, buf, toread)) <= 0) { /* Nada mas */ - RETURN_LONG(didread); + RETURN_INT(didread); } hash->ops->hash_update(hash->context, (unsigned char *) buf, n); length -= n; didread += n; } - RETURN_LONG(didread); + RETURN_INT(didread); } /* }}} */ @@ -743,7 +743,7 @@ PHP_FUNCTION(hash_equals) RETURN_FALSE; } - if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) { + if (Z_STRSIZE_P(known_zval) != Z_STRSIZE_P(user_zval)) { RETURN_FALSE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(hash_equals) user_str = Z_STRVAL_P(user_zval); /* This is security sensitive code. Do not optimize this for speed. */ - for (j = 0; j < Z_STRLEN_P(known_zval); j++) { + for (j = 0; j < Z_STRSIZE_P(known_zval); j++) { result |= known_str[j] ^ user_str[j]; } @@ -819,7 +819,7 @@ static void mhash_init(INIT_FUNC_ARGS) } len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name)); - zend_register_long_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); + zend_register_int_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); } zend_register_internal_module(&mhash_module_entry TSRMLS_CC); } @@ -836,8 +836,8 @@ PHP_FUNCTION(mhash) } SEPARATE_ZVAL(z_algorithm); - convert_to_long_ex(z_algorithm); - algorithm = Z_LVAL_P(z_algorithm); + convert_to_int_ex(z_algorithm); + algorithm = Z_IVAL_P(z_algorithm); /* need to convert the first parameter from int constant to string algorithm name */ if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) { @@ -884,7 +884,7 @@ PHP_FUNCTION(mhash_count) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(MHASH_NUM_ALGOS - 1); + RETURN_INT(MHASH_NUM_ALGOS - 1); } /* }}} */ @@ -904,7 +904,7 @@ PHP_FUNCTION(mhash_get_block_size) if (algorithm_lookup.mhash_name) { const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name)); if (ops) { - RETVAL_LONG(ops->digest_size); + RETVAL_INT(ops->digest_size); } } } @@ -1044,7 +1044,7 @@ PHP_MINIT_FUNCTION(hash) PHP_HASH_HAVAL_REGISTER(5,224); PHP_HASH_HAVAL_REGISTER(5,256); - REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); #ifdef PHP_MHASH_BC mhash_init(INIT_FUNC_ARGS_PASSTHRU); diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 39c5b314a8..9b6dcbb216 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -300,8 +300,8 @@ PHP_MINIT_FUNCTION(miconv) #endif REGISTER_STRING_CONSTANT("ICONV_VERSION", version, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); if (php_iconv_stream_filter_register_factory(TSRMLS_C) != PHP_ICONV_ERR_SUCCESS) { return FAILURE; @@ -2054,7 +2054,7 @@ PHP_FUNCTION(iconv_strlen) err = _php_iconv_strlen(&retval, str, str_len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { - RETVAL_LONG(retval); + RETVAL_INT(retval); } else { RETVAL_FALSE; } @@ -2142,7 +2142,7 @@ PHP_FUNCTION(iconv_strpos) _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { - RETVAL_LONG((long)retval); + RETVAL_INT((long)retval); } else { RETVAL_FALSE; } @@ -2184,7 +2184,7 @@ PHP_FUNCTION(iconv_strrpos) _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { - RETVAL_LONG((long)retval); + RETVAL_INT((long)retval); } else { RETVAL_FALSE; } @@ -2221,7 +2221,7 @@ PHP_FUNCTION(iconv_mime_encode) zval *pzval; if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) { - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { switch (Z_STRVAL_P(pzval)[0]) { case 'B': case 'b': scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; @@ -2235,24 +2235,24 @@ PHP_FUNCTION(iconv_mime_encode) } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL) { - if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRSIZE_P(pzval) >= 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_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { in_charset = Z_STRVAL_P(pzval); } } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL) { - if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRSIZE_P(pzval) >= 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_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { out_charset = Z_STRVAL_P(pzval); } } @@ -2260,13 +2260,13 @@ PHP_FUNCTION(iconv_mime_encode) if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-length", sizeof("line-length") - 1)) != NULL) { zval val; - if (Z_TYPE_P(pzval) != IS_LONG) { + if (Z_TYPE_P(pzval) != IS_INT) { ZVAL_DUP(&val, pzval); - convert_to_long(&val); + convert_to_int(&val); pzval = &val; } - line_len = Z_LVAL_P(pzval); + line_len = Z_IVAL_P(pzval); } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) { diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 09295a87f3..6e33e463ae 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -770,12 +770,12 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist) if (strncmp(qlist->name, "STORAGE", 7) == 0) { /* this is to add backwards compatibility */ - add_assoc_long_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_long_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_int_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_int_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); } - add_assoc_long_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_long_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_int_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_int_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); add_assoc_zval_ex(return_value, qlist->name, strlen(qlist->name), &t_map); } } @@ -864,7 +864,7 @@ PHP_MINIT_FUNCTION(imap) #endif /* lets allow NIL */ - REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); /* plug in our gets */ mail_parameters(NIL, SET_GETS, (void *) NIL); @@ -876,30 +876,30 @@ PHP_MINIT_FUNCTION(imap) mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) FG(default_socket_timeout)); /* timeout constants */ - REGISTER_LONG_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); /* Open Options */ - REGISTER_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); /* debug protocol negotiations */ - REGISTER_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); /* read-only open */ - REGISTER_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); /* anonymous open of newsgroup */ - REGISTER_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); /* short (elt-only) caching */ - REGISTER_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); /* don't pass up events (internal use) */ - REGISTER_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); /* return driver prototype */ - REGISTER_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); /* half-open (IMAP connect but no select) */ - REGISTER_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* silently expunge recycle stream */ - REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); /* don't do non-secure authentication */ /* @@ -910,111 +910,111 @@ PHP_MINIT_FUNCTION(imap) options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of this file */ - REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* expunge silently */ /* Fetch options */ - REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID */ - REGISTER_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); /* peek at data */ - REGISTER_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); /* NOT flag for header lines fetch */ - REGISTER_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); /* text can be internal strings */ - REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); /* IMAP prefetch text when fetching header */ /* Flagging options */ - REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); /* don't return results */ - REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); /* set vs. clear */ /* Copy options */ - REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); /* delete from source after copying */ /* Search/sort options */ - REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); /* return UID */ - REGISTER_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); /* free search program after finished */ - REGISTER_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); /* no search prefetching */ - REGISTER_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); /* free sort program after finished */ - REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); /* don't do server-based sort */ /* Status options */ - REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); /* number of messages */ - REGISTER_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); /* number of recent messages */ - REGISTER_LONG_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); /* number of unseen messages */ - REGISTER_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); /* next UID to be assigned */ - REGISTER_LONG_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ - REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ /* Bits for mm_list() and mm_lsub() */ - REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); #ifdef LATT_REFERRAL - REGISTER_LONG_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASCHILDREN - REGISTER_LONG_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASNOCHILDREN - REGISTER_LONG_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); #endif /* Sort functions */ - REGISTER_LONG_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); /* date */ - REGISTER_LONG_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); /* arrival date */ - REGISTER_LONG_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); /* from */ - REGISTER_LONG_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); /* subject */ - REGISTER_LONG_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); /* to */ - REGISTER_LONG_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); /* cc */ - REGISTER_LONG_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); /* size */ - REGISTER_LONG_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); /* TYPETEXT unformatted text TYPEMULTIPART multiple part @@ -1027,12 +1027,12 @@ PHP_MINIT_FUNCTION(imap) TYPEOTHER unknown */ - REGISTER_LONG_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); /* ENC7BIT 7 bit SMTP semantic data ENC8BIT 8 bit SMTP semantic data @@ -1042,9 +1042,9 @@ PHP_MINIT_FUNCTION(imap) ENCOTHER unknown */ - REGISTER_LONG_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); /* GC_ELT message cache elements GC_ENV ENVELOPEs and BODYs @@ -1173,7 +1173,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if ((disabled_auth_method = zend_hash_str_find(HASH_OF(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) { switch (Z_TYPE_P(disabled_auth_method)) { case IS_STRING: - if (Z_STRLEN_P(disabled_auth_method) > 1) { + if (Z_STRSIZE_P(disabled_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(disabled_auth_method)); } break; @@ -1189,7 +1189,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) for (i = 0; i < nelems; i++) { if ((z_auth_method = zend_hash_index_find(Z_ARRVAL_P(disabled_auth_method), i)) != NULL) { if (Z_TYPE_P(z_auth_method) == IS_STRING) { - if (Z_STRLEN_P(z_auth_method) > 1) { + if (Z_STRSIZE_P(z_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(z_auth_method)); } } else { @@ -1199,7 +1199,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } break; - case IS_LONG: + case IS_INT: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -1339,7 +1339,7 @@ PHP_FUNCTION(imap_append) php_pcre_match_impl(pce, internal_date, internal_date_len, return_value, subpats, global, 0, regex_flags, start_offset TSRMLS_CC); - if (!Z_LVAL_P(return_value)) { + if (!Z_IVAL_P(return_value)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted"); internal_date = NULL; } @@ -1370,7 +1370,7 @@ PHP_FUNCTION(imap_num_msg) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(imap_le_struct->imap_stream->nmsgs); + RETURN_INT(imap_le_struct->imap_stream->nmsgs); } /* }}} */ @@ -1404,7 +1404,7 @@ PHP_FUNCTION(imap_num_recent) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(imap_le_struct->imap_stream->recent); + RETURN_INT(imap_le_struct->imap_stream->recent); } /* }}} */ @@ -1906,7 +1906,7 @@ PHP_FUNCTION(imap_list_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_long(&mboxob, "attributes", cur->attributes); + add_property_int(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -1981,8 +1981,8 @@ PHP_FUNCTION(imap_check) add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); } else { RETURN_FALSE; } @@ -2101,7 +2101,7 @@ PHP_FUNCTION(imap_headerinfo) snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size); add_property_string(return_value, "Size", dummy); - add_property_long(return_value, "udate", mail_longdate(cache)); + add_property_int(return_value, "udate", mail_longdate(cache)); if (en->from && fromlength) { fulladdress[0] = 0x00; @@ -2211,7 +2211,7 @@ PHP_FUNCTION(imap_lsub_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_long(&mboxob, "attributes", cur->attributes); + add_property_int(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -2424,7 +2424,7 @@ PHP_FUNCTION(imap_savebody) switch (Z_TYPE_P(out)) { - case IS_LONG: + case IS_INT: case IS_RESOURCE: close_stream = 0; php_stream_from_zval(writer, out); @@ -2581,15 +2581,15 @@ PHP_FUNCTION(imap_mailboxmsginfo) } msize = msize + cache->rfc822_size; } - add_property_long(return_value, "Unread", unreadmsg); - add_property_long(return_value, "Deleted", deletedmsg); - add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_long(return_value, "Size", msize); + add_property_int(return_value, "Unread", unreadmsg); + add_property_int(return_value, "Deleted", deletedmsg); + add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_int(return_value, "Size", msize); rfc822_date(date); add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); } /* }}} */ @@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_sort) array_init(return_value); if (slst != NIL && slst != 0) { for (sl = slst; *sl; sl++) { - add_next_index_long(return_value, *sl); + add_next_index_int(return_value, *sl); } fs_give ((void **) &slst); } @@ -3193,7 +3193,7 @@ PHP_FUNCTION(imap_uid) RETURN_FALSE; } - RETURN_LONG(mail_uid(imap_le_struct->imap_stream, msgno)); + RETURN_INT(mail_uid(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3211,7 +3211,7 @@ PHP_FUNCTION(imap_msgno) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); + RETURN_INT(mail_msgno(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3234,21 +3234,21 @@ PHP_FUNCTION(imap_status) object_init(return_value); if (mail_status(imap_le_struct->imap_stream, mbx, flags)) { - add_property_long(return_value, "flags", IMAPG(status_flags)); + add_property_int(return_value, "flags", IMAPG(status_flags)); if (IMAPG(status_flags) & SA_MESSAGES) { - add_property_long(return_value, "messages", IMAPG(status_messages)); + add_property_int(return_value, "messages", IMAPG(status_messages)); } if (IMAPG(status_flags) & SA_RECENT) { - add_property_long(return_value, "recent", IMAPG(status_recent)); + add_property_int(return_value, "recent", IMAPG(status_recent)); } if (IMAPG(status_flags) & SA_UNSEEN) { - add_property_long(return_value, "unseen", IMAPG(status_unseen)); + add_property_int(return_value, "unseen", IMAPG(status_unseen)); } if (IMAPG(status_flags) & SA_UIDNEXT) { - add_property_long(return_value, "uidnext", IMAPG(status_uidnext)); + add_property_int(return_value, "uidnext", IMAPG(status_uidnext)); } if (IMAPG(status_flags) & SA_UIDVALIDITY) { - add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity)); + add_property_int(return_value, "uidvalidity", IMAPG(status_uidvalidity)); } } else { RETURN_FALSE; @@ -3288,49 +3288,49 @@ PHP_FUNCTION(imap_bodystruct) RETURN_FALSE; } if (body->type <= TYPEMAX) { - add_property_long(return_value, "type", body->type); + add_property_int(return_value, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_long(return_value, "encoding", body->encoding); + add_property_int(return_value, "encoding", body->encoding); } if (body->subtype) { - add_property_long(return_value, "ifsubtype", 1); + add_property_int(return_value, "ifsubtype", 1); add_property_string(return_value, "subtype", body->subtype); } else { - add_property_long(return_value, "ifsubtype", 0); + add_property_int(return_value, "ifsubtype", 0); } if (body->description) { - add_property_long(return_value, "ifdescription", 1); + add_property_int(return_value, "ifdescription", 1); add_property_string(return_value, "description", body->description); } else { - add_property_long(return_value, "ifdescription", 0); + add_property_int(return_value, "ifdescription", 0); } if (body->id) { - add_property_long(return_value, "ifid", 1); + add_property_int(return_value, "ifid", 1); add_property_string(return_value, "id", body->id); } else { - add_property_long(return_value, "ifid", 0); + add_property_int(return_value, "ifid", 0); } if (body->size.lines) { - add_property_long(return_value, "lines", body->size.lines); + add_property_int(return_value, "lines", body->size.lines); } if (body->size.bytes) { - add_property_long(return_value, "bytes", body->size.bytes); + add_property_int(return_value, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_long(return_value, "ifdisposition", 1); + add_property_int(return_value, "ifdisposition", 1); add_property_string(return_value, "disposition", body->disposition.type); } else { - add_property_long(return_value, "ifdisposition", 0); + add_property_int(return_value, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_long(return_value, "ifdparameters", 1); + add_property_int(return_value, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -3340,12 +3340,12 @@ PHP_FUNCTION(imap_bodystruct) } while ((dpar = dpar->next)); add_assoc_object(return_value, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_long(return_value, "ifdparameters", 0); + add_property_int(return_value, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_long(return_value, "ifparameters", 1); + add_property_int(return_value, "ifparameters", 1); array_init(¶metres); do { @@ -3361,7 +3361,7 @@ PHP_FUNCTION(imap_bodystruct) } while ((par = par->next)); } else { object_init(¶metres); - add_property_long(return_value, "ifparameters", 0); + add_property_int(return_value, "ifparameters", 0); } add_assoc_object(return_value, "parameters", ¶metres TSRMLS_CC); } @@ -3436,16 +3436,16 @@ PHP_FUNCTION(imap_fetch_overview) if (env->in_reply_to) { add_property_string(&myoverview, "in_reply_to", env->in_reply_to); } - add_property_long(&myoverview, "size", elt->rfc822_size); - add_property_long(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); - add_property_long(&myoverview, "msgno", i); - add_property_long(&myoverview, "recent", elt->recent); - add_property_long(&myoverview, "flagged", elt->flagged); - add_property_long(&myoverview, "answered", elt->answered); - add_property_long(&myoverview, "deleted", elt->deleted); - add_property_long(&myoverview, "seen", elt->seen); - add_property_long(&myoverview, "draft", elt->draft); - add_property_long(&myoverview, "udate", mail_longdate(elt)); + add_property_int(&myoverview, "size", elt->rfc822_size); + add_property_int(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); + add_property_int(&myoverview, "msgno", i); + add_property_int(&myoverview, "recent", elt->recent); + add_property_int(&myoverview, "flagged", elt->flagged); + add_property_int(&myoverview, "answered", elt->answered); + add_property_int(&myoverview, "deleted", elt->deleted); + add_property_int(&myoverview, "seen", elt->seen); + add_property_int(&myoverview, "draft", elt->draft); + add_property_int(&myoverview, "udate", mail_longdate(elt)); add_next_index_object(return_value, &myoverview TSRMLS_CC); } } @@ -3474,7 +3474,7 @@ PHP_FUNCTION(imap_mail_compose) } #define PHP_RFC822_PARSE_ADRLIST(target, value) \ - str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \ + str_copy = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); \ rfc822_parse_adrlist(target, str_copy, "NO HOST"); \ efree(str_copy); @@ -3530,9 +3530,9 @@ PHP_FUNCTION(imap_mail_compose) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) { custom_headers_param = mail_newbody_parameter(); convert_to_string_ex(env_data); - custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1); + custom_headers_param->value = (char *) fs_get(Z_STRSIZE_P(env_data) + 1); custom_headers_param->attribute = NULL; - memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1); + memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRSIZE_P(env_data) + 1); custom_headers_param->next = tmp_param; tmp_param = custom_headers_param; } ZEND_HASH_FOREACH_END(); @@ -3553,12 +3553,12 @@ PHP_FUNCTION(imap_mail_compose) topbod = bod; if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->type = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->type = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->encoding = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->encoding = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3575,8 +3575,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3597,8 +3597,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3607,8 +3607,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3617,21 +3617,21 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); - bod->contents.text.size = Z_STRLEN_P(pvalue); + bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); + bod->contents.text.size = Z_STRSIZE_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); bod->contents.text.size = 0; } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.lines = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.lines = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.bytes = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.bytes = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3640,8 +3640,8 @@ PHP_FUNCTION(imap_mail_compose) } else if (Z_TYPE_P(data) == IS_ARRAY) { short type = -1; if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { - convert_to_long_ex(pvalue); - type = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + type = (short) Z_IVAL_P(pvalue); } if (!toppart) { @@ -3660,14 +3660,14 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->encoding = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->encoding = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); tmp_param = mail_newbody_parameter(); - tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); + tmp_param->value = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); tmp_param->attribute = cpystr("CHARSET"); tmp_param->next = bod->parameter; bod->parameter = tmp_param; @@ -3679,8 +3679,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *)fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3701,8 +3701,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3711,8 +3711,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3721,21 +3721,21 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); - bod->contents.text.size = Z_STRLEN_P(pvalue); + bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); + bod->contents.text.size = Z_STRSIZE_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); bod->contents.text.size = 0; } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.lines = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.lines = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.bytes = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.bytes = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -4101,7 +4101,7 @@ PHP_FUNCTION(imap_search) cur = IMAPG(imap_messages); while (cur != NIL) { - add_next_index_long(return_value, cur->msgid); + add_next_index_int(return_value, cur->msgid); cur = cur->next; } mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail)); @@ -4513,53 +4513,53 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) PART *part; if (body->type <= TYPEMAX) { - add_property_long(arg, "type", body->type); + add_property_int(arg, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_long(arg, "encoding", body->encoding); + add_property_int(arg, "encoding", body->encoding); } if (body->subtype) { - add_property_long(arg, "ifsubtype", 1); + add_property_int(arg, "ifsubtype", 1); add_property_string(arg, "subtype", body->subtype); } else { - add_property_long(arg, "ifsubtype", 0); + add_property_int(arg, "ifsubtype", 0); } if (body->description) { - add_property_long(arg, "ifdescription", 1); + add_property_int(arg, "ifdescription", 1); add_property_string(arg, "description", body->description); } else { - add_property_long(arg, "ifdescription", 0); + add_property_int(arg, "ifdescription", 0); } if (body->id) { - add_property_long(arg, "ifid", 1); + add_property_int(arg, "ifid", 1); add_property_string(arg, "id", body->id); } else { - add_property_long(arg, "ifid", 0); + add_property_int(arg, "ifid", 0); } if (body->size.lines) { - add_property_long(arg, "lines", body->size.lines); + add_property_int(arg, "lines", body->size.lines); } if (body->size.bytes) { - add_property_long(arg, "bytes", body->size.bytes); + add_property_int(arg, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_long(arg, "ifdisposition", 1); + add_property_int(arg, "ifdisposition", 1); add_property_string(arg, "disposition", body->disposition.type); } else { - add_property_long(arg, "ifdisposition", 0); + add_property_int(arg, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_long(arg, "ifdparameters", 1); + add_property_int(arg, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -4569,12 +4569,12 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((dpar = dpar->next)); add_assoc_object(arg, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_long(arg, "ifdparameters", 0); + add_property_int(arg, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_long(arg, "ifparameters", 1); + add_property_int(arg, "ifparameters", 1); array_init(¶metres); do { @@ -4590,7 +4590,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((par = par->next)); } else { object_init(¶metres); - add_property_long(arg, "ifparameters", 0); + add_property_int(arg, "ifparameters", 0); } add_assoc_object(arg, "parameters", ¶metres TSRMLS_CC); @@ -4627,24 +4627,24 @@ static void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes /* define "#.num" */ snprintf(buf, 25, "%ld.num", thisNode); - add_assoc_long(tree, buf, cur->num); + add_assoc_int(tree, buf, cur->num); snprintf(buf, 25, "%ld.next", thisNode); if(cur->next) { (*numNodes)++; - add_assoc_long(tree, buf, *numNodes); + add_assoc_int(tree, buf, *numNodes); build_thread_tree_helper(cur->next, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_long(tree, buf, 0); + add_assoc_int(tree, buf, 0); } snprintf(buf, 25, "%ld.branch", thisNode); if(cur->branch) { (*numNodes)++; - add_assoc_long(tree, buf, *numNodes); + add_assoc_int(tree, buf, *numNodes); build_thread_tree_helper(cur->branch, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_long(tree, buf, 0); + add_assoc_int(tree, buf, 0); } } /* }}} */ @@ -4733,7 +4733,7 @@ PHP_FUNCTION(imap_timeout) } timeout = (long) mail_parameters(NIL, timeout_type, NIL); - RETURN_LONG(timeout); + RETURN_INT(timeout); } else if (timeout >= 0) { switch (ttype) { case 1: diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c index 8b8d731d7b..13265c7745 100644 --- a/ext/interbase/ibase_blobs.c +++ b/ext/interbase/ibase_blobs.c @@ -135,7 +135,7 @@ int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob TSRMLS_DC) /* {{{ convert_to_string_ex(string_arg); - for (rem_cnt = Z_STRLEN_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -337,9 +337,9 @@ PHP_FUNCTION(ibase_blob_get) RETURN_FALSE; } - convert_to_long_ex(len_arg); + convert_to_int_ex(len_arg); - if (_php_ibase_blob_get(return_value, ib_blob, Z_LVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { + if (_php_ibase_blob_get(return_value, ib_blob, Z_IVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } } @@ -460,14 +460,14 @@ PHP_FUNCTION(ibase_blob_info) array_init(return_value); - add_index_long(return_value, 0, bl_info.total_length); - add_assoc_long(return_value, "length", bl_info.total_length); + add_index_int(return_value, 0, bl_info.total_length); + add_assoc_int(return_value, "length", bl_info.total_length); - add_index_long(return_value, 1, bl_info.num_segments); - add_assoc_long(return_value, "numseg", bl_info.num_segments); + add_index_int(return_value, 1, bl_info.num_segments); + add_assoc_int(return_value, "numseg", bl_info.num_segments); - add_index_long(return_value, 2, bl_info.max_segment); - add_assoc_long(return_value, "maxseg", bl_info.max_segment); + add_index_int(return_value, 2, bl_info.max_segment); + add_assoc_int(return_value, "maxseg", bl_info.max_segment); add_index_bool(return_value, 3, bl_info.bl_stream); add_assoc_bool(return_value, "stream", bl_info.bl_stream); diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index ab1a791d37..f8eb3b8521 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -297,8 +297,8 @@ PHP_FUNCTION(ibase_set_event_handler) RETURN_FALSE; } - convert_to_long_ex(&args[0]); - link_res_id = Z_LVAL(args[0]); + convert_to_int_ex(&args[0]); + link_res_id = Z_IVAL(args[0]); } else { /* callback, event_1 [, ... event_15] diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c index 1899e5aae1..13306c78eb 100644 --- a/ext/interbase/ibase_query.c +++ b/ext/interbase/ibase_query.c @@ -29,8 +29,8 @@ #include "php_interbase.h" #include "php_ibase_includes.h" -#define ISC_LONG_MIN INT_MIN -#define ISC_LONG_MAX INT_MAX +#define ISC_INT_MIN INT_MIN +#define ISC_INT_MAX INT_MAX #define QUERY_RESULT 1 #define EXECUTE_RESULT 2 @@ -498,7 +498,7 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / *(short*) buf = (short) l; break; case SQL_LONG: - if (l > ISC_LONG_MAX || l < ISC_LONG_MIN) { + if (l > ISC_INT_MAX || l < ISC_INT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } @@ -534,27 +534,27 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / ISC_INT64 l; case SQL_SHORT: - convert_to_long(val); - if (Z_LVAL_P(val) > SHRT_MAX || Z_LVAL_P(val) < SHRT_MIN) { + convert_to_int(val); + if (Z_IVAL_P(val) > SHRT_MAX || Z_IVAL_P(val) < SHRT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } - *(short *) buf = (short) Z_LVAL_P(val); + *(short *) buf = (short) Z_IVAL_P(val); break; case SQL_LONG: - convert_to_long(val); + convert_to_int(val); #if (SIZEOF_LONG > 4) - if (Z_LVAL_P(val) > ISC_LONG_MAX || Z_LVAL_P(val) < ISC_LONG_MIN) { + if (Z_IVAL_P(val) > ISC_INT_MAX || Z_IVAL_P(val) < ISC_INT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } #endif - *(ISC_LONG *) buf = (ISC_LONG) Z_LVAL_P(val); + *(ISC_LONG *) buf = (ISC_LONG) Z_IVAL_P(val); break; case SQL_INT64: #if (SIZEOF_LONG >= 8) - convert_to_long(val); - *(long *) buf = Z_LVAL_P(val); + convert_to_int(val); + *(long *) buf = Z_IVAL_P(val); #else convert_to_string(val); if (!sscanf(Z_STRVAL_P(val), "%" LL_MASK "d", &l)) { @@ -664,7 +664,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(b_var) == 0); + force_null = (Z_STRSIZE_P(b_var) == 0); } if (! force_null) break; @@ -689,9 +689,9 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - if (Z_TYPE_P(b_var) == IS_LONG) { + if (Z_TYPE_P(b_var) == IS_INT) { struct tm *res; - res = php_gmtime_r(&Z_LVAL_P(b_var), &t); + res = php_gmtime_r(&Z_IVAL_P(b_var), &t); if (!res) { return FAILURE; } @@ -734,7 +734,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ convert_to_string(b_var); - if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || + if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { ibase_blob ib_blob = { NULL, BLOB_INPUT }; @@ -762,7 +762,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ if (Z_TYPE_P(b_var) != IS_ARRAY) { convert_to_string(b_var); - if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || + if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { _php_ibase_module_error("Parameter %d: invalid array ID" TSRMLS_CC,i+1); @@ -799,7 +799,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ /* we end up here if none of the switch cases handled the field */ convert_to_string(b_var); var->sqldata = Z_STRVAL_P(b_var); - var->sqllen = Z_STRLEN_P(b_var); + var->sqllen = Z_STRSIZE_P(b_var); var->sqltype = SQL_TEXT; } /* for */ return rv; @@ -1022,7 +1022,7 @@ static int _php_ibase_exec(INTERNAL_FUNCTION_PARAMETERS, ibase_result **ib_resul if (!ib_query->out_sqlda) { /* no result set is being returned */ if (affected_rows) { - RETVAL_LONG(affected_rows); + RETVAL_INT(affected_rows); } else { RETVAL_TRUE; } @@ -1228,7 +1228,7 @@ PHP_FUNCTION(ibase_affected_rows) trans = ib_link->tr_list->trans; } } - RETURN_LONG(trans->affected_rows); + RETURN_INT(trans->affected_rows); } /* }}} */ @@ -1281,7 +1281,7 @@ PHP_FUNCTION(ibase_num_rows) while (result[i] != isc_info_end && i < result_size) { short len = (short)isc_vax_integer(&result[i+1],2); if (result[i] == isc_info_req_select_count) { - RETURN_LONG(isc_vax_integer(&result[i+3],len)); + RETURN_INT(isc_vax_integer(&result[i+3],len)); } i += len+3; } @@ -1354,7 +1354,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{ n = *(ISC_LONG *) data; _sql_long: if (scale == 0) { - ZVAL_LONG(val,n); + ZVAL_INT(val,n); } else { long f = (long) scales[-scale]; @@ -1396,7 +1396,7 @@ format_date_time: t.tm_zone = tzname[0]; #endif if (flag & PHP_IBASE_UNIXTIME) { - ZVAL_LONG(val, mktime(&t)); + ZVAL_INT(val, mktime(&t)); } else { #if HAVE_STRFTIME l = strftime(string_data, sizeof(string_data), format, &t); @@ -1463,7 +1463,7 @@ static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_siz if (ib_array->ar_desc.array_desc_dtype == blr_varying || ib_array->ar_desc.array_desc_dtype == blr_varying2) { - Z_STRLEN_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); + Z_STRSIZE_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); } } return SUCCESS; @@ -1904,9 +1904,9 @@ PHP_FUNCTION(ibase_num_fields) } if (sqlda == NULL) { - RETURN_LONG(0); + RETURN_INT(0); } else { - RETURN_LONG(sqlda->sqld); + RETURN_INT(sqlda->sqld); } } /* }}} */ @@ -2055,9 +2055,9 @@ PHP_FUNCTION(ibase_num_params) ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query); if (ib_query->in_sqlda == NULL) { - RETURN_LONG(0); + RETURN_INT(0); } else { - RETURN_LONG(ib_query->in_sqlda->sqld); + RETURN_INT(ib_query->in_sqlda->sqld); } } /* }}} */ diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c index 95f068e7ff..a38ebcdf73 100644 --- a/ext/interbase/ibase_service.c +++ b/ext/interbase/ibase_service.c @@ -67,67 +67,67 @@ void php_ibase_service_minit(INIT_FUNC_ARGS) /* {{{ */ "interbase service manager handle", module_number); /* backup options */ - REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); /* restore options */ - REGISTER_LONG_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); /* manage options */ - REGISTER_LONG_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); /* repair options */ - REGISTER_LONG_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); /* db info arguments */ - REGISTER_LONG_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); /* server info arguments */ - REGISTER_LONG_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); } /* }}} */ @@ -343,12 +343,12 @@ query_loop: int len; case isc_spb_num_att: - add_assoc_long(return_value, "attachments", isc_vax_integer(result,4)); + add_assoc_int(return_value, "attachments", isc_vax_integer(result,4)); result += 4; break; case isc_spb_num_db: - add_assoc_long(return_value, "databases", isc_vax_integer(result,4)); + add_assoc_int(return_value, "databases", isc_vax_integer(result,4)); result += 4; break; @@ -398,12 +398,12 @@ query_loop: break; case isc_spb_sec_userid: - add_assoc_long(&user, "user_id", isc_vax_integer(result, 4)); + add_assoc_int(&user, "user_id", isc_vax_integer(result, 4)); result += 4; break; case isc_spb_sec_groupid: - add_assoc_long(&user, "group_id", isc_vax_integer(result, 4)); + add_assoc_int(&user, "group_id", isc_vax_integer(result, 4)); result += 4; break; } diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index c6c108f377..13513cefc6 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -495,7 +495,7 @@ PHP_FUNCTION(ibase_errcode) } if (IBG(sql_code) != 0) { - RETURN_LONG(IBG(sql_code)); + RETURN_INT(IBG(sql_code)); } RETURN_FALSE; } @@ -735,23 +735,23 @@ PHP_MINIT_FUNCTION(ibase) le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, LE_PLINK, module_number); le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, LE_TRANS, module_number); - REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ - REGISTER_LONG_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ + REGISTER_INT_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); /* transactions */ - REGISTER_LONG_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); php_ibase_query_minit(INIT_FUNC_ARGS_PASSTHRU); php_ibase_blobs_minit(INIT_FUNC_ARGS_PASSTHRU); @@ -1194,8 +1194,8 @@ PHP_FUNCTION(ibase_trans) tpb_len = 0; - convert_to_long_ex(&args[i]); - trans_argl = Z_LVAL(args[i]); + convert_to_int_ex(&args[i]); + trans_argl = Z_IVAL(args[i]); if (trans_argl != PHP_IBASE_DEFAULT) { last_tpb[tpb_len++] = isc_tpb_version3; @@ -1475,7 +1475,7 @@ PHP_FUNCTION(ibase_gen_id) RETURN_STRINGL(res, l, 0); } #endif - RETURN_LONG((long)result); + RETURN_INT((long)result); } /* }}} */ diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c index 5a53df8b6b..d37e077240 100644 --- a/ext/interbase/php_ibase_udf.c +++ b/ext/interbase/php_ibase_udf.c @@ -231,7 +231,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_short: if (argv[i]->dsc_scale == 0) { - ZVAL_LONG(&args[i], *(short*)argv[i]->dsc_address); + ZVAL_INT(&args[i], *(short*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(short*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -240,7 +240,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_long: if (argv[i]->dsc_scale == 0) { - ZVAL_LONG(&args[i], *(ISC_LONG*)argv[i]->dsc_address); + ZVAL_INT(&args[i], *(ISC_LONG*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(ISC_LONG*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -251,7 +251,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) l = *(ISC_INT64*)argv[i]->dsc_address; if (argv[i]->dsc_scale == 0 && l <= LONG_MAX && l >= LONG_MIN) { - ZVAL_LONG(&args[i], (long)l); + ZVAL_INT(&args[i], (long)l); } else { ZVAL_DOUBLE(&args[i], ((double)l)/scales[-argv[i]->dsc_scale]); } @@ -307,9 +307,9 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) /* return whatever type we got back from the callback: let DB handle conversion */ switch (Z_TYPE(return_value)) { - case IS_LONG: + case IS_INT: r->dsc_dtype = dtype_long; - *(long*)r->dsc_address = Z_LVAL(return_value); + *(long*)r->dsc_address = Z_IVAL(return_value); r->dsc_length = sizeof(long); break; @@ -329,7 +329,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case IS_STRING: r->dsc_dtype = dtype_varying; memcpy(res->vary_string, Z_STRVAL(return_value), - (res->vary_length = min(r->dsc_length-2,Z_STRLEN(return_value)))); + (res->vary_length = min(r->dsc_length-2,Z_STRSIZE(return_value)))); r->dsc_length = res->vary_length+2; break; } diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 7aa1eae0bc..7c06af792c 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -338,36 +338,36 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); - zend_declare_class_constant_long(BreakIterator_ce_ptr, + zend_declare_class_constant_int(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); /* Declare constants that are defined in the C header */ -#define BREAKITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ +#define BREAKITER_DECL_INT_CONST(name) \ + zend_declare_class_constant_int(BreakIterator_ce_ptr, #name, \ sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) - BREAKITER_DECL_LONG_CONST(WORD_NONE); - BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_NUMBER); - BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_LETTER); - BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_KANA); - BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_IDEO); - BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); - - BREAKITER_DECL_LONG_CONST(LINE_SOFT); - BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); - BREAKITER_DECL_LONG_CONST(LINE_HARD); - BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); - - BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); - BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); - BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); - BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); - -#undef BREAKITER_DECL_LONG_CONST + BREAKITER_DECL_INT_CONST(WORD_NONE); + BREAKITER_DECL_INT_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_NUMBER); + BREAKITER_DECL_INT_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_LETTER); + BREAKITER_DECL_INT_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_KANA); + BREAKITER_DECL_INT_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_IDEO); + BREAKITER_DECL_INT_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_INT_CONST(LINE_SOFT); + BREAKITER_DECL_INT_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_INT_CONST(LINE_HARD); + BREAKITER_DECL_INT_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_INT_CONST(SENTENCE_TERM); + BREAKITER_DECL_INT_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_INT_CONST(SENTENCE_SEP); + BREAKITER_DECL_INT_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_INT_CONST /* Create and register 'RuleBasedBreakIterator' class. */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 7783235d8d..efd5c27811 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -67,7 +67,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) int32_t pos = biter->next(); if (pos != BreakIterator::DONE) { - ZVAL_LONG(&zoi_iter->current, (long)pos); + ZVAL_INT(&zoi_iter->current, (long)pos); } //else we've reached the end of the enum, nothing more is required } @@ -77,7 +77,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) zoi_with_current *zoi_iter = (zoi_with_current*)iter; int32_t pos = biter->first(); - ZVAL_LONG(&zoi_iter->current, (long)pos); + ZVAL_INT(&zoi_iter->current, (long)pos); } static zend_object_iterator_funcs breakiterator_iterator_funcs = { @@ -137,7 +137,7 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { /* the actual work is done in move_forward and rewind */ - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) @@ -168,7 +168,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(bio->text); - int32_t slen = Z_STRLEN(bio->text); + int32_t slen = Z_STRSIZE(bio->text); zend_string *res; if (next == BreakIterator::DONE) { @@ -315,7 +315,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; #define PARTSITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ + zend_declare_class_constant_int(IntlPartsIterator_ce_ptr, #name, \ sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index ed5944a3da..99ededb25c 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32( int32_t res = (bio->biter->*func)(); - RETURN_LONG((long)res); + RETURN_INT((long)res); } static void _breakiter_int32_ret_int32( @@ -240,7 +240,7 @@ static void _breakiter_int32_ret_int32( int32_t res = (bio->biter->*func)((int32_t)arg); - RETURN_LONG((long)res); + RETURN_INT((long)res); } U_CFUNC PHP_FUNCTION(breakiter_first) @@ -308,7 +308,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current) int32_t res = bio->biter->current(); - RETURN_LONG((long)res); + RETURN_INT((long)res); } U_CFUNC PHP_FUNCTION(breakiter_following) @@ -422,7 +422,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code) if (bio == NULL) RETURN_FALSE; - RETURN_LONG((long)BREAKITER_ERROR_CODE(bio)); + RETURN_INT((long)BREAKITER_ERROR_CODE(bio)); } U_CFUNC PHP_FUNCTION(breakiter_get_error_message) diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp index a833cf1853..a12924afef 100644 --- a/ext/intl/breakiterator/codepointiterator_methods.cpp +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -40,5 +40,5 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); + RETURN_INT(fetch_cpbi(bio)->getLastCodePoint()); } diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 50df1a61ab..5755b0adb8 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -151,7 +151,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); + RETURN_INT(fetch_rbbi(bio)->getRuleStatus()); } U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) @@ -189,7 +189,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) array_init_size(return_value, num_rules); for (int32_t i = 0; i < num_rules; i++) { - add_next_index_long(return_value, rules[i]); + add_next_index_int(return_value, rules[i]); } delete[] rules; } diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index a62ad7b9d9..325ebc5368 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) const char *name = debug_info_fields[i].name; int32_t res = cal->get(debug_info_fields[i].field, uec); if (U_SUCCESS(uec)) { - add_assoc_long(&zfields, name, (long)res); + add_assoc_int(&zfields, name, (long)res); } else { add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec))); } @@ -489,57 +489,57 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) } /* Declare 'IntlCalendar' class constants */ -#define CALENDAR_DECL_LONG_CONST(name, val) \ - zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \ +#define CALENDAR_DECL_INT_CONST(name, val) \ + zend_declare_class_constant_int(Calendar_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - CALENDAR_DECL_LONG_CONST("FIELD_ERA", UCAL_ERA); - CALENDAR_DECL_LONG_CONST("FIELD_YEAR", UCAL_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_MONTH", UCAL_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_DATE", UCAL_DATE); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_AM_PM", UCAL_AM_PM); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_MINUTE", UCAL_MINUTE); - CALENDAR_DECL_LONG_CONST("FIELD_SECOND", UCAL_SECOND); - CALENDAR_DECL_LONG_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); - CALENDAR_DECL_LONG_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); - CALENDAR_DECL_LONG_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); - CALENDAR_DECL_LONG_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); - CALENDAR_DECL_LONG_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); - CALENDAR_DECL_LONG_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); - - CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); - CALENDAR_DECL_LONG_CONST("DOW_MONDAY", UCAL_MONDAY); - CALENDAR_DECL_LONG_CONST("DOW_TUESDAY", UCAL_TUESDAY); - CALENDAR_DECL_LONG_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); - CALENDAR_DECL_LONG_CONST("DOW_THURSDAY", UCAL_THURSDAY); - CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY); - CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY); + CALENDAR_DECL_INT_CONST("FIELD_ERA", UCAL_ERA); + CALENDAR_DECL_INT_CONST("FIELD_YEAR", UCAL_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_MONTH", UCAL_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_DATE", UCAL_DATE); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_AM_PM", UCAL_AM_PM); + CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_INT_CONST("FIELD_MINUTE", UCAL_MINUTE); + CALENDAR_DECL_INT_CONST("FIELD_SECOND", UCAL_SECOND); + CALENDAR_DECL_INT_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); + CALENDAR_DECL_INT_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); + CALENDAR_DECL_INT_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); + CALENDAR_DECL_INT_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); + CALENDAR_DECL_INT_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); + CALENDAR_DECL_INT_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); + CALENDAR_DECL_INT_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); + CALENDAR_DECL_INT_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); + + CALENDAR_DECL_INT_CONST("DOW_SUNDAY", UCAL_SUNDAY); + CALENDAR_DECL_INT_CONST("DOW_MONDAY", UCAL_MONDAY); + CALENDAR_DECL_INT_CONST("DOW_TUESDAY", UCAL_TUESDAY); + CALENDAR_DECL_INT_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); + CALENDAR_DECL_INT_CONST("DOW_THURSDAY", UCAL_THURSDAY); + CALENDAR_DECL_INT_CONST("DOW_FRIDAY", UCAL_FRIDAY); + CALENDAR_DECL_INT_CONST("DOW_SATURDAY", UCAL_SATURDAY); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); #endif #if U_ICU_VERSION_MAJOR_NUM >= 49 - CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); - CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); - CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); + CALENDAR_DECL_INT_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); + CALENDAR_DECL_INT_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); + CALENDAR_DECL_INT_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); #endif } /* }}} */ diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 3684c229a1..29a131533d 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -244,7 +244,7 @@ static void _php_intlcal_field_uec_ret_in32t_method( (UCalendarDateFields)field, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } U_CFUNC PHP_FUNCTION(intlcal_get) @@ -431,7 +431,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) } for (i = 0; i < variant; i++) { - if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) { + if (Z_IVAL(args[i]) < INT32_MIN || Z_IVAL(args[i]) > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: at least one of the arguments has an absolute " "value that is too large", 0 TSRMLS_CC); @@ -596,7 +596,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference) INTL_METHOD_CHECK_STATUS(co, "intlcal_field_difference: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_actual_maximum) @@ -637,7 +637,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_day_of_week_type: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } #endif @@ -658,7 +658,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } static void _php_intlcal_field_ret_in32t_method( @@ -690,7 +690,7 @@ static void _php_intlcal_field_ret_in32t_method( int32_t result = (co->ucal->*func)((UCalendarDateFields)field); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_greatest_minimum) @@ -756,7 +756,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((long)result); } U_CFUNC PHP_FUNCTION(intlcal_get_minimum) @@ -830,7 +830,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_weekend_transition: " "Error calling ICU method"); - RETURN_LONG((long)res); + RETURN_INT((long)res); } #endif @@ -1064,7 +1064,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_LONG(co->ucal->getRepeatedWallTimeOption()); + RETURN_INT(co->ucal->getRepeatedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) @@ -1080,7 +1080,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_LONG(co->ucal->getSkippedWallTimeOption()); + RETURN_INT(co->ucal->getSkippedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) @@ -1179,7 +1179,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); - if (Z_TYPE(zv_timestamp) != IS_LONG) { + if (Z_TYPE(zv_timestamp) != IS_INT) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: bad DateTime; call to " "DateTime::getTimestamp() failed", 0 TSRMLS_CC); @@ -1209,7 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) "error creating ICU Calendar object", 0 TSRMLS_CC); goto error; } - cal->setTime(((UDate)Z_LVAL(zv_timestamp)) * 1000., status); + cal->setTime(((UDate)Z_IVAL(zv_timestamp)) * 1000., status); if (U_FAILURE(status)) { /* time zone was adopted by cal; should not be deleted here */ delete cal; @@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (co == NULL) RETURN_FALSE; - RETURN_LONG((long)CALENDAR_ERROR_CODE(co)); + RETURN_INT((long)CALENDAR_ERROR_CODE(co)); } U_CFUNC PHP_FUNCTION(intlcal_get_error_message) diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c index eff9568de1..08da6d3831 100644 --- a/ext/intl/collator/collator.c +++ b/ext/intl/collator/collator.c @@ -38,9 +38,9 @@ void collator_register_constants( INIT_FUNC_ARGS ) return; } - #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); - #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define COLLATOR_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); + #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UColAttributeValue constants */ COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT ); diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c index 684e72cc58..061e4c0146 100644 --- a/ext/intl/collator/collator_attr.c +++ b/ext/intl/collator/collator_attr.c @@ -53,7 +53,7 @@ PHP_FUNCTION( collator_get_attribute ) value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) ); COLLATOR_CHECK_STATUS( co, "Error getting attribute value" ); - RETURN_LONG( value ); + RETURN_INT( value ); } /* }}} */ @@ -112,7 +112,7 @@ PHP_FUNCTION( collator_get_strength ) COLLATOR_METHOD_FETCH_OBJECT; /* Get current strength and return it. */ - RETURN_LONG( ucol_getStrength( co->ucoll ) ); + RETURN_INT( ucol_getStrength( co->ucoll ) ); } /* }}} */ diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index 4384558ac6..497061e157 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -119,7 +119,7 @@ PHP_FUNCTION( collator_compare ) efree( ustr2 ); /* Return result of the comparison. */ - RETURN_LONG( result ); + RETURN_INT( result ); } /* }}} */ diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 7d8bf0bbc8..edf02f83ce 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -55,7 +55,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRLEN_P( hashData ); + old_val_len = Z_STRSIZE_P( hashData ); /* Convert it from UTF-8 to UTF-16LE and save the result to new_val[_len]. */ intl_convert_utf8_to_utf16( &new_val, &new_val_len, old_val, old_val_len, status ); @@ -67,13 +67,13 @@ static void collator_convert_hash_item_from_utf8_to_utf16( //??? efree(new_val); /* hack to fix use of initialized value */ - Z_STRLEN(znew_val) = Z_STRLEN(znew_val) - UBYTES(1); + Z_STRSIZE(znew_val) = Z_STRSIZE(znew_val) - UBYTES(1); if( hashKey) { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_LONG */ + else /* hashKeyType == HASH_KEY_IS_INT */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -96,7 +96,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRLEN_P( hashData ); + old_val_len = Z_STRSIZE_P( hashData ); /* Convert it from UTF-16LE to UTF-8 and save the result to new_val[_len]. */ intl_convert_utf16_to_utf8( &new_val, &new_val_len, @@ -113,7 +113,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_LONG */ + else /* hashKeyType == HASH_KEY_IS_INT */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -176,7 +176,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv ) /* Convert to utf8 then. */ intl_convert_utf16_to_utf8( &str, &str_len, - (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRLEN_P(utf16_zval) ), &status ); + (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRSIZE_P(utf16_zval) ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error converting utf16 to utf8 in collator_convert_zval_utf16_to_utf8()" ); @@ -207,7 +207,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( utf8_zval ), Z_STRLEN_P( utf8_zval ), + Z_STRVAL_P( utf8_zval ), Z_STRSIZE_P( utf8_zval ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_zstr_utf8_to_utf16()" ); @@ -282,7 +282,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv TSRMLS_DC ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( zstr ), Z_STRLEN_P( zstr ), + Z_STRVAL_P( zstr ), Z_STRSIZE_P( zstr ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" ); @@ -320,7 +320,7 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval_ptr_dtor( num ); num = rv; - ZVAL_LONG( num, 0 ); + ZVAL_INT( num, 0 ); } return num; @@ -338,9 +338,9 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval* collator_convert_string_to_double( zval* str, zval *rv ) { zval* num = collator_convert_string_to_number( str, rv ); - if( Z_TYPE_P(num) == IS_LONG ) + if( Z_TYPE_P(num) == IS_INT ) { - ZVAL_DOUBLE( num, Z_LVAL_P( num ) ); + ZVAL_DOUBLE( num, Z_IVAL_P( num ) ); } return num; @@ -367,10 +367,10 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) COLLATOR_CONVERT_RETURN_FAILED( str ); } - if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) ) + if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRSIZE_P(str) ), &lval, &dval, 1 ) ) ) { - if( is_numeric == IS_LONG ) { - ZVAL_LONG(rv, lval); + if( is_numeric == IS_INT ) { + ZVAL_INT(rv, lval); } if( is_numeric == IS_DOUBLE ) ZVAL_DOUBLE(rv, dval); diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c index 91bc25d077..acfa43c498 100644 --- a/ext/intl/collator/collator_error.c +++ b/ext/intl/collator/collator_error.c @@ -48,7 +48,7 @@ PHP_FUNCTION( collator_get_error_code ) RETURN_FALSE; /* Return collator's last error code. */ - RETURN_LONG( COLLATOR_ERROR_CODE( co ) ); + RETURN_INT( COLLATOR_ERROR_CODE( co ) ); } /* }}} */ diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index a8abfac12b..cf24efe133 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -245,7 +245,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval if (lval) { *lval = local_lval; } - return IS_LONG; + return IS_INT; } else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.' && *str != '-') { /* ignore partial string matches */ return 0; } @@ -288,7 +288,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval return IS_DOUBLE; } else if (end_ptr_long && lval) { *lval = local_lval; - return IS_LONG; + return IS_INT; } } return 0; diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 43140b2f41..c109fa7cb6 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -80,10 +80,10 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2 } /* Compare the strings using ICU. */ - ZVAL_LONG(result, ucol_strcoll( + ZVAL_INT(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); } else { @@ -190,10 +190,10 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM co = Z_INTL_COLLATOR_P(&INTL_G(current_collator)); /* Compare the strings using ICU. */ - ZVAL_LONG(result, ucol_strcoll( + ZVAL_INT(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); zval_ptr_dtor( str1_p ); zval_ptr_dtor( str2_p ); @@ -232,11 +232,11 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC ) return 0; } - convert_to_long(&result); + convert_to_int(&result); - if( Z_LVAL(result) < 0 ) + if( Z_IVAL(result) < 0 ) return -1; - else if( Z_LVAL(result) > 0 ) + else if( Z_IVAL(result) > 0 ) return 1; return 0; @@ -424,7 +424,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) /* Process string values only. */ if( Z_TYPE_P( hashData ) == IS_STRING ) { - intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRLEN_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); + intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRSIZE_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) { diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 7c7510d554..885d08cd2c 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -127,7 +127,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, if (millis) { ZVAL_STRING(&zfuncname, "getTimestamp"); if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_LONG) { + != SUCCESS || Z_TYPE(retval) != IS_INT) { spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, @@ -137,7 +137,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, return FAILURE; } - *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval); zval_ptr_dtor(&zfuncname); } @@ -174,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) { double rv = NAN; - long lv; + php_int_t lv; int type; char *message; @@ -184,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS switch (Z_TYPE_P(z)) { case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); + type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0); if (type == IS_DOUBLE) { rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_LONG) { + } else if (type == IS_INT) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { spprintf(&message, 0, "%s: string '%s' is not numeric, " @@ -198,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS efree(message); } break; - case IS_LONG: - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); + case IS_INT: + rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z); break; case IS_DOUBLE: rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index ff28bdb456..cfe46ce75a 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -238,7 +238,7 @@ static PHP_METHOD(IntlIterator, key) if (ii->iterator->funcs->get_current_key) { ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC); } else { - RETURN_LONG(ii->iterator->index); + RETURN_INT(ii->iterator->index); } } diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index 2db688ac71..fbdf82ed9c 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -28,7 +28,7 @@ */ PHP_FUNCTION( intl_get_error_code ) { - RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) ); + RETURN_INT( intl_error_get_code( NULL TSRMLS_CC ) ); } /* }}} */ @@ -91,7 +91,7 @@ PHP_FUNCTION( intl_error_name ) */ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) { - #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define INTL_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) /* Warnings */ INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING ); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 0064497b41..4bdbf3408c 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -65,7 +65,7 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr static void php_converter_default_callback(zval *return_value, zval *zobj, long reason, zval *error TSRMLS_DC) { ZVAL_DEREF(error); zval_dtor(error); - ZVAL_LONG(error, U_ZERO_ERROR); + ZVAL_INT(error, U_ZERO_ERROR); /* Basic functionality so children can call parent::toUCallback() */ switch (reason) { case UCNV_UNASSIGNED: @@ -81,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_LONG(error, U_INVALID_STATE_ERROR); + ZVAL_INT(error, U_INVALID_STATE_ERROR); RETVAL_STRINGL(chars, chars_len); return; } @@ -99,7 +99,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_LONG(error, uerror); + ZVAL_INT(error, uerror); } RETVAL_STRINGL(chars, chars_len); } @@ -169,9 +169,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_NULL: /* Code unit is being skipped */ return; - case IS_LONG: + case IS_INT: { - long lval = Z_LVAL_P(val); + long lval = Z_IVAL_P(val); if ((lval < 0) || (lval > 0x10FFFF)) { php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval); return; @@ -194,7 +194,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_STRING: { const char *strval = Z_STRVAL_P(val); - int i = 0, strlen = Z_STRLEN_P(val); + int i = 0, strlen = Z_STRSIZE_P(val); while((i != strlen) && TARGET_CHECK(args, 1)) { UChar c; @@ -233,10 +233,10 @@ static void php_converter_to_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_LONG(&zargs[0], reason); + ZVAL_INT(&zargs[0], reason); ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source); ZVAL_STRINGL(&zargs[2], codeUnits, length); - ZVAL_LONG(&zargs[3], *pErrorCode); + ZVAL_INT(&zargs[3], *pErrorCode); objval->to_cb.param_count = 4; objval->to_cb.params = zargs; @@ -250,10 +250,10 @@ static void php_converter_to_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_LONG) { - *pErrorCode = Z_LVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { - *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_INT) { + *pErrorCode = Z_IVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { + *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -269,14 +269,14 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni case IS_NULL: /* Ignore */ return; - case IS_LONG: + case IS_INT: if (TARGET_CHECK(args, 1)) { - *(args->target++) = Z_LVAL_P(val); + *(args->target++) = Z_IVAL_P(val); } return; case IS_STRING: { - int vallen = Z_STRLEN_P(val); + int vallen = Z_STRSIZE_P(val); if (TARGET_CHECK(args, vallen)) { memcpy(args->target, Z_STRVAL_P(val), vallen); args->target += vallen; @@ -312,16 +312,16 @@ static void php_converter_from_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_LONG(&zargs[0], reason); + ZVAL_INT(&zargs[0], reason); array_init(&zargs[1]); i = 0; while (i < length) { UChar32 c; U16_NEXT(codeUnits, i, length, c); - add_next_index_long(&zargs[1], c); + add_next_index_int(&zargs[1], c); } - ZVAL_LONG(&zargs[2], codePoint); - ZVAL_LONG(&zargs[3], *pErrorCode); + ZVAL_INT(&zargs[2], codePoint); + ZVAL_INT(&zargs[3], *pErrorCode); objval->from_cb.param_count = 4; objval->from_cb.params = zargs; @@ -335,10 +335,10 @@ static void php_converter_from_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_LONG) { - *pErrorCode = Z_LVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { - *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_INT) { + *pErrorCode = Z_IVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { + *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -512,7 +512,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter * RETURN_FALSE; } - RETURN_LONG(t); + RETURN_INT(t); } /* }}} */ @@ -824,13 +824,13 @@ static PHP_METHOD(UConverter, transcode) { (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); } if (U_SUCCESS(error) && (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); } } @@ -871,7 +871,7 @@ static PHP_METHOD(UConverter, getErrorCode) { RETURN_FALSE; } - RETURN_LONG(intl_error_get_code(&(objval->error) TSRMLS_CC)); + RETURN_INT(intl_error_get_code(&(objval->error) TSRMLS_CC)); } /* }}} */ @@ -1098,8 +1098,8 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { } /* }}} */ -#define CONV_REASON_CONST(v) zend_declare_class_constant_long(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) -#define CONV_TYPE_CONST(v) zend_declare_class_constant_long(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_REASON_CONST(v) zend_declare_class_constant_int(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_TYPE_CONST(v) zend_declare_class_constant_int(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) /* {{{ php_converter_minit */ int php_converter_minit(INIT_FUNC_ARGS) { diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index eedc60040e..c51b33144b 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -34,11 +34,11 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) return; } - #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); /* UDateFormatStyle constants */ DATEFORMATTER_EXPOSE_CLASS_CONST( FULL ); @@ -85,7 +85,7 @@ PHP_FUNCTION( datefmt_get_error_code ) dfo = Z_INTL_DATEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(dfo) ); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index e13b0f4cd2..a451054554 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -48,7 +48,7 @@ PHP_FUNCTION( datefmt_get_datetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." ); - RETURN_LONG(dfo->date_type ); + RETURN_INT(dfo->date_type ); } /* }}} */ @@ -74,7 +74,7 @@ PHP_FUNCTION( datefmt_get_timetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." ); - RETURN_LONG(dfo->time_type ); + RETURN_INT(dfo->time_type ); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index 8ca880d956..269b1cdce2 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -160,7 +160,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) RETURN_FALSE; } - RETURN_LONG(dfo->calendar); + RETURN_INT(dfo->calendar); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 467053ef84..9ec012c570 100644 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -71,21 +71,21 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, } if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) { - if(Z_TYPE_P(ele_value) != IS_LONG) { + if(Z_TYPE_P(ele_value) != IS_INT) { spprintf(&message, 0, "datefmt_format: parameter array contains " "a non-integer element for key '%s'", key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - if (Z_LVAL_P(ele_value) > INT32_MAX || - Z_LVAL_P(ele_value) < INT32_MIN) { + if (Z_IVAL_P(ele_value) > INT32_MAX || + Z_IVAL_P(ele_value) < INT32_MIN) { spprintf(&message, 0, "datefmt_format: value %ld is out of " "bounds for a 32-bit integer in key '%s'", - Z_LVAL_P(ele_value), key_name); + Z_IVAL_P(ele_value), key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - result = Z_LVAL_P(ele_value); + result = Z_IVAL_P(ele_value); } } } diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index ac8aa2fe4c..b0c8cc1653 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -46,8 +46,8 @@ static const DateFormat::EStyle valid_styles[] = { }; static bool valid_format(zval *z) { - if (Z_TYPE_P(z) == IS_LONG) { - long lval = Z_LVAL_P(z); + if (Z_TYPE_P(z) == IS_INT) { + long lval = Z_IVAL_P(z); for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { if ((long)valid_styles[i] == lval) { return true; @@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = (DateFormat::EStyle)Z_LVAL_P(z); + dateStyle = (DateFormat::EStyle)Z_IVAL_P(z); zend_hash_move_forward_ex(ht, &pos); z = zend_hash_get_current_data_ex(ht, &pos); @@ -113,18 +113,18 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "second element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - timeStyle = (DateFormat::EStyle)Z_LVAL_P(z); - } else if (Z_TYPE_P(format) == IS_LONG) { + timeStyle = (DateFormat::EStyle)Z_IVAL_P(z); + } else if (Z_TYPE_P(format) == IS_INT) { if (!valid_format(format)) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the date/time format type is invalid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format); + dateStyle = timeStyle = (DateFormat::EStyle)Z_IVAL_P(format); } else { convert_to_string_ex(format); - if (Z_STRLEN_P(format) == 0) { + if (Z_STRSIZE_P(format) == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the format is empty", 0 TSRMLS_CC); RETURN_FALSE; @@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) if (pattern) { df = new SimpleDateFormat( - UnicodeString(Z_STRVAL_P(format), Z_STRLEN_P(format), + UnicodeString(Z_STRVAL_P(format), Z_STRSIZE_P(format), UnicodeString::kInvariant), Locale::createFromName(locale_str), status); diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp index 74758bbec9..f3c184e168 100644 --- a/ext/intl/dateformat/dateformat_helpers.cpp +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -47,9 +47,9 @@ int datefmt_process_calendar_arg(zval* calendar_zv, cal_int_type = UCAL_GREGORIAN; - } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { + } else if (Z_TYPE_P(calendar_zv) == IS_INT) { - long v = Z_LVAL_P(calendar_zv); + long v = Z_IVAL_P(calendar_zv); if (v != (long)UCAL_TRADITIONAL && v != (long)UCAL_GREGORIAN) { spprintf(&msg, 0, "%s: invalid value for calendar type; it must be " "one of IntlDateFormatter::TRADITIONAL (locale's default " @@ -66,7 +66,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, } calendar_owned = true; - cal_int_type = Z_LVAL_P(calendar_zv); + cal_int_type = Z_IVAL_P(calendar_zv); } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && instanceof_function_ex(Z_OBJCE_P(calendar_zv), diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index fb3da3e053..70d640ac2e 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -57,7 +57,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex if(result > LONG_MAX || result < -LONG_MAX) { ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result)); } else { - ZVAL_LONG(return_value, (long)result); + ZVAL_INT(return_value, (long)result); } } /* }}} */ @@ -69,12 +69,12 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va if( strcmp(key_name, CALENDAR_YEAR )==0 ){ /* since tm_year is years from 1900 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1900) ); + add_assoc_int( return_value, key_name,( calendar_field_val-1900) ); }else if( strcmp(key_name, CALENDAR_WDAY )==0 ){ /* since tm_wday starts from 0 whereas ICU WDAY start from 1 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1) ); + add_assoc_int( return_value, key_name,( calendar_field_val-1) ); }else{ - add_assoc_long( return_value, key_name, calendar_field_val ); + add_assoc_int( return_value, key_name, calendar_field_val ); } } @@ -116,7 +116,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex /* Is in DST? */ isInDST = ucal_inDaylightTime(parsed_calendar , &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." ); - add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); + add_assoc_int( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); } /* }}} */ @@ -146,8 +146,8 @@ PHP_FUNCTION(datefmt_parse) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); - convert_to_long(z_parse_pos); - parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); + convert_to_int(z_parse_pos); + parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -155,7 +155,7 @@ PHP_FUNCTION(datefmt_parse) internal_parse_to_timestamp( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if(z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_LONG(z_parse_pos, parse_pos); + ZVAL_INT(z_parse_pos, parse_pos); } } /* }}} */ @@ -185,8 +185,8 @@ PHP_FUNCTION(datefmt_localtime) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); - convert_to_long(z_parse_pos); - parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); + convert_to_int(z_parse_pos); + parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -194,7 +194,7 @@ PHP_FUNCTION(datefmt_localtime) internal_parse_to_localtime( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if (z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_LONG(z_parse_pos, parse_pos); + ZVAL_INT(z_parse_pos, parse_pos); } } /* }}} */ diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c index 12cbb6c75b..2c3ffaa569 100644 --- a/ext/intl/formatter/formatter.c +++ b/ext/intl/formatter/formatter.c @@ -40,9 +40,9 @@ void formatter_register_constants( INIT_FUNC_ARGS ) zend_error(E_ERROR, "NumberFormatter class not defined"); } - #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); - #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define FORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); + #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UNumberFormatStyle constants */ FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL ); diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index af58cfe37f..d58d331ffd 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -72,7 +72,7 @@ PHP_FUNCTION( numfmt_get_attribute ) if(value == -1) { INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR; } else { - RETVAL_LONG(value); + RETVAL_INT(value); } break; case UNUM_ROUNDING_INCREMENT: @@ -182,8 +182,8 @@ PHP_FUNCTION( numfmt_set_attribute ) case UNUM_MIN_SIGNIFICANT_DIGITS: case UNUM_MAX_SIGNIFICANT_DIGITS: case UNUM_LENIENT_PARSE: - convert_to_long_ex(value); - unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value)); + convert_to_int_ex(value); + unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_IVAL_P(value)); break; case UNUM_ROUNDING_INCREMENT: convert_to_double_ex(value); diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index 4b98f4fb17..a51c9876b7 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -57,7 +57,7 @@ PHP_FUNCTION( numfmt_format ) convert_scalar_to_number_ex(number); } - if(Z_TYPE_P(number) == IS_LONG) { + if(Z_TYPE_P(number) == IS_INT) { /* take INT32 on 32-bit, int64 on 64-bit */ type = (sizeof(long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; } else if(Z_TYPE_P(number) == IS_DOUBLE) { @@ -67,20 +67,20 @@ PHP_FUNCTION( numfmt_format ) } } - if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) { + if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_INT) { SEPARATE_ZVAL_IF_NOT_REF(number); convert_scalar_to_number(number TSRMLS_CC ); } switch(type) { case FORMAT_TYPE_INT32: - convert_to_long_ex(number); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + convert_to_int_ex(number); + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); formatted = eumalloc(formatted_len); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { efree(formatted); @@ -91,7 +91,7 @@ PHP_FUNCTION( numfmt_format ) case FORMAT_TYPE_INT64: { - int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_LVAL_P(number); + int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_IVAL_P(number); formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 26473ebe78..3bb46c3204 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -125,7 +125,7 @@ PHP_FUNCTION( numfmt_get_error_code ) nfo = Z_INTL_NUMBERFORMATTER_P(object); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(nfo) ); } /* }}} */ diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index 73b331302b..57ab4e28d8 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -68,8 +68,8 @@ PHP_FUNCTION( numfmt_parse ) if(zposition) { ZVAL_DEREF(zposition); - convert_to_long(zposition); - position = (int32_t)Z_LVAL_P( zposition ); + convert_to_int(zposition); + position = (int32_t)Z_IVAL_P( zposition ); position_p = &position; } @@ -82,14 +82,14 @@ PHP_FUNCTION( numfmt_parse ) switch(type) { case FORMAT_TYPE_INT32: val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - RETVAL_LONG(val32); + RETVAL_INT(val32); break; case FORMAT_TYPE_INT64: val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); if(val64 > LONG_MAX || val64 < LONG_MIN) { RETVAL_DOUBLE(val64); } else { - RETVAL_LONG((long)val64); + RETVAL_INT((long)val64); } break; case FORMAT_TYPE_DOUBLE: @@ -107,7 +107,7 @@ PHP_FUNCTION( numfmt_parse ) #endif if(zposition) { zval_dtor(zposition); - ZVAL_LONG(zposition, position); + ZVAL_INT(zposition, position); } if (sstr) { @@ -157,15 +157,15 @@ PHP_FUNCTION( numfmt_parse_currency ) if(zposition) { ZVAL_DEREF(zposition); - convert_to_long(zposition); - position = (int32_t)Z_LVAL_P( zposition ); + convert_to_int(zposition); + position = (int32_t)Z_IVAL_P( zposition ); position_p = &position; } number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo)); if(zposition) { zval_dtor(zposition); - ZVAL_LONG(zposition, position); + ZVAL_INT(zposition, position); } if (sstr) { efree(sstr); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 5caacb4f28..705eb31b9b 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -44,9 +44,9 @@ */ void grapheme_register_constants( INIT_FUNC_ARGS ) { - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen) ret_len = grapheme_ascii_check(string, string_len); if ( ret_len >= 0 ) - RETURN_LONG(ret_len); + RETURN_INT(ret_len); /* convert the string to UTF-16. */ status = U_ZERO_ERROR; @@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen) } if (ret_len >= 0) { - RETVAL_LONG(ret_len); + RETVAL_INT(ret_len); } else { RETVAL_FALSE; } @@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos) /* if it is there, and if the haystack is ascii, we are all done */ if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) { - RETURN_LONG(found - haystack); + RETURN_INT(found - haystack); } /* do utf16 part of the strpos */ ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos) efree(needle_dup); if (found) { - RETURN_LONG(found - haystack_dup); + RETURN_INT(found - haystack_dup); } /* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */ @@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos) if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } /* if the needle was ascii too, we are done */ @@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos) efree(needle_dup); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } /* if the needle was ascii too, we are done */ @@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -846,7 +846,7 @@ PHP_FUNCTION(grapheme_extract) /* initialize next */ SEPARATE_ZVAL(next); zval_dtor(next); - ZVAL_LONG(next, lstart); + ZVAL_INT(next, lstart); } } @@ -900,7 +900,7 @@ PHP_FUNCTION(grapheme_extract) if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) { long nsize = ( size < str_len ? size : str_len ); if ( NULL != next ) { - ZVAL_LONG(next, start+nsize); + ZVAL_INT(next, start+nsize); } RETURN_STRINGL(((char *)pstr), nsize); } @@ -943,7 +943,7 @@ PHP_FUNCTION(grapheme_extract) ubrk_close(bi); if ( NULL != next ) { - ZVAL_LONG(next, start+ret_pos); + ZVAL_INT(next, start+ret_pos); } RETURN_STRINGL(((char *)pstr), ret_pos); diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 6bf187a068..78892025b3 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -51,56 +51,56 @@ void idn_register_constants( INIT_FUNC_ARGS ) /* Option to prohibit processing of unassigned codepoints in the input and do not check if the input conforms to STD-3 ASCII rules. */ - REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); /* Option to allow processing of unassigned codepoints in the input */ - REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); /* Option to check if input conforms to STD-3 ASCII rules */ - REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API /* Option to check for whether the input conforms to the BiDi rules. * Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */ - REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); /* Option to check for whether the input conforms to the CONTEXTJ rules. * Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */ - REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToASCII(). * By default, ToASCII() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToUnicode(). * By default, ToUnicode() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); #endif /* VARIANTS */ - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_46_API /* PINFO ERROR CODES */ - REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); #endif } /* }}} */ @@ -190,7 +190,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, } add_assoc_bool_ex(idna_info, "isTransitionalDifferent", sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent); - add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (long)info.errors); + add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (long)info.errors); } if (!buffer_used) { diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h index 9424571d02..cf83e6d7ee 100644 --- a/ext/intl/intl_common.h +++ b/ext/intl/intl_common.h @@ -39,6 +39,6 @@ #define UCHARS(len) ((len) / sizeof(UChar)) #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str) -#define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) ) +#define INTL_Z_STRSIZE_P(str) UCHARS( Z_STRSIZE_P(str) ) #endif /* INTL_COMMON_H */ diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index e692e5dc0d..d7f215d4e4 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) if( pe->line > 0 ) { smart_str_appends( &ret, "on line " ); - smart_str_append_long( &ret, (long ) pe->line ); + smart_str_append_int( &ret, (long ) pe->line ); any = 1; } if( pe->offset >= 0 ) { @@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) smart_str_appends( &ret, "at " ); smart_str_appends( &ret, "offset " ); - smart_str_append_long( &ret, (long ) pe->offset ); + smart_str_append_int( &ret, (long ) pe->offset ); any = 1; } diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c index 921e6e589f..fa8edddfa3 100644 --- a/ext/intl/locale/locale.c +++ b/ext/intl/locale/locale.c @@ -39,8 +39,8 @@ void locale_register_constants( INIT_FUNC_ARGS ) return; } - #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); + #define LOCALE_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE ); diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 01cbddd062..34e7374969 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -782,7 +782,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_ /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); return SUCCESS; } @@ -822,7 +822,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix( loc_name , key_name); smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); return SUCCESS; } else if(Z_TYPE_P(ele_value) == IS_ARRAY ) { HashTable *arr = HASH_OF(ele_value); @@ -836,7 +836,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data)); + smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRSIZE_P(data)); } ZEND_HASH_FOREACH_END(); return SUCCESS; } else { @@ -869,7 +869,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , cur_key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); } } /* end of for */ } /* end of else */ @@ -1439,7 +1439,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC); LOOKUP_CLEAN_RETURN(NULL); } - cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value)); + cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRSIZE_P(ele_value)); result = strToMatch(Z_STRVAL_P(ele_value), cur_arr[cur_arr_len*2]); if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag", 0 TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index b9f6c7a369..cfe6538f0a 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index ba5a5df001..a23f9e87cb 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -447,7 +447,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, UnicodeString *text = new UnicodeString(); intl_stringFromChar(*text, - Z_STRVAL_P(elem), Z_STRLEN_P(elem), &err.code); + Z_STRVAL_P(elem), Z_STRSIZE_P(elem), &err.code); if (U_FAILURE(err.code)) { char *message; @@ -466,14 +466,14 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, double d; if (Z_TYPE_P(elem) == IS_DOUBLE) { d = Z_DVAL_P(elem); - } else if (Z_TYPE_P(elem) == IS_LONG) { - d = (double)Z_LVAL_P(elem); + } else if (Z_TYPE_P(elem) == IS_INT) { + d = (double)Z_IVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); d = (Z_TYPE_P(elem) == IS_DOUBLE) ? Z_DVAL_P(elem) - : (double)Z_LVAL_P(elem); + : (double)Z_IVAL_P(elem); } formattable.setDouble(d); break; @@ -491,14 +491,14 @@ retry_klong: } else { tInt32 = (int32_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_LONG) { - if (Z_LVAL_P(elem) > INT32_MAX || - Z_LVAL_P(elem) < INT32_MIN) { + } else if (Z_TYPE_P(elem) == IS_INT) { + if (Z_IVAL_P(elem) > INT32_MAX || + Z_IVAL_P(elem) < INT32_MIN) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found PHP integer with absolute value too large " "for 32 bit integer argument", 0 TSRMLS_CC); } else { - tInt32 = (int32_t)Z_LVAL_P(elem); + tInt32 = (int32_t)Z_IVAL_P(elem); } } else { SEPARATE_ZVAL_IF_NOT_REF(elem); @@ -521,9 +521,9 @@ retry_kint64: } else { tInt64 = (int64_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_LONG) { + } else if (Z_TYPE_P(elem) == IS_INT) { /* assume long is not wider than 64 bits */ - tInt64 = (int64_t)Z_LVAL_P(elem); + tInt64 = (int64_t)Z_IVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); @@ -567,10 +567,10 @@ retry_kint64: break; case IS_TRUE: case IS_FALSE: - convert_to_long_ex(elem); + convert_to_int_ex(elem); /* Intentional fallthrough */ - case IS_LONG: - formattable.setInt64((int64_t)Z_LVAL_P(elem)); + case IS_INT: + formattable.setInt64((int64_t)Z_IVAL_P(elem)); break; case IS_NULL: formattable.setInt64((int64_t)0); @@ -658,7 +658,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh break; case Formattable::kLong: - ZVAL_LONG(&(*args)[i], fargs[i].getLong()); + ZVAL_INT(&(*args)[i], fargs[i].getLong()); break; case Formattable::kInt64: @@ -666,7 +666,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh if(aInt64 > LONG_MAX || aInt64 < -LONG_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { - ZVAL_LONG(&(*args)[i], (long)aInt64); + ZVAL_INT(&(*args)[i], (long)aInt64); } break; diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c index f06a3e685c..cbc680e7aa 100644 --- a/ext/intl/normalizer/normalizer.c +++ b/ext/intl/normalizer/normalizer.c @@ -37,9 +37,9 @@ void normalizer_register_constants( INIT_FUNC_ARGS ) return; } - #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); - #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* Normalization form constants */ NORMALIZER_EXPOSE_CLASS_CONST( NONE ); diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 9ca225ab88..f837bf9d78 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -910,7 +910,7 @@ PHP_MINIT_FUNCTION( intl ) /* For the default locale php.ini setting */ REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS); #ifdef U_ICU_DATA_VERSION REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS); diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index 66978eb888..8f6025bcb1 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -53,7 +53,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so case URES_INT: lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) ); INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value"); - ZVAL_LONG( return_value, lfield ); + ZVAL_INT( return_value, lfield ); break; case URES_INT_VECTOR: @@ -61,7 +61,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value"); array_init( return_value ); for (i=0; i<ilen; i++) { - add_next_index_long( return_value, vfield[i] ); + add_next_index_int( return_value, vfield[i] ); } break; diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 77f2e90588..af629f8ec6 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -177,9 +177,9 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ intl_error_reset( NULL TSRMLS_CC ); RESOURCEBUNDLE_METHOD_FETCH_OBJECT; - if(Z_TYPE_P(offset) == IS_LONG) { + if(Z_TYPE_P(offset) == IS_INT) { is_numeric = 1; - meindex = Z_LVAL_P(offset); + meindex = Z_IVAL_P(offset); rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) ); } else if(Z_TYPE_P(offset) == IS_STRING) { mekey = Z_STRVAL_P(offset); @@ -299,7 +299,7 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_FETCH_OBJECT; len = ures_getSize( rb->me ); - RETURN_LONG( len ); + RETURN_INT( len ); } /* {{{ arginfo_resourcebundle_getlocales */ @@ -372,7 +372,7 @@ PHP_FUNCTION( resourcebundle_get_error_code ) rb = Z_INTL_RESOURCEBUNDLE_P( object ); - RETURN_LONG(INTL_DATA_ERROR_CODE(rb)); + RETURN_INT(INTL_DATA_ERROR_CODE(rb)); } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c index bdedfd15bc..79149cb234 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.c +++ b/ext/intl/resourcebundle/resourcebundle_iterator.c @@ -109,7 +109,7 @@ static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key T if (iterator->is_table) { ZVAL_STRING(key, iterator->currentkey); } else { - ZVAL_LONG(key, iterator->i); + ZVAL_INT(key, iterator->i); } } /* }}} */ diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c index 42a014a90e..747654a53b 100644 --- a/ext/intl/spoofchecker/spoofchecker.c +++ b/ext/intl/spoofchecker/spoofchecker.c @@ -35,7 +35,7 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS) return; } - #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); + #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE) diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index c37b9186a2..c0eac1f4eb 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -47,7 +47,7 @@ PHP_METHOD(Spoofchecker, isSuspicious) if (error_code) { zval_dtor(error_code); - ZVAL_LONG(error_code, ret); + ZVAL_INT(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -80,7 +80,7 @@ PHP_METHOD(Spoofchecker, areConfusable) if (error_code) { zval_dtor(error_code); - ZVAL_LONG(error_code, ret); + ZVAL_INT(error_code, ret); } RETVAL_BOOL(ret != 0); } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index be30c2d541..6c5b27aa4e 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -180,7 +180,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, gottenId; UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */ convert_to_string_ex(zv_timezone); - if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone), + if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRSIZE_P(zv_timezone), &status) == FAILURE) { spprintf(&message, 0, "%s: Time zone identifier given is not a " "valid UTF-8 string", func); @@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) return debug_info; } - ZVAL_LONG(&zv, (long)rawOffset); + ZVAL_INT(&zv, (long)rawOffset); zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); - ZVAL_LONG(&zv, (long)(rawOffset + dstOffset)); + ZVAL_INT(&zv, (long)(rawOffset + dstOffset)); zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; @@ -513,26 +513,26 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D) /* Declare 'IntlTimeZone' class constants */ -#define TIMEZONE_DECL_LONG_CONST(name, val) \ - zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \ +#define TIMEZONE_DECL_INT_CONST(name, val) \ + zend_declare_class_constant_int(TimeZone_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT", TimeZone::SHORT); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG", TimeZone::LONG); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); - TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); + TIMEZONE_DECL_INT_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); #endif #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 - TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); - TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); - TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); + TIMEZONE_DECL_INT_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); + TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); + TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); #endif /* Declare 'IntlTimeZone' class properties */ diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index a8332dbf7e..bff8dc803e 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -159,34 +159,34 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration) if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) { se = TimeZone::createEnumeration(); - } else if (Z_TYPE_P(arg) == IS_LONG) { + } else if (Z_TYPE_P(arg) == IS_INT) { int_offset: - if (Z_LVAL_P(arg) < (long)INT32_MIN || - Z_LVAL_P(arg) > (long)INT32_MAX) { + if (Z_IVAL_P(arg) < (long)INT32_MIN || + Z_IVAL_P(arg) > (long)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_enumeration: value is out of range", 0 TSRMLS_CC); RETURN_FALSE; } else { - se = TimeZone::createEnumeration((int32_t) Z_LVAL_P(arg)); + se = TimeZone::createEnumeration((int32_t) Z_IVAL_P(arg)); } } else if (Z_TYPE_P(arg) == IS_DOUBLE) { double_offset: - convert_to_long_ex(arg); + convert_to_int_ex(arg); goto int_offset; } else if (Z_TYPE_P(arg) == IS_OBJECT || Z_TYPE_P(arg) == IS_STRING) { - long lval; + php_int_t lval; double dval; convert_to_string_ex(arg); - switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &lval, &dval, 0)) { case IS_DOUBLE: SEPARATE_ZVAL(arg); zval_dtor(arg); ZVAL_DOUBLE(arg, dval); goto double_offset; - case IS_LONG: + case IS_INT: SEPARATE_ZVAL(arg); zval_dtor(arg); - ZVAL_LONG(arg, lval); + ZVAL_INT(arg, lval); goto int_offset; } /* else call string version */ @@ -228,7 +228,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) } int32_t result = TimeZone::countEquivalentIDs(id); - RETURN_LONG((long)result); + RETURN_INT((long)result); } #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 @@ -485,10 +485,10 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset) ZVAL_DEREF(rawOffsetArg); zval_dtor(rawOffsetArg); - ZVAL_LONG(rawOffsetArg, rawOffset); + ZVAL_INT(rawOffsetArg, rawOffset); ZVAL_DEREF(dstOffsetArg); zval_dtor(dstOffsetArg); - ZVAL_LONG(dstOffsetArg, dstOffset); + ZVAL_INT(dstOffsetArg, dstOffset); RETURN_TRUE; } @@ -506,7 +506,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_LONG(to->utimezone->getRawOffset()); + RETURN_INT(to->utimezone->getRawOffset()); } U_CFUNC PHP_FUNCTION(intltz_has_same_rules) @@ -603,7 +603,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_LONG((long)to->utimezone->getDSTSavings()); + RETURN_INT((long)to->utimezone->getDSTSavings()); } U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) @@ -646,7 +646,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code) if (to == NULL) RETURN_FALSE; - RETURN_LONG((long)TIMEZONE_ERROR_CODE(to)); + RETURN_INT((long)TIMEZONE_ERROR_CODE(to)); } U_CFUNC PHP_FUNCTION(intltz_get_error_message) diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 5f698e2b90..88e1225654 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -35,9 +35,9 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) return; } - #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_LONG_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) - #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); - #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ + #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_INT_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) + #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); + #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ /* Normalization form constants */ TRANSLITERATOR_EXPOSE_CLASS_CONST( FORWARD ); diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 1373db0c5b..e5f26f2829 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -223,7 +223,7 @@ static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, in TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) { retval = NULL; /* fallback to read_property */ } @@ -247,7 +247,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type, if( ( type != BP_VAR_R && type != BP_VAR_IS ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); retval = &EG( uninitialized_zval ); @@ -272,7 +272,7 @@ static void Transliterator_write_property( zval *object, zval *member, zval *val if( ( EG( scope ) != Transliterator_ce_ptr ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); } diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 4403de08aa..c3709973f3 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -342,7 +342,7 @@ PHP_FUNCTION( transliterator_transliterate ) convert_to_string( arg1 ); } object = &tmp_object; - res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ), + res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRSIZE_P( arg1 ), TRANSLITERATOR_FORWARD, object TSRMLS_CC ); if( res == FAILURE ) { @@ -497,7 +497,7 @@ PHP_FUNCTION( transliterator_get_error_code ) if (to == NULL ) RETURN_FALSE; - RETURN_LONG( (long) TRANSLITERATOR_ERROR_CODE( to ) ); + RETURN_INT( (long) TRANSLITERATOR_ERROR_CODE( to ) ); } /* }}} */ diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 116fc0c9b6..a4e34b07bc 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -293,7 +293,7 @@ static int dehexchar(char c) static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC) { - if (type == IS_LONG) + if (type == IS_INT) { zend_bool bigint = 0; @@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM buf->s->len--; } - if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) { - if (buf->s->len == MAX_LENGTH_OF_LONG - 1) { - int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits); + if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) { bigint = 1; @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); + ZVAL_INT(z, strtol(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_LONG; + } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_INT; smart_str_appendc(&buf, next_char); - } else if (type == IS_LONG && next_state == E1) { + } else if (type == IS_INT && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { diff --git a/ext/json/json.c b/ext/json/json.c index bc0544808f..4e3692a543 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -93,29 +93,29 @@ static PHP_MINIT_FUNCTION(json) INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface); php_json_serializable_ce = zend_register_internal_interface(&ce TSRMLS_CC); - REGISTER_LONG_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -308,7 +308,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) json_pretty_print_indent(buf, options TSRMLS_CC); smart_str_appendc(buf, '"'); - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (long) index); smart_str_appendc(buf, '"'); smart_str_appendc(buf, ':'); @@ -398,8 +398,8 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR long p; if ((type = is_numeric_string(s, len, &p, &d, 0)) != 0) { - if (type == IS_LONG) { - smart_str_append_long(buf, p); + if (type == IS_INT) { + smart_str_append_int(buf, p); } else if (type == IS_DOUBLE) { if (!zend_isinf(d) && !zend_isnan(d)) { char *tmp; @@ -602,8 +602,8 @@ again: smart_str_appendl(buf, "false", 5); break; - case IS_LONG: - smart_str_append_long(buf, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(buf, Z_IVAL_P(val)); break; case IS_DOUBLE: @@ -624,7 +624,7 @@ again: break; case IS_STRING: - json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC); + json_escape_string(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val), options TSRMLS_CC); break; case IS_OBJECT: @@ -710,8 +710,8 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, } if ((type = is_numeric_string_ex(trim, trim_len, &p, &d, 0, &overflow_info)) != 0) { - if (type == IS_LONG) { - RETVAL_LONG(p); + if (type == IS_INT) { + RETVAL_INT(p); } else if (type == IS_DOUBLE) { if (options & PHP_JSON_BIGINT_AS_STRING && overflow_info) { /* Within an object or array, a numeric literal is assumed @@ -820,7 +820,7 @@ static PHP_FUNCTION(json_last_error) return; } - RETURN_LONG(JSON_G(error_code)); + RETURN_INT(JSON_G(error_code)); } /* }}} */ diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8f52f1f3fb..75ec8f7003 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -147,65 +147,65 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_INI_ENTRIES(); /* Constants to be used with deref-parameter in php_ldap_do_search() */ - REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); /* Constants to be used with ldap_modify_batch() */ - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* LDAP options */ - REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_NETWORK_TIMEOUT - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); #elif defined (LDAP_X_OPT_CONNECT_TIMEOUT) - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_RESTART - REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_HOST_NAME - REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_MATCHED_DN - REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_DEBUG_LEVEL - REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); #endif #ifdef HAVE_LDAP_SASL - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); #endif #ifdef ORALDAP - REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); @@ -870,7 +870,7 @@ PHP_FUNCTION(ldap_count_entries) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result); - RETURN_LONG(ldap_count_entries(ld->link, ldap_result)); + RETURN_INT(ldap_count_entries(ld->link, ldap_result)); } /* }}} */ @@ -957,7 +957,7 @@ PHP_FUNCTION(ldap_get_entries) num_entries = ldap_count_entries(ldap, ldap_result); array_init(return_value); - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); if (num_entries == 0) { return; @@ -981,7 +981,7 @@ PHP_FUNCTION(ldap_get_entries) num_values = ldap_count_values_len(ldap_value); array_init(&tmp2); - add_assoc_long(&tmp2, "count", num_values); + add_assoc_int(&tmp2, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1003,7 +1003,7 @@ PHP_FUNCTION(ldap_get_entries) } #endif - add_assoc_long(&tmp1, "count", num_attrib); + add_assoc_int(&tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); add_assoc_string(&tmp1, "dn", dn); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -1018,7 +1018,7 @@ PHP_FUNCTION(ldap_get_entries) ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry); } - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); } /* }}} */ @@ -1119,7 +1119,7 @@ PHP_FUNCTION(ldap_get_attributes) num_values = ldap_count_values_len(ldap_value); array_init(&tmp); - add_assoc_long(&tmp, "count", num_values); + add_assoc_int(&tmp, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1140,7 +1140,7 @@ PHP_FUNCTION(ldap_get_attributes) } #endif - add_assoc_long(return_value, "count", num_attrib); + add_assoc_int(return_value, "count", num_attrib); } /* }}} */ @@ -1174,7 +1174,7 @@ PHP_FUNCTION(ldap_get_values_len) add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len); } - add_assoc_long(return_value, "count", num_values); + add_assoc_int(return_value, "count", num_values); ldap_value_free_len(ldap_value_len); } @@ -1233,7 +1233,7 @@ PHP_FUNCTION(ldap_explode_dn) array_init(return_value); - add_assoc_long(return_value, "count", count); + add_assoc_int(return_value, "count", count); for (i = 0; i<count; i++) { add_index_string(return_value, i, ldap_value[i]); } @@ -1338,7 +1338,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) if ((num_values == 1) && (Z_TYPE_P(value) != IS_ARRAY)) { convert_to_string_ex(value); ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value); + ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRSIZE_P(value); ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_P(value); } else { for (j = 0; j < num_values; j++) { @@ -1351,7 +1351,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(ivalue); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(ivalue); ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_P(ivalue); } } @@ -1552,7 +1552,7 @@ PHP_FUNCTION(ldap_modify_batch) /* make sure the top level is a normal array */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods)); - if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed"); RETURN_FALSE; } @@ -1604,19 +1604,19 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } - if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { + if (Z_STRSIZE_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRSIZE_P(modinfo))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes"); RETURN_FALSE; } } else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) { - if (Z_TYPE_P(modinfo) != IS_LONG) { + if (Z_TYPE_P(modinfo) != IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long"); RETURN_FALSE; } /* is the value in range? */ - modtype = Z_LVAL_P(modinfo); + modtype = Z_IVAL_P(modinfo); if ( modtype != LDAP_MODIFY_BATCH_ADD && modtype != LDAP_MODIFY_BATCH_REMOVE && @@ -1656,7 +1656,7 @@ PHP_FUNCTION(ldap_modify_batch) } /* are its keys integers? */ - if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed"); RETURN_FALSE; } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_modify_batch) _ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals); /* map the modification type */ - switch (Z_LVAL_P(modtype)) { + switch (Z_IVAL_P(modtype)) { case LDAP_MODIFY_BATCH_ADD: oper = LDAP_MOD_ADD; break; @@ -1718,9 +1718,9 @@ PHP_FUNCTION(ldap_modify_batch) /* fill in the basic info */ ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib)); + ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRSIZE_P(attrib)); - if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { + if (Z_IVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { /* no values */ ldap_mods[i]->mod_bvalues = NULL; } @@ -1739,8 +1739,8 @@ PHP_FUNCTION(ldap_modify_batch) ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0); /* fill it */ - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval); - ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval)); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(modval); + ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRSIZE_P(modval)); } /* NULL-terminate values */ @@ -1800,7 +1800,7 @@ PHP_FUNCTION(ldap_errno) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - RETURN_LONG(_get_lderrno(ld->link)); + RETURN_INT(_get_lderrno(ld->link)); } /* }}} */ @@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_compare) } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno)); - RETURN_LONG(-1); + RETURN_INT(-1); } /* }}} */ @@ -1934,7 +1934,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, val); + ZVAL_INT(retval, val); } break; #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: @@ -1951,7 +1951,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, timeout->tv_sec); + ZVAL_INT(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) @@ -1963,7 +1963,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, (timeout / 1000)); + ZVAL_INT(retval, (timeout / 1000)); } break; #endif /* options with string value */ @@ -2039,8 +2039,8 @@ PHP_FUNCTION(ldap_set_option) { int val; - convert_to_long_ex(newval); - val = Z_LVAL_P(newval); + convert_to_int_ex(newval); + val = Z_IVAL_P(newval); if (ldap_set_option(ldap, option, &val)) { RETURN_FALSE; } @@ -2050,8 +2050,8 @@ PHP_FUNCTION(ldap_set_option) { struct timeval timeout; - convert_to_long_ex(newval); - timeout.tv_sec = Z_LVAL_P(newval); + convert_to_int_ex(newval); + timeout.tv_sec = Z_IVAL_P(newval); timeout.tv_usec = 0; if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; @@ -2062,8 +2062,8 @@ PHP_FUNCTION(ldap_set_option) { int timeout; - convert_to_long_ex(newval); - timeout = 1000 * Z_LVAL_P(newval); /* Convert to milliseconds */ + convert_to_int_ex(newval); + timeout = 1000 * Z_IVAL_P(newval); /* Convert to milliseconds */ if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } @@ -2138,7 +2138,7 @@ PHP_FUNCTION(ldap_set_option) if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) { convert_to_string_ex(val); ctrl->ldctl_value.bv_val = Z_STRVAL_P(val); - ctrl->ldctl_value.bv_len = Z_STRLEN_P(val); + ctrl->ldctl_value.bv_len = Z_STRSIZE_P(val); } else { ctrl->ldctl_value.bv_val = NULL; ctrl->ldctl_value.bv_len = 0; @@ -2204,7 +2204,7 @@ PHP_FUNCTION(ldap_parse_result) } zval_ptr_dtor(errcode); - ZVAL_LONG(errcode, lerrcode); + ZVAL_INT(errcode, lerrcode); /* Reverse -> fall through */ switch (myargcount) { @@ -2424,8 +2424,8 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi ZVAL_COPY_VALUE(&cb_args[0], cb_link); ZVAL_STRING(&cb_args[1], url); if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(cb_retval)) { - convert_to_long_ex(&cb_retval); - retval = Z_LVAL(cb_retval); + convert_to_int_ex(&cb_retval); + retval = Z_IVAL(cb_retval); zval_ptr_dtor(&cb_retval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed"); @@ -2450,7 +2450,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) { + if (Z_TYPE_P(callback) == IS_STRING && Z_STRSIZE_P(callback) == 0) { /* unregister rebind procedure */ if (!Z_ISUNDEF(ld->rebindproc)) { zval_ptr_dtor(&ld->rebindproc); @@ -2778,7 +2778,7 @@ PHP_FUNCTION(ldap_control_paged_result_response) ldap_controls_free(lserverctrls); if (myargcount == 4) { zval_dtor(estimated); - ZVAL_LONG(estimated, lestimated); + ZVAL_INT(estimated, lestimated); } zval_ptr_dtor(cookie); diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 8fd661c81d..3580891019 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -779,51 +779,51 @@ static PHP_MINIT_FUNCTION(libxml) php_libxml_initialize(); - REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_DOTTED_VERSION", LIBXML_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_LOADED_VERSION", (char *)xmlParserVersion, CONST_CS | CONST_PERSISTENT); /* For use with loading xml */ - REGISTER_LONG_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); #if LIBXML_VERSION >= 20621 - REGISTER_LONG_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20703 - REGISTER_LONG_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); /* Schema validation options */ #if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 - REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); #endif /* Additional constants for use with loading html */ #if LIBXML_VERSION >= 20707 - REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20708 - REGISTER_LONG_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); #endif /* Error levels */ - REGISTER_LONG_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "LibXMLError", NULL); libxmlerror_class_entry = zend_register_internal_class(&ce TSRMLS_CC); @@ -991,9 +991,9 @@ static PHP_FUNCTION(libxml_get_last_error) if (error) { object_init_ex(return_value, libxmlerror_class_entry); - add_property_long(return_value, "level", error->level); - add_property_long(return_value, "code", error->code); - add_property_long(return_value, "column", error->int2); + add_property_int(return_value, "level", error->level); + add_property_int(return_value, "code", error->code); + add_property_int(return_value, "column", error->int2); if (error->message) { add_property_string(return_value, "message", error->message); } else { @@ -1004,7 +1004,7 @@ static PHP_FUNCTION(libxml_get_last_error) } else { add_property_stringl(return_value, "file", "", 0); } - add_property_long(return_value, "line", error->line); + add_property_int(return_value, "line", error->line); } else { RETURN_FALSE; } @@ -1030,9 +1030,9 @@ static PHP_FUNCTION(libxml_get_errors) zval z_error; object_init_ex(&z_error, libxmlerror_class_entry); - add_property_long(&z_error, "level", error->level); - add_property_long(&z_error, "code", error->code); - add_property_long(&z_error, "column", error->int2); + add_property_int(&z_error, "level", error->level); + add_property_int(&z_error, "code", error->code); + add_property_int(&z_error, "column", error->int2); if (error->message) { add_property_string(&z_error, "message", error->message); } else { @@ -1043,7 +1043,7 @@ static PHP_FUNCTION(libxml_get_errors) } else { add_property_stringl(&z_error, "file", "", 0); } - add_property_long(&z_error, "line", error->line); + add_property_int(&z_error, "line", error->line); add_next_index_zval(return_value, &z_error); error = zend_llist_get_next(LIBXML(error_list)); diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 248bd98535..fe99d231ee 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1443,7 +1443,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) } php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC); - if (Z_STRLEN(tmp) > 0) { + if (Z_STRSIZE(tmp) > 0) { if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) { zval_dtor(&tmp); return FAILURE; @@ -1559,13 +1559,13 @@ PHP_MINIT_FUNCTION(mbstring) sapi_register_post_entries(mbstr_post_entries TSRMLS_CC); } - REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); #if HAVE_MBREGEX PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); @@ -1938,7 +1938,7 @@ PHP_FUNCTION(mb_detect_order) break; default: convert_to_string_ex(arg1); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1979,25 +1979,25 @@ PHP_FUNCTION(mb_substitute_character) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETURN_STRING("entity"); } else { - RETURN_LONG(MBSTRG(current_filter_illegal_substchar)); + RETURN_INT(MBSTRG(current_filter_illegal_substchar)); } } else { RETVAL_TRUE; switch (Z_TYPE_P(arg1)) { case IS_STRING: - if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; - } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; - } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; } else { - convert_to_long_ex(arg1); + convert_to_int_ex(arg1); - if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { + if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2005,10 +2005,10 @@ PHP_FUNCTION(mb_substitute_character) } break; default: - convert_to_long_ex(arg1); - if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { + convert_to_int_ex(arg1); + if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2232,7 +2232,7 @@ PHP_FUNCTION(mb_strlen) n = mbfl_strlen(&string); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2280,7 +2280,7 @@ PHP_FUNCTION(mb_strpos) n = mbfl_strpos(&haystack, &needle, offset, reverse); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { switch (-n) { case 1: @@ -2330,7 +2330,7 @@ PHP_FUNCTION(mb_strrpos) if (zoffset) { if (Z_TYPE_P(zoffset) == IS_STRING) { enc_name2 = Z_STRVAL_P(zoffset); - enc_name_len2 = Z_STRLEN_P(zoffset); + enc_name_len2 = Z_STRSIZE_P(zoffset); str_flg = 1; if (enc_name2 != NULL) { @@ -2356,15 +2356,15 @@ PHP_FUNCTION(mb_strrpos) } if (str_flg) { - convert_to_long_ex(zoffset); - offset = Z_LVAL_P(zoffset); + convert_to_int_ex(zoffset); + offset = Z_IVAL_P(zoffset); } else { enc_name = enc_name2; enc_name_len = enc_name_len2; } } else { - convert_to_long_ex(zoffset); - offset = Z_LVAL_P(zoffset); + convert_to_int_ex(zoffset); + offset = Z_IVAL_P(zoffset); } } @@ -2394,7 +2394,7 @@ PHP_FUNCTION(mb_strrpos) n = mbfl_strpos(&haystack, &needle, offset, 1); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2423,7 +2423,7 @@ PHP_FUNCTION(mb_stripos) n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2449,7 +2449,7 @@ PHP_FUNCTION(mb_strripos) n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2737,7 +2737,7 @@ PHP_FUNCTION(mb_substr_count) n = mbfl_substr_count(&haystack, &needle); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2777,8 +2777,8 @@ PHP_FUNCTION(mb_substr) if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) { len = str_len; } else { - convert_to_long_ex(z_len); - len = Z_LVAL_P(z_len); + convert_to_int_ex(z_len); + len = Z_IVAL_P(z_len); } /* measures length */ @@ -2853,8 +2853,8 @@ PHP_FUNCTION(mb_strcut) if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) { len = string.len; } else { - convert_to_long_ex(z_len); - len = Z_LVAL_P(z_len); + convert_to_int_ex(z_len); + len = Z_IVAL_P(z_len); } /* if "from" position is negative, count start position from the end @@ -2920,7 +2920,7 @@ PHP_FUNCTION(mb_strwidth) n = mbfl_strwidth(&string); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -3106,7 +3106,7 @@ PHP_FUNCTION(mb_convert_encoding) n = strlen(Z_STRVAL_P(hash_entry)); _from_encodings = erealloc(_from_encodings, l+n+2); memcpy(_from_encodings + l, ",", 1); - memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRLEN_P(hash_entry) + 1); + memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRSIZE_P(hash_entry) + 1); } else { _from_encodings = estrdup(Z_STRVAL_P(hash_entry)); } @@ -3256,7 +3256,7 @@ PHP_FUNCTION(mb_detect_encoding) break; default: convert_to_string(encoding_list); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRSIZE_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); list = NULL; @@ -3579,7 +3579,7 @@ PHP_FUNCTION(mb_convert_variables) break; default: convert_to_string_ex(zfrom_enc); - php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); + php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRSIZE_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); break; } @@ -3636,7 +3636,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRLEN_P(hash_entry); + string.len = Z_STRSIZE_P(hash_entry); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3645,7 +3645,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRLEN_P(var); + string.len = Z_STRSIZE_P(var); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3725,7 +3725,7 @@ detect_end: } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRLEN_P(hash_entry); + string.len = Z_STRSIZE_P(hash_entry); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(hash_entry_ptr); @@ -3738,7 +3738,7 @@ detect_end: } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRLEN_P(var); + string.len = Z_STRSIZE_P(var); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(var); @@ -3814,8 +3814,8 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) mapelm = convmap; mapsize = 0; ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) { - convert_to_long_ex(hash_entry); - *mapelm++ = Z_LVAL_P(hash_entry); + convert_to_int_ex(hash_entry); + *mapelm++ = Z_IVAL_P(hash_entry); mapsize++; } ZEND_HASH_FOREACH_END(); } @@ -4352,7 +4352,7 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); + add_assoc_int(return_value, "func_overload", MBSTRG(func_overload)); if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); array_init(&row1); @@ -4377,7 +4377,7 @@ PHP_FUNCTION(mb_get_info) add_assoc_string(return_value, "mail_body_encoding", name); } } - add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars)); + add_assoc_int(return_value, "illegal_chars", MBSTRG(illegalchars)); if (MBSTRG(encoding_translation)) { add_assoc_string(return_value, "encoding_translation", "On"); } else { @@ -4404,7 +4404,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { add_assoc_string(return_value, "substitute_character", "entity"); } else { - add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); + add_assoc_int(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); } if (MBSTRG(strict_detection)) { add_assoc_string(return_value, "strict_detection", "On"); @@ -4428,7 +4428,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("func_overload", typ)) { - RETVAL_LONG(MBSTRG(func_overload)); + RETVAL_INT(MBSTRG(func_overload)); } else if (!strcasecmp("func_overload_list", typ)) { if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); @@ -4455,7 +4455,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("illegal_chars", typ)) { - RETVAL_LONG(MBSTRG(illegalchars)); + RETVAL_INT(MBSTRG(illegalchars)); } else if (!strcasecmp("encoding_translation", typ)) { if (MBSTRG(encoding_translation)) { RETVAL_STRING("On"); @@ -4485,7 +4485,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETVAL_STRING("entity"); } else { - RETVAL_LONG(MBSTRG(current_filter_illegal_substchar)); + RETVAL_INT(MBSTRG(current_filter_illegal_substchar)); } } else if (!strcasecmp("strict_detection", typ)) { if (MBSTRG(strict_detection)) { diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index ab03306f14..4c30eee8a9 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -711,19 +711,19 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (Z_TYPE_P(arg_pattern) != IS_STRING) { /* we convert numbers to integers and treat them as a string */ if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) { - convert_to_long_ex(arg_pattern); /* get rid of decimal places */ + convert_to_int_ex(arg_pattern); /* get rid of decimal places */ } convert_to_string_ex(arg_pattern); /* don't bother doing an extended regex with just a number */ } - if (!Z_STRVAL_P(arg_pattern) || Z_STRLEN_P(arg_pattern) == 0) { + if (!Z_STRVAL_P(arg_pattern) || Z_STRSIZE_P(arg_pattern) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern"); RETVAL_FALSE; goto out; } - re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); + re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRSIZE_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); if (re == NULL) { RETVAL_FALSE; goto out; @@ -758,7 +758,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (match_len == 0) { match_len = 1; } - RETVAL_LONG(match_len); + RETVAL_INT(match_len); out: if (regs != NULL) { onig_region_free(regs, 1); @@ -855,11 +855,11 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { arg_pattern = Z_STRVAL_P(arg_pattern_zval); - arg_pattern_len = Z_STRLEN_P(arg_pattern_zval); + arg_pattern_len = Z_STRSIZE_P(arg_pattern_zval); } else { /* FIXME: this code is not multibyte aware! */ - convert_to_long_ex(arg_pattern_zval); - pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); + convert_to_int_ex(arg_pattern_zval); + pat_buf[0] = (char)Z_IVAL_P(arg_pattern_zval); pat_buf[1] = '\0'; arg_pattern = pat_buf; @@ -947,7 +947,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp /* result of eval */ convert_to_string(&v); - smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v)); + smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRSIZE(v)); /* Clean up */ eval_buf.s->len = 0; zval_dtor(&v); @@ -971,7 +971,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp if (zend_call_function(&arg_replace_fci, &arg_replace_fci_cache TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(retval)) { convert_to_string_ex(&retval); - smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval)); + smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRSIZE(retval)); if (eval_buf.s) { eval_buf.s->len = 0; } @@ -1209,7 +1209,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) len = 0; if (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING){ str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRLEN(MBREX(search_str)); + len = Z_STRSIZE(MBREX(search_str)); } if (MBREX(search_re) == NULL) { @@ -1245,8 +1245,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) array_init(return_value); beg = MBREX(search_regs)->beg[0]; end = MBREX(search_regs)->end[0]; - add_next_index_long(return_value, beg); - add_next_index_long(return_value, end - beg); + add_next_index_int(return_value, beg); + add_next_index_int(return_value, end - beg); break; case 2: array_init(return_value); @@ -1368,7 +1368,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) array_init(return_value); str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRLEN(MBREX(search_str)); + len = Z_STRSIZE(MBREX(search_str)); n = MBREX(search_regs)->num_regs; for (i = 0; i < n; i++) { beg = MBREX(search_regs)->beg[i]; @@ -1389,7 +1389,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) Get search start position */ PHP_FUNCTION(mb_ereg_search_getpos) { - RETVAL_LONG(MBREX(search_pos)); + RETVAL_INT(MBREX(search_pos)); } /* }}} */ @@ -1403,7 +1403,7 @@ PHP_FUNCTION(mb_ereg_search_setpos) return; } - if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRLEN(MBREX(search_str)))) { + if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRSIZE(MBREX(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBREX(search_pos) = 0; RETURN_FALSE; diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 84b0c9248c..44c5b4ef6d 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -386,13 +386,13 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */ le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number); /* modes for mcrypt_??? routines */ - REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); /* sources for mcrypt_create_iv */ - REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); /* ciphers */ MCRYPT_ENTRY2_2_4(3DES, "tripledes"); @@ -603,7 +603,7 @@ PHP_FUNCTION(mcrypt_generic_init) } } pm->init = 1; - RETVAL_LONG(result); + RETVAL_INT(result); efree(iv_s); efree(key_s); @@ -712,7 +712,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) key_sizes = mcrypt_enc_get_supported_key_sizes(pm->td, &count); for (i = 0; i < count; i++) { - add_index_long(return_value, i, key_sizes[i]); + add_index_int(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); @@ -724,7 +724,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) PHP_FUNCTION(mcrypt_enc_self_test) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_self_test(pm->td)); + RETURN_INT(mcrypt_enc_self_test(pm->td)); } /* }}} */ @@ -800,7 +800,7 @@ PHP_FUNCTION(mcrypt_enc_is_block_mode) PHP_FUNCTION(mcrypt_enc_get_block_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_block_size(pm->td)); + RETURN_INT(mcrypt_enc_get_block_size(pm->td)); } /* }}} */ @@ -809,7 +809,7 @@ PHP_FUNCTION(mcrypt_enc_get_block_size) PHP_FUNCTION(mcrypt_enc_get_key_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_key_size(pm->td)); + RETURN_INT(mcrypt_enc_get_key_size(pm->td)); } /* }}} */ @@ -818,7 +818,7 @@ PHP_FUNCTION(mcrypt_enc_get_key_size) PHP_FUNCTION(mcrypt_enc_get_iv_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_iv_size(pm->td)); + RETURN_INT(mcrypt_enc_get_iv_size(pm->td)); } /* }}} */ @@ -910,7 +910,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir) - RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir)); + RETURN_INT(mcrypt_module_get_algo_block_size(module, dir)); } /* }}} */ @@ -920,7 +920,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir); - RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir)); + RETURN_INT(mcrypt_module_get_algo_key_size(module, dir)); } /* }}} */ @@ -937,7 +937,7 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes) key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count); for (i = 0; i < count; i++) { - add_index_long(return_value, i, key_sizes[i]); + add_index_int(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); } @@ -1017,7 +1017,7 @@ PHP_FUNCTION(mcrypt_get_key_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_key_size(td)); + RETVAL_INT(mcrypt_enc_get_key_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1046,7 +1046,7 @@ PHP_FUNCTION(mcrypt_get_block_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_block_size(td)); + RETVAL_INT(mcrypt_enc_get_block_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1075,7 +1075,7 @@ PHP_FUNCTION(mcrypt_get_iv_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_iv_size(td)); + RETVAL_INT(mcrypt_enc_get_iv_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1138,9 +1138,9 @@ static char *php_mcrypt_get_key_size_str( return str; } else { int i; + char *result = NULL; smart_str str = {0}; smart_str_appends(&str, "Only keys of sizes "); - char *result = NULL; for (i = 0; i < key_size_count; ++i) { if (i == key_size_count - 1) { @@ -1149,7 +1149,7 @@ static char *php_mcrypt_get_key_size_str( smart_str_appends(&str, ", "); } - smart_str_append_long(&str, key_sizes[i]); + smart_str_append_int(&str, key_sizes[i]); } smart_str_appends(&str, " supported"); @@ -1341,9 +1341,9 @@ PHP_FUNCTION(mcrypt_ecb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1357,9 +1357,9 @@ PHP_FUNCTION(mcrypt_cbc) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1373,9 +1373,9 @@ PHP_FUNCTION(mcrypt_cfb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1389,9 +1389,9 @@ PHP_FUNCTION(mcrypt_ofb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ diff --git a/ext/mcrypt/mcrypt_filter.c b/ext/mcrypt/mcrypt_filter.c index 698664b236..c0b89300a9 100644 --- a/ext/mcrypt/mcrypt_filter.c +++ b/ext/mcrypt/mcrypt_filter.c @@ -201,7 +201,7 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) && Z_TYPE_P(tmpzval) == IS_STRING) { key = Z_STRVAL_P(tmpzval); - key_len = Z_STRLEN_P(tmpzval); + key_len = Z_STRSIZE_P(tmpzval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string"); return NULL; @@ -226,11 +226,11 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval } iv = emalloc(iv_len + 1); - if (iv_len <= Z_STRLEN_P(tmpzval)) { + if (iv_len <= Z_STRSIZE_P(tmpzval)) { memcpy(iv, Z_STRVAL_P(tmpzval), iv_len); } else { - memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); - memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval)); + memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); + memset(iv + Z_STRSIZE_P(tmpzval), 0, iv_len - Z_STRSIZE_P(tmpzval)); } result = mcrypt_generic_init(mcrypt_module, key, key_len, iv); diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 340f55b421..03dbeca61c 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -424,7 +424,7 @@ static PHP_GINIT_FUNCTION(mssql) mssql_globals->num_persistent = 0; mssql_globals->get_column_content = php_mssql_get_column_content_with_type; - if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { + if (cfg_get_int("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { if (compatibility_mode) { mssql_globals->get_column_content = php_mssql_get_column_content_without_type; } @@ -449,20 +449,20 @@ PHP_MINIT_FUNCTION(mssql) } /* BEGIN MSSQL data types for mssql_bind */ - REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); /* END MSSQL data types for mssql_bind */ return SUCCESS; @@ -773,7 +773,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_LVAL_P(return_value) = link; + Z_IVAL_P(return_value) = link; php_mssql_set_default_link(link TSRMLS_CC); Z_TYPE_P(return_value) = IS_RESOURCE; dbfreelogin(mssql.login); @@ -828,7 +828,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry),NULL)==FAILURE) { efree(hashed_details); @@ -837,7 +837,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_links)++; } efree(hashed_details); - php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); + php_mssql_set_default_link(Z_IVAL_P(return_value) TSRMLS_CC); } /* }}} */ @@ -944,7 +944,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off case SQLINT2: case SQLINT4: case SQLINTN: { - ZVAL_LONG(result, (long) anyintcol(offset)); + ZVAL_INT(result, (long) anyintcol(offset)); break; } case SQLCHAR: @@ -1160,9 +1160,9 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLINT1: case SQLINT2: case SQLINT4: - convert_to_long_ex(&bind->zval); + convert_to_int_ex(&bind->zval); /* FIXME this works only on little endian machine !!! */ - Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); + Z_IVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); break; case SQLFLT4: @@ -1179,8 +1179,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLVARCHAR: case SQLTEXT: convert_to_string_ex(&bind->zval); - Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i); - Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval)); + Z_STRSIZE_P(bind->zval) = dbretlen(mssql_ptr->link,i); + Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRSIZE_P(bind->zval)); break; /* TODO binary */ } @@ -1195,8 +1195,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme if (statement->binds != NULL) { /* Maybe a non-parameter sp */ if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) { if (dbhasretstat(mssql_ptr->link)) { - convert_to_long_ex(&bind->zval); - Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); + convert_to_int_ex(&bind->zval); + Z_IVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure has no return value. Nothing was returned into RETVAL"); @@ -1315,7 +1315,7 @@ PHP_FUNCTION(mssql_fetch_batch) result->cur_row=result->num_rows=0; result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC); - RETURN_LONG(result->num_rows); + RETURN_INT(result->num_rows); } /* }}} */ @@ -1407,7 +1407,7 @@ PHP_FUNCTION(mssql_rows_affected) ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, &mssql_link_index, -1, "MS SQL-Link", le_link, le_plink); - RETURN_LONG(DBCOUNT(mssql_ptr->link)); + RETURN_INT(DBCOUNT(mssql_ptr->link)); } /* }}} */ @@ -1468,7 +1468,7 @@ PHP_FUNCTION(mssql_num_rows) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_LONG(result->num_rows); + RETURN_INT(result->num_rows); } /* }}} */ @@ -1485,7 +1485,7 @@ PHP_FUNCTION(mssql_num_fields) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_LONG(result->num_fields); + RETURN_INT(result->num_fields); } /* }}} */ @@ -1535,7 +1535,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { data = Z_STRVAL(result->data[result->cur_row][i]); - data_len = Z_STRLEN(result->data[result->cur_row][i]); + data_len = Z_STRSIZE(result->data[result->cur_row][i]); if (result_type & MSSQL_NUM) { add_index_stringl(return_value, i, data, data_len); @@ -1545,12 +1545,12 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) add_assoc_stringl(return_value, result->fields[i].name, data, data_len); } } - else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { + else if (Z_TYPE(result->data[result->cur_row][i]) == IS_INT) { if (result_type & MSSQL_NUM) - add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i])); + add_index_int(return_value, i, Z_IVAL(result->data[result->cur_row][i])); if (result_type & MSSQL_ASSOC) - add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i])); + add_assoc_int(return_value, result->fields[i].name, Z_IVAL(result->data[result->cur_row][i])); } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) { if (result_type & MSSQL_NUM) @@ -1719,9 +1719,9 @@ PHP_FUNCTION(mssql_fetch_field) object_init(return_value); add_property_string(return_value, "name",result->fields[field_offset].name); - add_property_long(return_value, "max_length",result->fields[field_offset].max_length); + add_property_int(return_value, "max_length",result->fields[field_offset].max_length); add_property_string(return_value, "column_source",result->fields[field_offset].column_source); - add_property_long(return_value, "numeric", result->fields[field_offset].numeric); + add_property_int(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -1752,7 +1752,7 @@ PHP_FUNCTION(mssql_field_length) RETURN_FALSE; } - RETURN_LONG(result->fields[field_offset].max_length); + RETURN_INT(result->fields[field_offset].max_length); } /* }}} */ @@ -1877,8 +1877,8 @@ PHP_FUNCTION(mssql_result) break; } default: - convert_to_long_ex(field); - field_offset = Z_LVAL_PP(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_PP(field); if (field_offset<0 || field_offset>=result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2043,7 +2043,7 @@ PHP_FUNCTION(mssql_bind) datalen=0; } else { convert_to_string_ex(var); - datalen=Z_STRLEN_PP(var); + datalen=Z_STRSIZE_PP(var); value=(LPBYTE)Z_STRVAL_PP(var); } } else { @@ -2067,8 +2067,8 @@ PHP_FUNCTION(mssql_bind) case SQLINT1: case SQLINT2: case SQLINT4: - convert_to_long_ex(var); - value=(LPBYTE)(&Z_LVAL_PP(var)); + convert_to_int_ex(var); + value=(LPBYTE)(&Z_IVAL_PP(var)); break; default: diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index f4124d306b..d492147c7f 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -568,15 +568,15 @@ ZEND_MODULE_STARTUP_D(mysql) le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); mysql_module_entry.type = type; - REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID >= 40000 - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); #ifndef MYSQL_USE_MYSQLND #if MYSQL_VERSION_ID >= 40000 @@ -820,7 +820,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */ #endif hashed_details = STR_ALLOC(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) - + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0); + + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_ZEND_INT - 1, 0); hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); } @@ -1225,7 +1225,7 @@ PHP_FUNCTION(mysql_get_proto_info) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG(mysql_get_proto_info(mysql->conn)); + RETURN_INT(mysql_get_proto_info(mysql->conn)); } /* }}} */ @@ -1299,7 +1299,7 @@ PHP_FUNCTION(mysql_thread_id) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG((long) mysql_thread_id(mysql->conn)); + RETURN_INT((long) mysql_thread_id(mysql->conn)); } /* }}} */ @@ -1802,7 +1802,7 @@ PHP_FUNCTION(mysql_errno) if (!mysql_link) { if (MySG(default_link) == NULL) { if (MySG(connect_error) != NULL){ - RETURN_LONG(MySG(connect_errno)); + RETURN_INT(MySG(connect_errno)); } else { RETURN_FALSE; } @@ -1812,7 +1812,7 @@ PHP_FUNCTION(mysql_errno) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG(mysql_errno(mysql->conn)); + RETURN_INT(mysql_errno(mysql->conn)); } #endif /* }}} */ @@ -1837,7 +1837,7 @@ PHP_FUNCTION(mysql_affected_rows) } /* conversion from int64 to long happing here */ - RETURN_LONG((long)mysql_affected_rows(mysql->conn)); + RETURN_INT((long)mysql_affected_rows(mysql->conn)); } /* }}} */ @@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_insert_id) } /* conversion from int64 to long happing here */ - RETURN_LONG((long)mysql_insert_id(mysql->conn)); + RETURN_INT((long)mysql_insert_id(mysql->conn)); } /* }}} */ @@ -1964,7 +1964,7 @@ Q: String or long first? field_name = estrdup(tmp + 1); } else { table_name = NULL; - field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field)); + field_name = estrndup(Z_STRVAL_P(field),Z_STRSIZE_P(field)); } mysql_field_seek(mysql_result, 0); while ((tmp_field = mysql_fetch_field(mysql_result))) { @@ -1992,8 +1992,8 @@ Q: String or long first? } break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); if (field_offset < 0 || field_offset >= (int)mysql_num_fields(mysql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2040,7 +2040,7 @@ PHP_FUNCTION(mysql_num_rows) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); /* conversion from int64 to long happing here */ - RETURN_LONG((long) mysql_num_rows(mysql_result)); + RETURN_INT((long) mysql_num_rows(mysql_result)); } /* }}} */ @@ -2057,7 +2057,7 @@ PHP_FUNCTION(mysql_num_fields) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); - RETURN_LONG(mysql_num_fields(mysql_result)); + RETURN_INT(mysql_num_fields(mysql_result)); } /* }}} */ @@ -2312,7 +2312,7 @@ PHP_FUNCTION(mysql_fetch_lengths) num_fields = mysql_num_fields(mysql_result); for (i=0; i<num_fields; i++) { - add_index_long(return_value, i, lengths[i]); + add_index_int(return_value, i, lengths[i]); } } /* }}} */ @@ -2427,16 +2427,16 @@ PHP_FUNCTION(mysql_fetch_field) #endif add_property_stringl(return_value, "table", (mysql_field->table?mysql_field->table:""), mysql_field->table_length); add_property_stringl(return_value, "def", (mysql_field->def?mysql_field->def:""), mysql_field->def_length); - add_property_long(return_value, "max_length", mysql_field->max_length); - add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); - add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); - add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); - add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); - add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); + add_property_int(return_value, "max_length", mysql_field->max_length); + add_property_int(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); + add_property_int(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); + add_property_int(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); + add_property_int(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); + add_property_int(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); + add_property_int(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type)); - add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); - add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); + add_property_int(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); + add_property_int(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); } /* }}} */ @@ -2506,7 +2506,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) RETVAL_STRING(mysql_field->table); break; case PHP_MYSQL_FIELD_LEN: - RETVAL_LONG(mysql_field->length); + RETVAL_INT(mysql_field->length); break; case PHP_MYSQL_FIELD_TYPE: RETVAL_STRING(php_mysql_get_field_name(mysql_field->type)); diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 02e6898f7f..f70c0a1d4d 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -612,7 +612,7 @@ PHP_MINIT_FUNCTION(mysqli) mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); #endif mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_int(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED TSRMLS_CC); REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, mysqli_driver_methods); @@ -694,179 +694,179 @@ PHP_MINIT_FUNCTION(mysqli) zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties); /* mysqli_options */ - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); #if defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MYSQLND_STRING_TO_INT_CONVERSION - REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); #endif /* mysqli_real_connect flags */ - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_query */ - REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); #if defined (MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_fetch_assoc */ - REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); /* for mysqli_stmt_set_attr */ - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); #endif /* column information */ - REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); #endif #if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); /* bind support */ - REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); #ifdef MYSQL_DATA_TRUNCATED - REGISTER_LONG_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); #endif /* reporting */ - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); /* We use non-nested macros with expansion, as VC has problems */ #ifdef MYSQLI_USE_MYSQLND - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); #else #ifdef DBUG_ON - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); #endif #endif - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); #ifdef SERVER_QUERY_WAS_SLOW - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); #endif #ifdef SERVER_PS_OUT_PARAMS - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); #ifdef REFRESH_BACKUP_LOG - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); #ifdef MYSQLI_USE_MYSQLND diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 254bae1695..44a252f2d2 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -152,9 +152,9 @@ PHP_FUNCTION(mysqli_affected_rows) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - MYSQLI_RETURN_LONG_LONG(rc); + MYSQLI_RETURN_INT_INT(rc); } /* }}} */ @@ -218,7 +218,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in #elif SIZEOF_LONG==4 bind[ofs].buffer_type = MYSQL_TYPE_LONG; #endif - bind[ofs].buffer = &Z_LVAL_P(param); + bind[ofs].buffer = &Z_IVAL_P(param); bind[ofs].is_null = &stmt->param.is_null[ofs]; break; @@ -443,7 +443,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un case MYSQL_TYPE_LONG: case MYSQL_TYPE_INT24: case MYSQL_TYPE_YEAR: - stmt->result.buf[ofs].type = IS_LONG; + stmt->result.buf[ofs].type = IS_INT; /* don't set stmt->result.buf[ofs].buflen to 0, we used ecalloc */ stmt->result.buf[ofs].val = (char *)emalloc(sizeof(int)); bind[ofs].buffer_type = MYSQL_TYPE_LONG; @@ -843,7 +843,7 @@ PHP_FUNCTION(mysqli_errno) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_errno(mysql->mysql)); + RETURN_INT(mysql_errno(mysql->mysql)); } /* }}} */ @@ -911,7 +911,7 @@ PHP_FUNCTION(mysqli_stmt_execute) case MYSQL_TYPE_VAR_STRING: convert_to_string_ex(param); stmt->stmt->params[i].buffer = Z_STRVAL_P(param); - stmt->stmt->params[i].buffer_length = Z_STRLEN_P(param); + stmt->stmt->params[i].buffer_length = Z_STRSIZE_P(param); break; case MYSQL_TYPE_DOUBLE: convert_to_double_ex(param); @@ -919,8 +919,8 @@ PHP_FUNCTION(mysqli_stmt_execute) break; case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONG: - convert_to_long_ex(param); - stmt->stmt->params[i].buffer = &Z_LVAL_P(param); + convert_to_int_ex(param); + stmt->stmt->params[i].buffer = &Z_IVAL_P(param); break; default: break; @@ -990,7 +990,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) zval_ptr_dtor(result); if (!stmt->result.is_null[i]) { switch (stmt->result.buf[i].type) { - case IS_LONG: + case IS_INT: if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG) && (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)) { @@ -1015,9 +1015,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) #endif } if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) { - ZVAL_LONG(result, *(unsigned int *)stmt->result.buf[i].val); + ZVAL_INT(result, *(unsigned int *)stmt->result.buf[i].val); } else { - ZVAL_LONG(result, *(int *)stmt->result.buf[i].val); + ZVAL_INT(result, *(int *)stmt->result.buf[i].val); } break; case IS_DOUBLE: @@ -1063,7 +1063,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) snprintf(tmp, sizeof(tmp), (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval); ZVAL_STRING(result, tmp); } else { - ZVAL_LONG(result, llval); + ZVAL_INT(result, llval); } } else { #if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 @@ -1166,12 +1166,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML */ add_property_string(value, "catalog", "def"); - add_property_long(value, "max_length", field->max_length); - add_property_long(value, "length", field->length); - add_property_long(value, "charsetnr", field->charsetnr); - add_property_long(value, "flags", field->flags); - add_property_long(value, "type", field->type); - add_property_long(value, "decimals", field->decimals); + add_property_int(value, "max_length", field->max_length); + add_property_int(value, "length", field->length); + add_property_int(value, "charsetnr", field->charsetnr); + add_property_int(value, "flags", field->flags); + add_property_int(value, "type", field->type); + add_property_int(value, "decimals", field->decimals); } /* }}} */ @@ -1278,7 +1278,7 @@ PHP_FUNCTION(mysqli_fetch_lengths) array_init(return_value); for (i = 0; i < mysql_num_fields(result); i++) { - add_index_long(return_value, i, ret[i]); + add_index_int(return_value, i, ret[i]); } } /* }}} */ @@ -1304,7 +1304,7 @@ PHP_FUNCTION(mysqli_field_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_field_count(mysql->mysql)); + RETURN_INT(mysql_field_count(mysql->mysql)); } /* }}} */ @@ -1344,7 +1344,7 @@ PHP_FUNCTION(mysqli_field_tell) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_field_tell(result)); + RETURN_INT(mysql_field_tell(result)); } /* }}} */ @@ -1380,7 +1380,7 @@ PHP_FUNCTION(mysqli_get_client_info) Get MySQL client info */ PHP_FUNCTION(mysqli_get_client_version) { - RETURN_LONG((long)mysql_get_client_version()); + RETURN_INT((long)mysql_get_client_version()); } /* }}} */ @@ -1414,7 +1414,7 @@ PHP_FUNCTION(mysqli_get_proto_info) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_get_proto_info(mysql->mysql)); + RETURN_INT(mysql_get_proto_info(mysql->mysql)); } /* }}} */ @@ -1450,7 +1450,7 @@ PHP_FUNCTION(mysqli_get_server_version) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_get_server_version(mysql->mysql)); + RETURN_INT(mysql_get_server_version(mysql->mysql)); } /* }}} */ @@ -1540,7 +1540,7 @@ PHP_FUNCTION(mysqli_insert_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); rc = mysql_insert_id(mysql->mysql); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -1658,7 +1658,7 @@ PHP_FUNCTION(mysqli_num_fields) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_num_fields(result)); + RETURN_INT(mysql_num_fields(result)); } /* }}} */ @@ -1676,10 +1676,10 @@ PHP_FUNCTION(mysqli_num_rows) if (mysqli_result_is_unbuffered_and_not_everything_is_fetched(result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); - RETURN_LONG(0); + RETURN_INT(0); } - MYSQLI_RETURN_LONG_LONG(mysql_num_rows(result)); + MYSQLI_RETURN_INT_INT(mysql_num_rows(result)); } /* }}} */ @@ -1725,12 +1725,12 @@ static int mysqli_options_get_option_zval_type(int option) case MYSQL_OPT_COMPRESS: #endif /* mysqlnd @ PHP 5.3.2 */ #ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT - REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif /* MySQL 5.1.1., mysqlnd @ PHP 5.3.3 */ #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS: #endif - return IS_LONG; + return IS_INT; #ifdef MYSQL_SHARED_MEMORY_BASE_NAME case MYSQL_SHARED_MEMORY_BASE_NAME: @@ -1786,8 +1786,8 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: convert_to_string_ex(mysql_value); break; - case IS_LONG: - convert_to_long_ex(mysql_value); + case IS_INT: + convert_to_int_ex(mysql_value); break; default: break; @@ -1797,8 +1797,8 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_P(mysql_value)); break; - case IS_LONG: - l_value = Z_LVAL_P(mysql_value); + case IS_INT: + l_value = Z_IVAL_P(mysql_value); ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value); break; default: @@ -2037,9 +2037,9 @@ PHP_FUNCTION(mysqli_stmt_affected_rows) rc = mysql_stmt_affected_rows(stmt->stmt); if (rc == (my_ulonglong) -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2097,7 +2097,7 @@ PHP_FUNCTION(mysqli_stmt_field_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_stmt_field_count(stmt->stmt)); + RETURN_INT(mysql_stmt_field_count(stmt->stmt)); } /* }}} */ @@ -2131,7 +2131,7 @@ PHP_FUNCTION(mysqli_stmt_insert_id) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_insert_id(stmt->stmt); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2147,7 +2147,7 @@ PHP_FUNCTION(mysqli_stmt_param_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_stmt_param_count(stmt->stmt)); + RETURN_INT(mysql_stmt_param_count(stmt->stmt)); } /* }}} */ @@ -2186,7 +2186,7 @@ PHP_FUNCTION(mysqli_stmt_num_rows) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_num_rows(stmt->stmt); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2380,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get) if (attr == STMT_ATTR_UPDATE_MAX_LENGTH) value = *((my_bool *)&value); #endif - RETURN_LONG((long)value); + RETURN_INT((long)value); } /* }}} */ @@ -2396,7 +2396,7 @@ PHP_FUNCTION(mysqli_stmt_errno) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); - RETURN_LONG(mysql_stmt_errno(stmt->stmt)); + RETURN_INT(mysql_stmt_errno(stmt->stmt)); } /* }}} */ @@ -2619,7 +2619,7 @@ PHP_FUNCTION(mysqli_thread_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG((long) mysql_thread_id(mysql->mysql)); + RETURN_INT((long) mysql_thread_id(mysql->mysql)); } /* }}} */ @@ -2672,7 +2672,7 @@ PHP_FUNCTION(mysqli_warning_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_warning_count(mysql->mysql)); + RETURN_INT(mysql_warning_count(mysql->mysql)); } /* }}} */ diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c index cb8a477be4..a895fd0bae 100644 --- a/ext/mysqli/mysqli_driver.c +++ b/ext/mysqli/mysqli_driver.c @@ -39,21 +39,21 @@ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ #define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_LVAL_P(value) > 0; \ + MyG(value) = Z_IVAL_P(value) > 0; \ return SUCCESS; \ } \ #define MAP_PROPERTY_MYG_LONG_READ(name, value) \ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ { \ - ZVAL_LONG(retval, MyG(value)); \ + ZVAL_INT(retval, MyG(value)); \ return retval; \ } \ #define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_LVAL_P(value); \ + MyG(value) = Z_IVAL_P(value); \ return SUCCESS; \ } \ @@ -74,7 +74,7 @@ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ /* {{{ property driver_report_write */ static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC) { - MyG(report_mode) = Z_LVAL_P(value); + MyG(report_mode) = Z_IVAL_P(value); /*FIXME*/ /* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); */ return SUCCESS; @@ -96,7 +96,7 @@ static zval *driver_embedded_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_client_version_read */ static zval *driver_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQL_VERSION_ID); + ZVAL_INT(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -112,7 +112,7 @@ static zval *driver_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_driver_version_read */ static zval *driver_driver_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQLI_VERSION_ID); + ZVAL_INT(retval, MYSQLI_VERSION_ID); return retval; } /* }}} */ diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c index 30ed75ddb7..191a16ce31 100644 --- a/ext/mysqli/mysqli_exception.c +++ b/ext/mysqli/mysqli_exception.c @@ -68,7 +68,7 @@ void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char } efree(message); - zend_update_property_long(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); + zend_update_property_int(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); zend_throw_exception_object(&sql_ex TSRMLS_CC); } diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index c274c98056..b4822a4c41 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -321,7 +321,7 @@ PHP_FUNCTION(mysqli_link_construct) Returns the numerical value of the error message from last connect command */ PHP_FUNCTION(mysqli_connect_errno) { - RETURN_LONG(MyG(error_no)); + RETURN_INT(MyG(error_no)); } /* }}} */ @@ -428,7 +428,7 @@ PHP_FUNCTION(mysqli_error_list) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -438,7 +438,7 @@ PHP_FUNCTION(mysqli_error_list) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(return_value, &single_error); @@ -469,7 +469,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -479,7 +479,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(return_value, &single_error); @@ -795,7 +795,7 @@ PHP_FUNCTION(mysqli_poll) efree(new_e_array); } if (ret == PASS) { - RETURN_LONG(desc_num); + RETURN_INT(desc_num); } else { RETURN_FALSE; } @@ -1009,10 +1009,10 @@ PHP_FUNCTION(mysqli_get_charset) add_property_string(return_value, "charset", (name) ? (char *)name : ""); add_property_string(return_value, "collation",(collation) ? (char *)collation : ""); add_property_string(return_value, "dir", (dir) ? (char *)dir : ""); - add_property_long(return_value, "min_length", minlength); - add_property_long(return_value, "max_length", maxlength); - add_property_long(return_value, "number", number); - add_property_long(return_value, "state", state); + add_property_int(return_value, "min_length", minlength); + add_property_int(return_value, "max_length", maxlength); + add_property_int(return_value, "number", number); + add_property_int(return_value, "state", state); add_property_string(return_value, "comment", (comment) ? (char *)comment : ""); } /* }}} */ @@ -1190,9 +1190,9 @@ PHP_FUNCTION(mysqli_get_links_stats) return; } array_init(return_value); - add_assoc_long_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); - add_assoc_long_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); - add_assoc_long_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); + add_assoc_int_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); + add_assoc_int_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); + add_assoc_int_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); } /* }}} */ diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index f49236358e..ff81a2cac4 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -96,10 +96,10 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC mysql->multi_query = 1; \ } -#define MYSQLI_RETURN_LONG_LONG(__val) \ +#define MYSQLI_RETURN_INT_INT(__val) \ { \ if ((__val) < LONG_MAX) { \ - RETURN_LONG((long) (__val)); \ + RETURN_INT((long) (__val)); \ } else { \ /* always used with my_ulonglong -> %llu */ \ RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \ diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index cd0639d98f..41f0dd6406 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -72,7 +72,7 @@ if (!obj->ptr) { \ p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt;\ } -#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ +#define MYSQLI_MAP_PROPERTY_FUNC_INT( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ {\ __ret_type l;\ @@ -82,7 +82,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ } else {\ l = (__ret_type)__int_func(p);\ if (l < LONG_MAX) {\ - ZVAL_LONG(retval, (long) l);\ + ZVAL_INT(retval, (long) l);\ } else { \ ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \ } \ @@ -111,7 +111,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC)\ /* {{{ property link_client_version_read */ static zval *link_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQL_VERSION_ID); + ZVAL_INT(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -128,7 +128,7 @@ static zval *link_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property link_connect_errno_read */ static zval *link_connect_errno_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, (long)MyG(error_no)); + ZVAL_INT(retval, (long)MyG(error_no)); return retval; } /* }}} */ @@ -163,12 +163,12 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - ZVAL_LONG(retval, -1); + ZVAL_INT(retval, -1); return retval; } if (rc < LONG_MAX) { - ZVAL_LONG(retval, (long) rc); + ZVAL_INT(retval, (long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -198,7 +198,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -208,7 +208,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(retval, &single_error); @@ -221,18 +221,18 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* }}} */ /* link properties */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") /* {{{ property link_stat_read */ static zval *link_stat_read(mysqli_object *obj, zval *retval TSRMLS_DC) @@ -279,7 +279,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); + ZVAL_INT(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); } return retval; } @@ -303,16 +303,16 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) array_init(retval); for (i = 0; i < field_count; i++) { - add_index_long(retval, i, ret[i]); + add_index_int(retval, i, ret[i]); } } return retval; } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) /* statement properties */ @@ -328,7 +328,7 @@ static zval *stmt_id_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt)); + ZVAL_INT(retval, mysqli_stmt_get_id(p->stmt)); } return retval; } @@ -350,12 +350,12 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_stmt_affected_rows(p->stmt); if (rc == (my_ulonglong) -1) { - ZVAL_LONG(retval, -1); + ZVAL_INT(retval, -1); return retval; } if (rc < LONG_MAX) { - ZVAL_LONG(retval, (long) rc); + ZVAL_INT(retval, (long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -384,7 +384,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -394,7 +394,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(retval, &single_error); @@ -405,11 +405,11 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index 615ba94bbf..c60946b449 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -141,7 +141,7 @@ static void php_mysqli_result_iterator_current_key(zend_object_iterator *iter, z { php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter; - ZVAL_LONG(key, iterator->row_num); + ZVAL_INT(key, iterator->row_num); } /* }}} */ diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c index afcc05c16f..3c86bee800 100644 --- a/ext/mysqli/mysqli_warning.c +++ b/ext/mysqli/mysqli_warning.c @@ -108,7 +108,7 @@ MYSQLI_WARNING *php_new_warning(const zval * reason, int errorno TSRMLS_DC) ZVAL_DUP(&w->reason, (zval *)reason); convert_to_string(&w->reason); - //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRLEN(w->reason), ZSTR_AUTOFREE); + //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRSIZE(w->reason), ZSTR_AUTOFREE); ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE); @@ -146,8 +146,8 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql TSRMLS_DC) /* 1. Here comes the error no */ entry = zend_hash_get_current_data(Z_ARRVAL(row)); - convert_to_long_ex(entry); - errno = Z_LVAL_P(entry); + convert_to_int_ex(entry); + errno = Z_IVAL_P(entry); zend_hash_move_forward(Z_ARRVAL(row)); /* 2. Here comes the reason */ @@ -243,7 +243,7 @@ zval *mysqli_warning_errno(mysqli_object *obj, zval *retval TSRMLS_DC) return NULL; } w = (MYSQLI_WARNING *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; - ZVAL_LONG(retval, w->errorno); + ZVAL_INT(retval, w->errorno); return retval; } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 986a664410..33c78f1bbe 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + unsigned long len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -905,8 +905,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, unsigned i #endif if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { - meta->fields[i].max_length = Z_STRLEN_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { + meta->fields[i].max_length = Z_STRSIZE_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1093,8 +1093,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { - meta->fields[i].max_length = Z_STRLEN_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { + meta->fields[i].max_length = Z_STRSIZE_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 746cf01a26..6f160d2223 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne #endif /* #if SIZEOF_LONG==4 */ { if (byte_count < 8 || uval <= L64(9223372036854775807)) { - ZVAL_LONG(zv, (long) uval); /* the cast is safe, we are in the range */ + ZVAL_INT(zv, (long) uval); /* the cast is safe, we are in the range */ } else { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); @@ -112,7 +112,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne } else #endif /* SIZEOF */ { - ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are in the range */ + ZVAL_INT(zv, (long) lval); /* the cast is safe, we are in the range */ } } @@ -406,32 +406,32 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float; @@ -495,7 +495,7 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].func = ps_fetch_bit; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].pack_len = 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_VAR_STRING].func = ps_fetch_string; @@ -610,7 +610,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie ZVAL_DEREF(parameter); if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) { /* always copy the var, because we do many conversions */ - if (Z_TYPE_P(parameter) != IS_LONG && + if (Z_TYPE_P(parameter) != IS_INT && PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i TSRMLS_CC)) { SET_OOM_ERROR(*stmt->error_info); @@ -620,7 +620,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_LONG) { + if (Z_TYPE_P(parameter) != IS_INT) { zval *tmp_data = (*copies_param && !Z_ISUNDEF((*copies_param)[i]))? &(*copies_param)[i]: parameter; /* Because converting to double and back to long can lead @@ -640,7 +640,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie stmt->send_types_to_server = *resend_types_next_time = 1; convert_to_string_ex(tmp_data); } else { - convert_to_long_ex(tmp_data); + convert_to_int_ex(tmp_data); } zval_ptr_dtor(&tmp_data_copy); @@ -674,17 +674,17 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_LONG) { + if (Z_TYPE_P(parameter) != IS_INT) { const zval *tmp_data = (copies && !Z_ISUNDEF(copies[i]))? &copies[i] : parameter; /* - In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type. + In case of IS_INT we do nothing, it is ok, in case of string, we just need to set current_type. The actual transformation has been performed several dozens line above. */ if (Z_TYPE_P(tmp_data) == IS_STRING) { current_type = MYSQL_TYPE_VAR_STRING; /* don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING - we force convert_to_long_ex in all cases, thus the type will be right in the next switch. + we force convert_to_int_ex in all cases, thus the type will be right in the next switch. if the type is however not long, then we will do a goto in the next switch. We want to preserve the original bind type given by the user. Thus, we do these hacks. */ @@ -751,7 +751,7 @@ mysqlnd_stmt_execute_calculate_param_values_size(MYSQLND_STMT_DATA * stmt, zval if (Z_TYPE_P(tmp_data) == IS_STRING) { goto use_string; } - convert_to_long_ex(tmp_data); + convert_to_int_ex(tmp_data); } *data_size += 4 + is_longlong; break; @@ -778,7 +778,7 @@ use_string: the_var = &((*copies_param)[i]); } convert_to_string_ex(the_var); - *data_size += Z_STRLEN_P(the_var); + *data_size += Z_STRSIZE_P(the_var); break; } } @@ -814,7 +814,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int8store(*p, Z_LVAL_P(data)); + int8store(*p, Z_IVAL_P(data)); (*p) += 8; break; case MYSQL_TYPE_LONG: @@ -822,7 +822,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int4store(*p, Z_LVAL_P(data)); + int4store(*p, Z_IVAL_P(data)); (*p) += 4; break; case MYSQL_TYPE_LONG_BLOB: @@ -836,7 +836,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, case MYSQL_TYPE_VAR_STRING: send_string: { - size_t len = Z_STRLEN_P(data); + size_t len = Z_STRSIZE_P(data); /* to is after p. The latter hasn't been moved */ *p = php_mysqlnd_net_store_length(*p, len); memcpy(*p, Z_STRVAL_P(data), len); diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 0641d504c6..8fb89fddf8 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(data_cursor[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(data_cursor[i]); + unsigned long len = Z_STRSIZE(data_cursor[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + unsigned long len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -735,7 +735,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; /* BEGIN difference between normal normal fetch and _c */ if (Z_TYPE_P(data) != IS_NULL) { @@ -853,7 +853,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + unsigned long len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1017,7 +1017,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (Z_TYPE_P(data) != IS_NULL) { convert_to_string(data); @@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + unsigned long len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1104,7 +1104,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + unsigned long len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1199,7 +1199,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 2aa7afde0d..a67ff39080 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -586,7 +586,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRLEN_P(entry_value); + size_t value_len = Z_STRSIZE_P(entry_value); ca_payload_len += php_mysqlnd_net_store_length_size(key->len); ca_payload_len += key->len; @@ -625,7 +625,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRLEN_P(entry_value); + size_t value_len = Z_STRSIZE_P(entry_value); /* copy key */ p = php_mysqlnd_net_store_length(p, key->len); @@ -1587,7 +1587,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_PS, (Z_TYPE_P(current_field) == IS_STRING)? - Z_STRLEN_P(current_field) : (p - orig_p)); + Z_STRSIZE_P(current_field) : (p - orig_p)); if (!((bit<<=1) & 255)) { bit = 1; /* to the following byte */ @@ -1667,7 +1667,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len); } #ifdef MYSQLND_STRING_TO_INT_CONVERSION - if (as_int_or_float && perm_bind.php_type == IS_LONG) { + if (as_int_or_float && perm_bind.php_type == IS_INT) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\0'; @@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, #else _atoi64((char *) p); #endif - ZVAL_LONG(current_field, (long) v); /* the cast is safe */ + ZVAL_INT(current_field, (long) v); /* the cast is safe */ } else { uint64_t v = #ifndef PHP_WIN32 @@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, { ZVAL_STRINGL(current_field, (char *)p, len); } else { - ZVAL_LONG(current_field, (long) v); /* the cast is safe */ + ZVAL_INT(current_field, (long) v); /* the cast is safe */ } } *(p + len) = save; @@ -1730,12 +1730,12 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, later in this function there will be an advancement. */ p -= len; - if (Z_TYPE_P(current_field) == IS_LONG) { - bit_area += 1 + sprintf((char *)start, "%ld", Z_LVAL_P(current_field)); + if (Z_TYPE_P(current_field) == IS_INT) { + bit_area += 1 + sprintf((char *)start, "%ld", Z_IVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); } else if (Z_TYPE_P(current_field) == IS_STRING){ - memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); - bit_area += Z_STRLEN_P(current_field); + memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field)); + bit_area += Z_STRSIZE_P(current_field); *bit_area++ = '\0'; zval_dtor(current_field); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index f05c0e8109..73f0c7f682 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1207,92 +1207,92 @@ PHP_MINIT_FUNCTION(oci) oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC); /* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */ - REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); /* for $LOB->seek() */ - REGISTER_LONG_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); /* for $LOB->flush() */ - REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); /* for OCIBindByName (real "oci" names + short "php" names */ - REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 10) - REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); #endif #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_LONG_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE", CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_LONG_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif /* for OCIFetchStatement */ - REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); /* for OCIFetchInto & OCIResult */ - REGISTER_LONG_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); /* for OCINewDescriptor (real "oci" names + short "php" names */ - REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); /* for OCIWriteTemporaryLob */ - REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2791,7 +2791,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg /* Only for ocifetchinto BC. In all other cases we return array, not long */ REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */ zval_dtor(return_value); - RETURN_LONG(statement->ncolumns); + RETURN_INT(statement->ncolumns); } } /* }}} */ diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 198493b946..985fd973c8 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -402,7 +402,7 @@ PHP_FUNCTION(oci_lob_tell) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - RETURN_LONG(descriptor->lob_current_position); + RETURN_INT(descriptor->lob_current_position); } /* }}} */ @@ -508,7 +508,7 @@ PHP_FUNCTION(oci_lob_size) if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(lob_length); + RETURN_INT(lob_length); } /* }}} */ @@ -550,13 +550,13 @@ PHP_FUNCTION(oci_lob_write) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); if (data_len <= 0) { - RETURN_LONG(0); + RETURN_INT(0); } if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(bytes_written); + RETURN_INT(bytes_written); } /* }}} */ @@ -689,7 +689,7 @@ PHP_FUNCTION(oci_lob_erase) if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(bytes_erased); + RETURN_INT(bytes_erased); } /* }}} */ @@ -1161,9 +1161,9 @@ PHP_FUNCTION(oci_field_size) if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { /* Handle data type of LONG */ if (column->data_type == SQLT_LNG){ - RETURN_LONG(column->storage_size4); + RETURN_INT(column->storage_size4); } - RETURN_LONG(column->data_size); + RETURN_INT(column->data_size); } RETURN_FALSE; } @@ -1176,7 +1176,7 @@ PHP_FUNCTION(oci_field_scale) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->scale); + RETURN_INT(column->scale); } RETURN_FALSE; } @@ -1189,7 +1189,7 @@ PHP_FUNCTION(oci_field_precision) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->precision); + RETURN_INT(column->precision); } RETURN_FALSE; } @@ -1270,7 +1270,7 @@ PHP_FUNCTION(oci_field_type) RETVAL_STRING("ROWID",1); break; default: - RETVAL_LONG(column->data_type); + RETVAL_INT(column->data_type); } } /* }}} */ @@ -1283,7 +1283,7 @@ PHP_FUNCTION(oci_field_type_raw) column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (column) { - RETURN_LONG(column->data_type); + RETURN_INT(column->data_type); } RETURN_FALSE; } @@ -1405,7 +1405,7 @@ PHP_FUNCTION(oci_fetch_all) while (skip--) { if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_LONG(0); + RETURN_INT(0); } } @@ -1484,7 +1484,7 @@ PHP_FUNCTION(oci_fetch_all) efree(outarrs); } - RETURN_LONG(rows); + RETURN_INT(rows); } /* }}} */ @@ -1659,11 +1659,11 @@ go_out: if (errcode) { array_init(return_value); - add_assoc_long(return_value, "code", errcode); + add_assoc_int(return_value, "code", errcode); // TODO: avoid reallocation ??? add_assoc_string(return_value, "message", (char*) errbuf); efree(errbuf); - add_assoc_long(return_value, "offset", error_offset); + add_assoc_int(return_value, "offset", error_offset); add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : ""); } else { RETURN_FALSE; @@ -1684,7 +1684,7 @@ PHP_FUNCTION(oci_num_fields) PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - RETURN_LONG(statement->ncolumns); + RETURN_INT(statement->ncolumns); } /* }}} */ @@ -2156,7 +2156,7 @@ PHP_FUNCTION(oci_num_rows) if (php_oci_statement_get_numrows(statement, &rowcount TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(rowcount); + RETURN_INT(rowcount); } /* }}} */ @@ -2353,7 +2353,7 @@ PHP_FUNCTION(oci_collection_size) if (php_oci_collection_size(collection, &size TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -2381,7 +2381,7 @@ PHP_FUNCTION(oci_collection_max) if (php_oci_collection_max(collection, &max TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(max); + RETURN_INT(max); } /* }}} */ diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index f9d2a3a0ff..16fe457433 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -976,16 +976,16 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) zval_dtor(val); ZVAL_NULL(val); } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRLEN_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\0') { + && Z_STRSIZE_P(bind->zval) > 0 + && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') { /* The post- PHP 5.3 feature for "interned" strings disallows * their reallocation but (i) any IN binds either interned or * not should already be null terminated and (ii) for OUT * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; + Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1); + Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { int i; zval **entry; @@ -1000,10 +1000,10 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) for (i = 0; i < bind->array.current_length; i++) { if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); - ZVAL_LONG(*entry, ((ub4 *)(bind->array.elements))[i]); + ZVAL_INT(*entry, ((ub4 *)(bind->array.elements))[i]); zend_hash_move_forward(hash); } else { - add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]); + add_next_index_int(bind->zval, ((ub4 *)(bind->array.elements))[i]); } } break; @@ -1143,8 +1143,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind"); return 1; } - convert_to_long(var); - bind_data = (ub4 *)&Z_LVAL_P(var); + convert_to_int(var); + bind_data = (ub4 *)&Z_IVAL_P(var); value_sz = sizeof(ub4); mode = OCI_DEFAULT; break; @@ -1162,7 +1162,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, convert_to_string(var); } if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; + value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0; } else { value_sz = maxlength; } @@ -1190,7 +1190,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, return 1; } convert_to_boolean(var); - bind_data = (int *)&Z_LVAL_P(var); + bind_data = (int *)&Z_IVAL_P(var); value_sz = sizeof(int); mode = OCI_DEFAULT; @@ -1332,7 +1332,7 @@ sb4 php_oci_bind_in_callback( convert_to_string(val); *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); + *alenp = Z_STRSIZE_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1414,11 +1414,11 @@ sb4 php_oci_bind_out_callback( convert_to_string(val); zval_dtor(val); - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); + Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); + *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval); *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; @@ -1453,7 +1453,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME } if (Z_TYPE_P(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC); + column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC); if (!column) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index)); return NULL; @@ -1463,10 +1463,10 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME /* NB: for PHP4 compat only, it should be using 'Z' instead */ tmp = *column_index; zval_copy_ctor(&tmp); - convert_to_long(&tmp); - column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC); + convert_to_int(&tmp); + column = php_oci_statement_get_column(statement, Z_IVAL(tmp), NULL, 0 TSRMLS_CC); if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_IVAL(tmp)); zval_dtor(&tmp); return NULL; } @@ -1639,8 +1639,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - if (Z_STRLEN_PP(entry) > maxlength) { - maxlength = Z_STRLEN_PP(entry) + 1; + if (Z_STRSIZE_PP(entry) > maxlength) { + maxlength = Z_STRSIZE_PP(entry) + 1; } zend_hash_move_forward(hash); } @@ -1662,8 +1662,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRLEN_PP(entry); - if (Z_STRLEN_PP(entry) == 0) { + bind->array.element_lengths[i] = Z_STRSIZE_PP(entry); + if (Z_STRSIZE_PP(entry) == 0) { bind->array.indicators[i] = -1; } zend_hash_move_forward(hash); @@ -1678,7 +1678,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, int element_length; convert_to_string_ex(entry); - element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; + element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength; memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; @@ -1720,8 +1720,8 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length bind->array.element_lengths[i] = sizeof(ub4); } if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - convert_to_long_ex(entry); - ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_PP(entry); + convert_to_int_ex(entry); + ((ub4 *)bind->array.elements)[i] = (ub4) Z_IVAL_PP(entry); zend_hash_move_forward(hash); } else { ((ub4 *)bind->array.elements)[i] = 0; @@ -1802,7 +1802,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c index 7bc3833d86..bb8ca9aa24 100644 --- a/ext/odbc/birdstep.c +++ b/ext/odbc/birdstep.c @@ -193,7 +193,7 @@ PHP_MINIT_FUNCTION(birdstep) { SQLAllocEnv(&henv); - if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { + if ( cfg_get_int("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { php_birdstep_module.max_links = -1; } php_birdstep_module.num_links = 0; @@ -316,7 +316,7 @@ PHP_FUNCTION(birdstep_connect) new = (VConn *)emalloc(sizeof(VConn)); ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC); php_birdstep_module.num_links++; - RETURN_LONG(ind); + RETURN_INT(ind); } /* }}} */ @@ -392,7 +392,7 @@ PHP_FUNCTION(birdstep_exec) } SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); - RETURN_LONG(rows); + RETURN_INT(rows); } else { /* Was SELECT query */ res->values = (VResVal *)safe_emalloc(sizeof(VResVal), cols, 0); res->numcols = cols; @@ -418,7 +418,7 @@ PHP_FUNCTION(birdstep_exec) } res->fetched = 0; indx = birdstep_add_result(list,res,conn); - RETURN_LONG(indx); + RETURN_INT(indx); } /* }}} */ @@ -441,13 +441,13 @@ PHP_FUNCTION(birdstep_fetch) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -478,8 +478,8 @@ PHP_FUNCTION(birdstep_result) if ( Z_TYPE_PP(col) == IS_STRING ) { field = Z_STRVAL_PP(col); } else { - convert_to_long_ex(col); - indx = Z_LVAL_PP(col); + convert_to_int_ex(col); + indx = Z_IVAL_PP(col); } if ( field ) { for ( i = 0; i < res->numcols; i++ ) { @@ -502,13 +502,13 @@ PHP_FUNCTION(birdstep_result) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -527,19 +527,19 @@ l1: res->values[indx].value,4095,&res->values[indx].vallen); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { RETURN_STRING(res->values[indx].value,TRUE); } else { - RETURN_LONG((long)res->values[indx].value); + RETURN_INT((long)res->values[indx].value); } default: if ( res->values[indx].value != NULL ) { @@ -696,7 +696,7 @@ PHP_FUNCTION(birdstep_fieldnum) PHP_GET_BIRDSTEP_RES_IDX(ind); - RETURN_LONG(res->numcols); + RETURN_INT(res->numcols); } /* }}} */ diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 10384da2ad..4d144e7776 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -718,84 +718,84 @@ PHP_MINIT_FUNCTION(odbc) odbc_module_entry.type = type; REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); /* Define Constants for options these Constants are defined in <sqlext.h> */ - REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); /* these are for the Data Source type */ - REGISTER_LONG_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); /* * register the standard data types */ - REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); #if defined(ODBCVER) && (ODBCVER >= 0x0300) - REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); /* * SQLSpecialColumns values */ - REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); /* * SQLStatistics values */ - REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); #endif #if defined(HAVE_IBMDB2) && defined(_AIX) @@ -917,7 +917,7 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) return; } - if (Z_LVAL_P(pv_res)) { + if (Z_IVAL_P(pv_res)) { ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); if (mode) { result->longreadlen = flag; @@ -1086,7 +1086,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); - RETURN_LONG(len); + RETURN_INT(len); } /* }}} */ @@ -1301,7 +1301,7 @@ PHP_FUNCTION(odbc_execute) } rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable); - params[i-1].vallen = Z_STRLEN_P(tmp); + params[i-1].vallen = Z_STRSIZE_P(tmp); params[i-1].fp = -1; if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); @@ -1321,14 +1321,14 @@ PHP_FUNCTION(odbc_execute) ctype = SQL_C_CHAR; } - if (Z_STRLEN_P(tmp) > 2 && + if (Z_STRSIZE_P(tmp) > 2 && Z_STRVAL_P(tmp)[0] == '\'' && - Z_STRVAL_P(tmp)[Z_STRLEN_P(tmp) - 1] == '\'') { + Z_STRVAL_P(tmp)[Z_STRSIZE_P(tmp) - 1] == '\'') { if (CHECK_ZVAL_NULL_PATH(tmp)) { RETURN_FALSE; } - filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRLEN_P(tmp) - 2); + filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRSIZE_P(tmp) - 2); filename[strlen(filename)] = '\0'; /* Check the basedir */ @@ -1919,7 +1919,7 @@ PHP_FUNCTION(odbc_fetch_into) zend_hash_index_update(Z_ARRVAL_P(pv_res_arr), i, &tmp); } if (buf) efree(buf); - RETURN_LONG(result->numcols); + RETURN_INT(result->numcols); } /* }}} */ @@ -2035,8 +2035,8 @@ PHP_FUNCTION(odbc_result) if (Z_TYPE_P(pv_field) == IS_STRING) { field = Z_STRVAL_P(pv_field); } else { - convert_to_long_ex(pv_field); - field_ind = Z_LVAL_P(pv_field) - 1; + convert_to_int_ex(pv_field); + field_ind = Z_IVAL_P(pv_field) - 1; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -2231,7 +2231,7 @@ PHP_FUNCTION(odbc_result_all) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { php_printf("<h2>No rows found</h2>\n"); - RETURN_LONG(0); + RETURN_INT(0); } /* Start table tag */ @@ -2315,7 +2315,7 @@ PHP_FUNCTION(odbc_result_all) } php_printf("</table>\n"); if (buf) efree(buf); - RETURN_LONG(result->fetched); + RETURN_INT(result->fetched); } /* }}} */ @@ -2709,7 +2709,7 @@ PHP_FUNCTION(odbc_num_rows) } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); SQLRowCount(result->stmt, &rows); - RETURN_LONG(rows); + RETURN_INT(rows); } /* }}} */ @@ -2774,7 +2774,7 @@ PHP_FUNCTION(odbc_num_fields) return; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); - RETURN_LONG(result->numcols); + RETURN_INT(result->numcols); } /* }}} */ @@ -2893,7 +2893,7 @@ PHP_FUNCTION(odbc_field_num) if (field_ind == -1) { RETURN_FALSE; } - RETURN_LONG(field_ind); + RETURN_INT(field_ind); } /* }}} */ @@ -2928,7 +2928,7 @@ PHP_FUNCTION(odbc_autocommit) odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status"); RETURN_FALSE; } - RETVAL_LONG((long)status); + RETVAL_INT((long)status); } } /* }}} */ diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 32800a1399..fb7e64bb6d 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -644,14 +644,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT && opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) { ZEND_OP1_TYPE(opline) = IS_CONST; - LITERAL_LONG(opline->op1, 1); + LITERAL_INT(opline->op1, 1); } if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR && VAR_SOURCE(opline->op2) && VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) { ZEND_OP2_TYPE(opline) = IS_CONST; - LITERAL_LONG(opline->op2, 1); + LITERAL_INT(opline->op2, 1); } /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */ @@ -706,11 +706,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zend_op *sv = fcall-1; if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(sv) == IS_CONST && Z_TYPE(OPLINE_OP1_LITERAL(sv)) == IS_STRING && - Z_LVAL(OPLINE_OP2_LITERAL(sv)) == 1 + Z_IVAL(OPLINE_OP2_LITERAL(sv)) == 1 ) { zval *arg = &OPLINE_OP1_LITERAL(sv); - char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name; - int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len; + char *fname = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].function_name; + int flen = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].name_len; if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) { zval c; if(zend_get_persistent_constant(Z_STR_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) { @@ -903,8 +903,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) { convert_to_string_safe(&ZEND_OP1_LITERAL(last_op)); } - old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op)); - l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline)); + old_len = Z_STRSIZE(ZEND_OP1_LITERAL(last_op)); + l = old_len + Z_STRSIZE(ZEND_OP1_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(last_op)))) { zend_string *tmp = STR_ALLOC(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len); @@ -913,7 +913,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0); } Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC); @@ -947,8 +947,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, opline->opcode = ZEND_ADD_STRING; } COPY_NODE(opline->op1, src->op1); - old_len = Z_STRLEN(ZEND_OP2_LITERAL(src)); - l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline)); + old_len = Z_STRSIZE(ZEND_OP2_LITERAL(src)); + l = old_len + Z_STRSIZE(ZEND_OP2_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(src)))) { zend_string *tmp = STR_ALLOC(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len); @@ -957,7 +957,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0); } Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC); @@ -972,7 +972,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, continue; } else if (opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) { /* convert ADD_CHAR(C1, C2) to CONCAT(C1, C2) */ - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); opline->opcode = ZEND_CONCAT; continue; @@ -1002,8 +1002,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, int er; if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) && - ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && - Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) || + ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && + Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) || (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_DOUBLE && Z_DVAL(ZEND_OP2_LITERAL(opline)) == 0.0))) { if (RESULT_USED(opline)) { @@ -1062,7 +1062,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, opline->op2); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP1_LITERAL(opline), &c, 1); } SET_UNUSED(opline->op2); @@ -1077,13 +1077,13 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT && ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { + Z_STRSIZE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { /* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */ zend_op *src = VAR_SOURCE(opline->op1); VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; @@ -1119,7 +1119,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 551f439041..e941380738 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -291,7 +291,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } @@ -345,13 +345,13 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } map[i] = l_true; break; - case IS_LONG: - if ((pos = zend_hash_index_find(&hash, Z_LVAL(op_array->literals[i]))) != NULL) { - map[i] = Z_LVAL_P(pos); + case IS_INT: + if ((pos = zend_hash_index_find(&hash, Z_IVAL(op_array->literals[i]))) != NULL) { + map[i] = Z_IVAL_P(pos); } else { map[i] = j; - ZVAL_LONG(&zv, j); - zend_hash_index_update(&hash, Z_LVAL(op_array->literals[i]), &zv); + ZVAL_INT(&zv, j); + zend_hash_index_update(&hash, Z_IVAL(op_array->literals[i]), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; @@ -361,10 +361,10 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c break; case IS_DOUBLE: if ((pos = zend_hash_str_find(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != NULL) { - map[i] = Z_LVAL_P(pos); + map[i] = Z_IVAL_P(pos); } else { map[i] = j; - ZVAL_LONG(&zv, j); + ZVAL_INT(&zv, j); zend_hash_str_add(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; @@ -377,32 +377,32 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c case IS_CONSTANT: if (info[i].flags & LITERAL_MAY_MERGE) { if (info[i].flags & LITERAL_EX_OBJ) { - int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]); + int key_len = MAX_LENGTH_OF_ZEND_INT + sizeof("->") + Z_STRSIZE(op_array->literals[i]); key = STR_ALLOC(key_len, 0); key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i])); } else if (info[i].flags & LITERAL_EX_CLASS) { int key_len; zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num]; - key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]); + key_len = Z_STRSIZE_P(class_name) + sizeof("::") + Z_STRSIZE(op_array->literals[i]); key = STR_ALLOC(key_len, 0); - memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); - memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1); - memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1, + memcpy(key->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); + memcpy(key->val + Z_STRSIZE_P(class_name), "::", sizeof("::") - 1); + memcpy(key->val + Z_STRSIZE_P(class_name) + sizeof("::") - 1, Z_STRVAL(op_array->literals[i]), - Z_STRLEN(op_array->literals[i]) + 1); + Z_STRSIZE(op_array->literals[i]) + 1); } else { - key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0); + key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRSIZE(op_array->literals[i]), 0); } key->h = zend_hash_func(key->val, key->len); key->h += info[i].flags; } if ((info[i].flags & LITERAL_MAY_MERGE) && (pos = zend_hash_find(&hash, key)) != NULL && - Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) && - info[i].flags == info[Z_LVAL_P(pos)].flags) { + Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_IVAL_P(pos)]) && + info[i].flags == info[Z_IVAL_P(pos)].flags) { STR_RELEASE(key); - map[i] = Z_LVAL_P(pos); + map[i] = Z_IVAL_P(pos); zval_dtor(&op_array->literals[i]); n = LITERAL_NUM_RELATED(info[i].flags); while (n > 1) { @@ -413,7 +413,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } else { map[i] = j; if (info[i].flags & LITERAL_MAY_MERGE) { - ZVAL_LONG(&zv, j); + ZVAL_INT(&zv, j); zend_hash_add(&hash, key, &zv); STR_RELEASE(key); } @@ -472,7 +472,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } diff --git a/ext/opcache/Optimizer/nop_removal.c b/ext/opcache/Optimizer/nop_removal.c index 80da02ce32..5f54408d16 100644 --- a/ext/opcache/Optimizer/nop_removal.c +++ b/ext/opcache/Optimizer/nop_removal.c @@ -38,7 +38,7 @@ static void nop_removal(zend_op_array *op_array) /* GOTO target is unresolved yet. We can't optimize. */ if (opline->opcode == ZEND_GOTO && - Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { /* TODO: in general we can avoid this restriction */ FREE_ALLOCA(shiftlist); return; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index ecbfb638a0..f98058fd9e 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -65,8 +65,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { int er; if (opline->opcode == ZEND_DIV && - Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && - Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && + Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) { /* div by 0 */ break; } @@ -103,8 +103,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { case _IS_BOOL: convert_to_boolean(&res); break; - case IS_LONG: - convert_to_long(&res); + case IS_INT: + convert_to_int(&res); break; case IS_DOUBLE: convert_to_double(&res); @@ -174,7 +174,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (next_op->opcode == ZEND_ADD_CHAR) { final_length += 1; } else { /* ZEND_ADD_STRING */ - final_length += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); + final_length += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); } next_op++; } @@ -182,32 +182,32 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } last_op = next_op; - final_length += (requires_conversion? 1 : Z_STRLEN(ZEND_OP2_LITERAL(opline))); + final_length += (requires_conversion? 1 : Z_STRSIZE(ZEND_OP2_LITERAL(opline))); str = STR_ALLOC(final_length, 0); ptr = str->val; ptr[final_length] = '\0'; if (requires_conversion) { /* ZEND_ADD_CHAR */ - char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char chval = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str); ptr[0] = chval; opline->opcode = ZEND_ADD_STRING; ptr++; } else { /* ZEND_ADD_STRING */ - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = str; - ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline)); + ptr += Z_STRSIZE(ZEND_OP2_LITERAL(opline)); } - Z_STRLEN(ZEND_OP2_LITERAL(opline)) = final_length; + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) = final_length; next_op = opline + 1; while (next_op < last_op) { if (next_op->opcode == ZEND_ADD_STRING) { - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRLEN(ZEND_OP2_LITERAL(next_op))); - ptr += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRSIZE(ZEND_OP2_LITERAL(next_op))); + ptr += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); literal_dtor(&ZEND_OP2_LITERAL(next_op)); } else { /* ZEND_ADD_CHAR */ - *ptr = (char)Z_LVAL(ZEND_OP2_LITERAL(next_op)); + *ptr = (char)Z_IVAL(ZEND_OP2_LITERAL(next_op)); ptr++; } MAKE_NOP(next_op); @@ -227,7 +227,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_execute_data *orig_execute_data = EG(current_execute_data); @@ -277,7 +277,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* for A::B */ if (op_array->scope && !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), - op_array->scope->name->val, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) { + op_array->scope->name->val, Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1)) { ce = op_array->scope; } else { if ((ce = zend_hash_find_ptr(EG(class_table), @@ -334,8 +334,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (collect_constants && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && - zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && + zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { if ((opline+1)->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(opline+1) == IS_CONST && @@ -364,17 +364,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { (opline + 2)->opcode == ZEND_DO_FCALL && ZEND_OP1_TYPE(opline + 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) == IS_STRING && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { - if ((Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && + if ((Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "function_exists", sizeof("function_exists")-1)) || - (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && + (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "is_callable", sizeof("is_callable")))) { zend_internal_function *func; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); - if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)))) != NULL && + if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)))) != NULL && func->type == ZEND_INTERNAL_FUNCTION && func->module->type == MODULE_PERSISTENT) { zval t; @@ -388,14 +388,14 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } efree(lc_name); - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "extension_loaded", sizeof("extension_loaded")-1)) { zval t; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); zend_module_entry *m = zend_hash_str_find_ptr(&module_registry, - lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); efree(lc_name); if (!m) { @@ -419,7 +419,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 1); MAKE_NOP(opline + 2); } - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "defined", sizeof("defined")-1)) { zval t; @@ -435,7 +435,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 2); } } - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "constant", sizeof("constant")-1)) { zval t; @@ -450,12 +450,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } } else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "strlen", sizeof("strlen")-1)) { zval t; - ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) { literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); @@ -471,7 +471,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { zval t; - ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline))); + ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline))); replace_tmp_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); @@ -535,7 +535,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->op1_type == IS_CONST && opline->op2_type == IS_UNUSED && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || + (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this") - 1) != 0)) { int var = opline->result.var; diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c index 083a7b961b..1be6b9cb1c 100644 --- a/ext/opcache/Optimizer/pass2.c +++ b/ext/opcache/Optimizer/pass2.c @@ -61,8 +61,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_SL: case ZEND_SR: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) { - convert_to_long(&ZEND_OP1_LITERAL(opline)); + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_INT) { + convert_to_int(&ZEND_OP1_LITERAL(opline)); } } /* break missing *intentionally - the assign_op's may only optimize op2 */ @@ -74,8 +74,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { - convert_to_long(&ZEND_OP2_LITERAL(opline)); + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { + convert_to_int(&ZEND_OP2_LITERAL(opline)); } } break; @@ -183,7 +183,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { if (ZEND_OP2_TYPE(opline) != IS_CONST) { break; } - convert_to_long(&ZEND_OP2_LITERAL(opline)); + convert_to_int(&ZEND_OP2_LITERAL(opline)); nest_levels = ZEND_OP2_LITERAL(opline).value.lval; array_offset = ZEND_OP1(opline).opline_num; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index b783c3777b..bb41900d2e 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -114,9 +114,9 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) return i; } -# define LITERAL_LONG(op, val) do { \ +# define LITERAL_INT(op, val) do { \ zval _c; \ - ZVAL_LONG(&_c, val); \ + ZVAL_INT(&_c, val); \ op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \ } while (0) @@ -155,7 +155,7 @@ static void update_op1_const(zend_op_array *op_array, opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1])); break; @@ -176,7 +176,7 @@ static void update_op2_const(zend_op_array *op_array, { ZEND_OP2_TYPE(opline) = IS_CONST; if (opline->opcode == ZEND_INIT_FCALL) { - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; @@ -200,13 +200,13 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_ADD_INTERFACE: case ZEND_ADD_TRAIT: Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); break; case ZEND_INIT_METHOD_CALL: case ZEND_INIT_STATIC_METHOD_CALL: - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); /* break missing intentionally */ @@ -277,7 +277,7 @@ check_numeric: if (ZEND_HANDLE_NUMERIC(Z_STR_P(val), index)) { zval_dtor(val); - ZVAL_LONG(val, index); + ZVAL_INT(val, index); op_array->literals[opline->op2.constant] = *val; } } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index ebd3844e38..c6a9e1ce43 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -632,7 +632,7 @@ static inline int accel_is_inactive(TSRMLS_D) return FAILURE; } -static int zend_get_stream_timestamp(const char *filename, struct stat *statbuf TSRMLS_DC) +static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf TSRMLS_DC) { php_stream_wrapper *wrapper; php_stream_statbuf stream_statbuf; @@ -715,7 +715,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size TSRMLS_DC) { - struct stat statbuf; + zend_stat_t statbuf; #ifdef ZEND_WIN32 accel_time_t res; #endif @@ -724,7 +724,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle !EG(current_execute_data) && file_handle->filename == SG(request_info).path_translated) { - struct stat *tmpbuf = sapi_module.get_stat(TSRMLS_C); + zend_stat_t *tmpbuf = sapi_module.get_stat(TSRMLS_C); if (tmpbuf) { if (size) { @@ -1959,7 +1959,7 @@ static void accel_fast_zval_dtor(zval *zvalue) zend_list_delete(Z_RES_P(zvalue)); } break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index ff8ace863b..da2c04fdf7 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -315,10 +315,10 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, &zfilename) == FAILURE || Z_TYPE(zfilename) != IS_STRING || - Z_STRLEN(zfilename) == 0) { + Z_STRSIZE(zfilename) == 0) { return 0; } - return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename) TSRMLS_CC); + return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRSIZE(zfilename) TSRMLS_CC); } static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS) @@ -488,16 +488,16 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) array_init(&persistent_script_report); add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0)); - add_assoc_long(&persistent_script_report, "hits", script->dynamic_members.hits); - add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); + add_assoc_int(&persistent_script_report, "hits", script->dynamic_members.hits); + add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); ta = localtime(&script->dynamic_members.last_used); str = asctime(ta); len = strlen(str); if (len > 0 && str[len - 1] == '\n') len--; add_assoc_stringl(&persistent_script_report, "last_used", str, len); - add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); + add_assoc_int(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); if (ZCG(accel_directives).validate_timestamps) { - add_assoc_long(&persistent_script_report, "timestamp", (long)script->timestamp); + add_assoc_int(&persistent_script_report, "timestamp", (long)script->timestamp); } timerclear(&exec_time); timerclear(&fetch_time); @@ -540,9 +540,9 @@ static ZEND_FUNCTION(opcache_get_status) /* Memory usage statistics */ array_init(&memory_usage); - add_assoc_long(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); - add_assoc_long(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); - add_assoc_long(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); + add_assoc_int(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); + add_assoc_int(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); + add_assoc_int(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); add_assoc_double(&memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0); add_assoc_zval(return_value, "memory_usage", &memory_usage); @@ -550,26 +550,26 @@ static ZEND_FUNCTION(opcache_get_status) zval interned_strings_usage; array_init(&interned_strings_usage); - add_assoc_long(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); - add_assoc_long(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); - add_assoc_long(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); - add_assoc_long(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); + add_assoc_int(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); + add_assoc_int(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); + add_assoc_int(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); + add_assoc_int(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); add_assoc_zval(return_value, "interned_strings_usage", &interned_strings_usage); } /* Accelerator statistics */ array_init(&statistics); - add_assoc_long(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); - add_assoc_long(&statistics, "num_cached_keys", ZCSG(hash).num_entries); - add_assoc_long(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); - add_assoc_long(&statistics, "hits", ZCSG(hits)); - add_assoc_long(&statistics, "start_time", ZCSG(start_time)); - add_assoc_long(&statistics, "last_restart_time", ZCSG(last_restart_time)); - add_assoc_long(&statistics, "oom_restarts", ZCSG(oom_restarts)); - add_assoc_long(&statistics, "hash_restarts", ZCSG(hash_restarts)); - add_assoc_long(&statistics, "manual_restarts", ZCSG(manual_restarts)); - add_assoc_long(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); - add_assoc_long(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); + add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); + add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries); + add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); + add_assoc_int(&statistics, "hits", ZCSG(hits)); + add_assoc_int(&statistics, "start_time", ZCSG(start_time)); + add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time)); + add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts)); + add_assoc_int(&statistics, "hash_restarts", ZCSG(hash_restarts)); + add_assoc_int(&statistics, "manual_restarts", ZCSG(manual_restarts)); + add_assoc_int(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); + add_assoc_int(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); reqs = ZCSG(hits)+ZCSG(misses); add_assoc_double(&statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0); add_assoc_double(&statistics, "opcache_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0); @@ -615,17 +615,17 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups); add_assoc_bool(&directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path); - add_assoc_long(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); - add_assoc_long(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); - add_assoc_long(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); - add_assoc_long(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); + add_assoc_int(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); + add_assoc_int(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); + add_assoc_int(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); + add_assoc_int(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); add_assoc_double(&directives, "opcache.max_wasted_percentage", ZCG(accel_directives).max_wasted_percentage); - add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); - add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); - add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); + add_assoc_int(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); + add_assoc_int(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); + add_assoc_int(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model)); add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename)); - add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); + add_assoc_int(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log)); add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory); @@ -633,7 +633,7 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.load_comments", ZCG(accel_directives).load_comments); add_assoc_bool(&directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown); add_assoc_bool(&directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled); - add_assoc_long(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); + add_assoc_int(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); add_assoc_zval(return_value, "directives", &directives); diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index fc16fbeb24..345393f946 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -29,7 +29,7 @@ static zend_uint zend_accel_refcount = ZEND_PROTECTED_REFCOUNT; -#if SIZEOF_SIZE_T <= SIZEOF_LONG +#if SIZEOF_SIZE_T <= SIZEOF_ZEND_INT || defined PHP_WIN32 /* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */ # define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old), (new)) # define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old)) @@ -883,7 +883,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0); if (!zend_hash_exists(EG(zend_constants), name)) { - zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); + zend_register_int_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); } STR_RELEASE(name); } diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index e87a942bfa..9ea33adff1 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -292,7 +292,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc fake_execute_data.func = (zend_function*)op_array; EG(current_execute_data) = &fake_execute_data; if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { - main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset); + main_persistent_script->compiler_halt_offset = Z_IVAL_P(offset); } EG(current_execute_data) = orig_execute_data; } diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 1d75ff08fc..cb522080a7 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -844,8 +844,8 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */ varname = defval #define SET_OPTIONAL_LONG_ARG(key, varname, defval) \ - if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_LONG) \ - varname = Z_LVAL_P(item); \ + if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_INT) \ + varname = Z_IVAL_P(item); \ else \ varname = defval @@ -905,8 +905,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option } if (req->priv_key_encrypt && optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher")-1)) != NULL - && Z_TYPE_P(item) == IS_LONG) { - long cipher_algo = Z_LVAL_P(item); + && Z_TYPE_P(item) == IS_INT) { + long cipher_algo = Z_IVAL_P(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm for private key."); @@ -1130,86 +1130,86 @@ PHP_MINIT_FUNCTION(openssl) ssl_stream_data_index = SSL_get_ex_new_index(0, "PHP stream index", NULL, NULL, NULL); REGISTER_STRING_CONSTANT("OPENSSL_VERSION_TEXT", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); /* purposes for cert purpose checking */ - REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); #ifdef X509_PURPOSE_ANY - REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); #endif /* signature algorithm constants */ - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_OPENSSL_MD2_H - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090708fL - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); #endif /* flags for S/MIME */ - REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); /* Informational stream wrapper constants */ REGISTER_STRING_CONSTANT("OPENSSL_DEFAULT_STREAM_CIPHERS", OPENSSL_DEFAULT_STREAM_CIPHERS, CONST_CS|CONST_PERSISTENT); /* Ciphers */ #ifndef OPENSSL_NO_RC2 - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_DES - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_AES - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); #endif /* Values for key types */ - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); #ifndef NO_DSA - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_EVP_PKEY_EC - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) /* SNI support included in OpenSSL >= 0.9.8j */ - REGISTER_LONG_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); #endif /* Determine default SSL configuration file */ @@ -1361,7 +1361,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso /* force it to be a string and check if it refers to a file */ convert_to_string_ex(val); - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { /* read cert from the named file */ BIO *in; @@ -1378,7 +1378,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso } else { BIO *in; - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); if (in == NULL) { return NULL; } @@ -1474,8 +1474,8 @@ PHP_FUNCTION(openssl_spki_new) } if (method != NULL) { - if (Z_TYPE_P(method) == IS_LONG) { - algo = Z_LVAL_P(method); + if (Z_TYPE_P(method) == IS_INT) { + algo = Z_IVAL_P(method); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Algorithm must be of supported type"); goto cleanup; @@ -1958,22 +1958,22 @@ PHP_FUNCTION(openssl_x509_parse) } add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC); - add_assoc_long(return_value, "version", X509_get_version(cert)); + add_assoc_int(return_value, "version", X509_get_version(cert)); add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert))); add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert)); add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert)); - add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); - add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); + add_assoc_int(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); + add_assoc_int(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); tmpstr = (char *)X509_alias_get0(cert, NULL); if (tmpstr) { add_assoc_string(return_value, "alias", tmpstr); } /* - add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); + add_assoc_int(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert))); add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert))); */ @@ -2145,7 +2145,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) return; } - RETVAL_LONG(-1); + RETVAL_INT(-1); if (untrusted) { untrustedchain = load_all_certs_from_file(untrusted); @@ -2165,7 +2165,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) ret = check_cert(cainfo, cert, untrustedchain, purpose); if (ret != 0 && ret != 1) { - RETVAL_LONG(ret); + RETVAL_INT(ret); } else { RETVAL_BOOL(ret); } @@ -2768,7 +2768,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r return NULL; } - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } if (filename) { @@ -2777,7 +2777,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); BIO_free(in); @@ -3259,7 +3259,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } convert_to_string_ex(val); - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } /* it's an X509 file/cert of some kind, and we need to extract the data from that */ @@ -3273,7 +3273,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p if (filename) { in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } if (in == NULL) { TMP_CLEAN; @@ -3291,7 +3291,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } if (in == NULL) { @@ -3467,7 +3467,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC) Z_TYPE_P(bn) == IS_STRING) { \ _type->_name = BN_bin2bn( \ (unsigned char*)Z_STRVAL_P(bn), \ - Z_STRLEN_P(bn), NULL); \ + Z_STRSIZE_P(bn), NULL); \ } \ } while (0); @@ -3784,7 +3784,7 @@ PHP_FUNCTION(openssl_pkey_get_details) pbio_len = BIO_get_mem_data(out, &pbio); array_init(return_value); - add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey)); + add_assoc_int(return_value, "bits", EVP_PKEY_bits(pkey)); add_assoc_stringl(return_value, "key", pbio, pbio_len); /*TODO: Use the real values once the openssl constants are used * See the enum at the top of this file @@ -3853,7 +3853,7 @@ PHP_FUNCTION(openssl_pkey_get_details) ktype = -1; break; } - add_assoc_long(return_value, "type", ktype); + add_assoc_int(return_value, "type", ktype); BIO_free(out); } @@ -3930,7 +3930,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) char * signersfilename = NULL; int signersfilename_len = 0; char * datafilename = NULL; int datafilename_len = 0; - RETVAL_LONG(-1); + RETVAL_INT(-1); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|papp", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, @@ -4006,7 +4006,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) sk_X509_free(signers); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename); - RETVAL_LONG(-1); + RETVAL_INT(-1); } } goto clean_exit; @@ -4615,9 +4615,9 @@ PHP_FUNCTION(openssl_sign) RETURN_FALSE; } - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { + if (method == NULL || Z_TYPE_P(method) == IS_INT) { if (method != NULL) { - signature_algo = Z_LVAL_P(method); + signature_algo = Z_IVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4672,9 +4672,9 @@ PHP_FUNCTION(openssl_verify) return; } - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { + if (method == NULL || Z_TYPE_P(method) == IS_INT) { if (method != NULL) { - signature_algo = Z_LVAL_P(method); + signature_algo = Z_IVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4702,7 +4702,7 @@ PHP_FUNCTION(openssl_verify) if (keyresource == NULL) { EVP_PKEY_free(pkey); } - RETURN_LONG(err); + RETURN_INT(err); } /* }}} */ @@ -4814,7 +4814,7 @@ PHP_FUNCTION(openssl_seal) } else { efree(buf); } - RETVAL_LONG(len1 + len2); + RETVAL_INT(len1 + len2); EVP_CIPHER_CTX_cleanup(&ctx); clean_exit: @@ -5208,7 +5208,7 @@ PHP_FUNCTION(openssl_cipher_iv_length) RETURN_FALSE; } - RETURN_LONG(EVP_CIPHER_iv_length(cipher_type)); + RETURN_INT(EVP_CIPHER_iv_length(cipher_type)); } /* }}} */ diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index f706e0d5a2..6975dc89c4 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -69,7 +69,7 @@ /* Simplify ssl context option retrieval */ #define GET_VER_OPT(name) (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", name)) != NULL) #define GET_VER_OPT_STRING(name, str) if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_P(val); } -#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_long_ex(val); num = Z_LVAL_P(val); } +#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_int_ex(val); num = Z_IVAL_P(val); } /* Used for peer verification in windows */ #define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i))) @@ -282,7 +282,7 @@ static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val TSRMLS_DC) if (Z_TYPE_P(val) == IS_STRING) { const char *method = NULL; - switch (Z_STRLEN_P(val)) { + switch (Z_STRSIZE_P(val)) { case 32: method = "md5"; break; @@ -513,9 +513,9 @@ static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */ GET_VER_OPT_STRING("passphrase", passphrase); if (passphrase) { - if (Z_STRLEN_P(val) < num - 1) { - memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)+1); - return Z_STRLEN_P(val); + if (Z_STRSIZE_P(val) < num - 1) { + memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)+1); + return Z_STRSIZE_P(val); } } return 0; @@ -1032,8 +1032,8 @@ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_da NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit")) ) { - convert_to_long(val); - limit = Z_LVAL_P(val); + convert_to_int(val); + limit = Z_IVAL_P(val); } /* No renegotiation rate-limiting */ @@ -1045,8 +1045,8 @@ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_da NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_window")) ) { - convert_to_long(val); - window = Z_LVAL_P(val); + convert_to_int(val); + window = Z_IVAL_P(val); } sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t), @@ -1070,7 +1070,7 @@ static int set_server_rsa_key(php_stream *stream, SSL_CTX *ctx TSRMLS_DC) /* {{{ RSA* rsa; if ((val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size")) != NULL) { - rsa_key_size = (int) Z_LVAL_P(val); + rsa_key_size = (int) Z_IVAL_P(val); if ((rsa_key_size != 1) && (rsa_key_size & (rsa_key_size - 1))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "RSA key size requires a power of 2: %d", rsa_key_size); rsa_key_size = 2048; @@ -1534,7 +1534,7 @@ static zend_array *capture_session_meta(SSL *ssl_handle) /* {{{ */ array_init(&meta_arr); add_assoc_string(&meta_arr, "protocol", proto_str); add_assoc_string(&meta_arr, "cipher_name", (char *) SSL_CIPHER_get_name(cipher)); - add_assoc_long(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); + add_assoc_int(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); add_assoc_string(&meta_arr, "cipher_version", SSL_CIPHER_get_version(cipher)); return Z_ARR(meta_arr); @@ -2172,8 +2172,8 @@ static long get_crypto_method(php_stream_context *ctx, long crypto_method) zval *val; if (ctx && (val = php_stream_context_get_option(ctx, "ssl", "crypto_method")) != NULL) { - convert_to_long_ex(val); - crypto_method = (long)Z_LVAL_P(val); + convert_to_int_ex(val); + crypto_method = (long)Z_IVAL_P(val); crypto_method |= STREAM_CRYPTO_IS_CLIENT; } diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 448e34b5cc..d21328023e 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -204,213 +204,213 @@ void php_register_signal_constants(INIT_FUNC_ARGS) /* Wait Constants */ #ifdef WNOHANG - REGISTER_LONG_CONSTANT("WNOHANG", (long) WNOHANG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WNOHANG", (long) WNOHANG, CONST_CS | CONST_PERSISTENT); #endif #ifdef WUNTRACED - REGISTER_LONG_CONSTANT("WUNTRACED", (long) WUNTRACED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WUNTRACED", (long) WUNTRACED, CONST_CS | CONST_PERSISTENT); #endif /* Signal Constants */ - REGISTER_LONG_CONSTANT("SIG_IGN", (long) SIG_IGN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_DFL", (long) SIG_DFL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_ERR", (long) SIG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGHUP", (long) SIGHUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGINT", (long) SIGINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGQUIT", (long) SIGQUIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_IGN", (long) SIG_IGN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_DFL", (long) SIG_DFL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_ERR", (long) SIG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGHUP", (long) SIGHUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGINT", (long) SIGINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGQUIT", (long) SIGQUIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT); #ifdef SIGIOT - REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGUSR2", (long) SIGUSR2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGPIPE", (long) SIGPIPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGALRM", (long) SIGALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGUSR2", (long) SIGUSR2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPIPE", (long) SIGPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGALRM", (long) SIGALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT); #ifdef SIGSTKFLT - REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCLD - REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCHLD - REGISTER_LONG_CONSTANT("SIGCHLD", (long) SIGCHLD, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SIGCONT", (long) SIGCONT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGSTOP", (long) SIGSTOP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTSTP", (long) SIGTSTP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTTIN", (long) SIGTTIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTTOU", (long) SIGTTOU, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGURG", (long) SIGURG , CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGXCPU", (long) SIGXCPU, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGXFSZ", (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGPROF", (long) SIGPROF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGCHLD", (long) SIGCHLD, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SIGCONT", (long) SIGCONT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSTOP", (long) SIGSTOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTSTP", (long) SIGTSTP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTTIN", (long) SIGTTIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTTOU", (long) SIGTTOU, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGURG", (long) SIGURG , CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGXCPU", (long) SIGXCPU, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGXFSZ", (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPROF", (long) SIGPROF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT); #ifdef SIGPOLL - REGISTER_LONG_CONSTANT("SIGPOLL", (long) SIGPOLL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPOLL", (long) SIGPOLL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SIGIO", (long) SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGIO", (long) SIGIO, CONST_CS | CONST_PERSISTENT); #ifdef SIGPWR - REGISTER_LONG_CONSTANT("SIGPWR", (long) SIGPWR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPWR", (long) SIGPWR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGSYS - REGISTER_LONG_CONSTANT("SIGSYS", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGBABY", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSYS", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGBABY", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_GETPRIORITY || HAVE_SETPRIORITY - REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); #endif /* {{{ "how" argument for sigprocmask */ #ifdef HAVE_SIGPROCMASK - REGISTER_LONG_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); #endif /* }}} */ /* {{{ si_code */ #if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT - REGISTER_LONG_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); #ifdef SI_NOINFO - REGISTER_LONG_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_KERNEL - REGISTER_LONG_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); #ifdef SI_SIGIO - REGISTER_LONG_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_TKILL - REGISTER_LONG_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGCHILD */ #ifdef CLD_EXITED - REGISTER_LONG_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_KILLED - REGISTER_LONG_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_DUMPED - REGISTER_LONG_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_TRAPPED - REGISTER_LONG_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_STOPPED - REGISTER_LONG_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_CONTINUED - REGISTER_LONG_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGTRAP */ #ifdef TRAP_BRKPT - REGISTER_LONG_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef TRAP_TRACE - REGISTER_LONG_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGPOLL */ #ifdef POLL_IN - REGISTER_LONG_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_OUT - REGISTER_LONG_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_MSG - REGISTER_LONG_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_ERR - REGISTER_LONG_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_PRI - REGISTER_LONG_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_HUP - REGISTER_LONG_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPC - REGISTER_LONG_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPN - REGISTER_LONG_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLADR - REGISTER_LONG_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLTRP - REGISTER_LONG_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVOPC - REGISTER_LONG_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVREG - REGISTER_LONG_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_COPROC - REGISTER_LONG_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_BADSTK - REGISTER_LONG_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTDIV - REGISTER_LONG_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTOVF - REGISTER_LONG_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTDIV - REGISTER_LONG_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTOVF - REGISTER_LONG_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTUND - REGISTER_LONG_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTRES - REGISTER_LONG_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTINV - REGISTER_LONG_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTSUB - REGISTER_LONG_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_MAPERR - REGISTER_LONG_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_ACCERR - REGISTER_LONG_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRALN - REGISTER_LONG_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRERR - REGISTER_LONG_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_OBJERR - REGISTER_LONG_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); #endif #endif /* HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT */ /* }}} */ @@ -548,7 +548,7 @@ PHP_FUNCTION(pcntl_fork) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno); } - RETURN_LONG((long) id); + RETURN_INT((long) id); } /* }}} */ @@ -561,7 +561,7 @@ PHP_FUNCTION(pcntl_alarm) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE) return; - RETURN_LONG ((long) alarm(seconds)); + RETURN_INT ((long) alarm(seconds)); } /* }}} */ @@ -577,9 +577,9 @@ PHP_FUNCTION(pcntl_waitpid) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &pid, &z_status, &options) == FAILURE) return; - convert_to_long_ex(z_status); + convert_to_int_ex(z_status); - status = Z_LVAL_P(z_status); + status = Z_IVAL_P(z_status); child_id = waitpid((pid_t) pid, &status, options); @@ -587,9 +587,9 @@ PHP_FUNCTION(pcntl_waitpid) PCNTL_G(last_error) = errno; } - Z_LVAL_P(z_status) = status; + Z_IVAL_P(z_status) = status; - RETURN_LONG((long) child_id); + RETURN_INT((long) child_id); } /* }}} */ @@ -605,9 +605,9 @@ PHP_FUNCTION(pcntl_wait) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|l", &z_status, &options) == FAILURE) return; - convert_to_long_ex(z_status); + convert_to_int_ex(z_status); - status = Z_LVAL_P(z_status); + status = Z_IVAL_P(z_status); #ifdef HAVE_WAIT3 if(options) { child_id = wait3(&status, options, NULL); @@ -622,9 +622,9 @@ PHP_FUNCTION(pcntl_wait) PCNTL_G(last_error) = errno; } - Z_LVAL_P(z_status) = status; + Z_IVAL_P(z_status) = status; - RETURN_LONG((long) child_id); + RETURN_INT((long) child_id); } /* }}} */ @@ -693,7 +693,7 @@ PHP_FUNCTION(pcntl_wexitstatus) return; } - RETURN_LONG(WEXITSTATUS(status_word)); + RETURN_INT(WEXITSTATUS(status_word)); #else RETURN_FALSE; #endif @@ -711,7 +711,7 @@ PHP_FUNCTION(pcntl_wtermsig) return; } - RETURN_LONG(WTERMSIG(status_word)); + RETURN_INT(WTERMSIG(status_word)); #else RETURN_FALSE; #endif @@ -729,7 +729,7 @@ PHP_FUNCTION(pcntl_wstopsig) return; } - RETURN_LONG(WSTOPSIG(status_word)); + RETURN_INT(WSTOPSIG(status_word)); #else RETURN_FALSE; #endif @@ -788,7 +788,7 @@ PHP_FUNCTION(pcntl_exec) ZEND_HASH_FOREACH_KEY_VAL(envs_hash, key_num, key, element) { if (envi >= envc) break; if (!key) { - key = zend_long_to_str(key_num); + key = zend_int_to_str(key_num); } else { STR_ADDREF(key); } @@ -796,7 +796,7 @@ PHP_FUNCTION(pcntl_exec) convert_to_string_ex(element); /* Length of element + equal sign + length of key + null */ - pair_length = Z_STRLEN_P(element) + key->len + 2; + pair_length = Z_STRSIZE_P(element) + key->len + 2; *pair = emalloc(pair_length); strlcpy(*pair, key->val, key->len + 1); strlcat(*pair, "=", pair_length); @@ -863,12 +863,12 @@ PHP_FUNCTION(pcntl_signal) } /* Special long value case for SIG_DFL and SIG_IGN */ - if (Z_TYPE_P(handle) == IS_LONG) { - if (Z_LVAL_P(handle) != (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) { + if (Z_TYPE_P(handle) == IS_INT) { + if (Z_IVAL_P(handle) != (long) SIG_DFL && Z_IVAL_P(handle) != (long) SIG_IGN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified"); RETURN_FALSE; } - if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { + if (php_signal(signo, (Sigfunc *) Z_IVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal"); RETURN_FALSE; @@ -927,11 +927,11 @@ PHP_FUNCTION(pcntl_sigprocmask) } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_LONG) { + if (Z_TYPE_P(user_signo) != IS_INT) { SEPARATE_ZVAL(user_signo); - convert_to_long_ex(user_signo); + convert_to_int_ex(user_signo); } - signo = Z_LVAL_P(user_signo); + signo = Z_IVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -956,7 +956,7 @@ PHP_FUNCTION(pcntl_sigprocmask) if (sigismember(&oldset, signo) != 1) { continue; } - add_next_index_long(user_oldset, signo); + add_next_index_int(user_oldset, signo); } } @@ -992,11 +992,11 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_LONG) { + if (Z_TYPE_P(user_signo) != IS_INT) { SEPARATE_ZVAL(user_signo); - convert_to_long_ex(user_signo); + convert_to_int_ex(user_signo); } - signo = Z_LVAL_P(user_signo); + signo = Z_IVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -1031,21 +1031,21 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); } - add_assoc_long_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); - add_assoc_long_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); - add_assoc_long_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); + add_assoc_int_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); + add_assoc_int_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); + add_assoc_int_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); switch(signo) { #ifdef SIGCHLD case SIGCHLD: - add_assoc_long_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); + add_assoc_int_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); # ifdef si_utime add_assoc_double_ex(user_siginfo, "utime", sizeof("utime")-1, siginfo.si_utime); # endif # ifdef si_stime add_assoc_double_ex(user_siginfo, "stime", sizeof("stime")-1, siginfo.si_stime); # endif - add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); - add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); + add_assoc_int_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); + add_assoc_int_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); break; #endif case SIGILL: @@ -1056,16 +1056,16 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ break; #ifdef SIGPOLL case SIGPOLL: - add_assoc_long_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); + add_assoc_int_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); # ifdef si_fd - add_assoc_long_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); + add_assoc_int_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); # endif break; #endif } } - RETURN_LONG(signo); + RETURN_INT(signo); } /* }}} */ @@ -1120,7 +1120,7 @@ PHP_FUNCTION(pcntl_getpriority) RETURN_FALSE; } - RETURN_LONG(pri); + RETURN_INT(pri); } /* }}} */ #endif @@ -1169,7 +1169,7 @@ PHP_FUNCTION(pcntl_setpriority) Retrieve the error number set by the last pcntl function which failed. */ PHP_FUNCTION(pcntl_get_last_error) { - RETURN_LONG(PCNTL_G(last_error)); + RETURN_INT(PCNTL_G(last_error)); } /* }}} */ @@ -1242,7 +1242,7 @@ void pcntl_signal_dispatch() while (queue) { if ((handle = zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo)) != NULL) { ZVAL_NULL(&retval); - ZVAL_LONG(¶m, queue->signo); + ZVAL_INT(¶m, queue->signo); /* Call php signal handler - Note that we do not report errors, and we ignore the return value */ /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */ diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index caafc10d19..7b9ad93801 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -77,7 +77,7 @@ ZEND_END_MODULE_GLOBALS(pcntl) #define PCNTL_G(v) (pcntl_globals.v) #endif -#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) +#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_INT_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) #endif /* PHP_PCNTL_H */ diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index cdf639a72d..096ad4c8aa 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -85,7 +85,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate array_init(&info); add_next_index_string(&info, *pdo_err); - add_next_index_long(&info, 0); + add_next_index_int(&info, 0); zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info TSRMLS_CC); zval_ptr_dtor(&info); @@ -131,11 +131,11 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ zval *item; if ((item = zend_hash_index_find(Z_ARRVAL(info), 1)) != NULL) { - native_code = Z_LVAL_P(item); + native_code = Z_IVAL_P(item); } if ((item = zend_hash_index_find(Z_ARRVAL(info), 2)) != NULL) { - supp = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item)); + supp = estrndup(Z_STRVAL_P(item), Z_STRSIZE_P(item)); } } } @@ -277,7 +277,7 @@ static PHP_METHOD(PDO, dbh_constructor) if ((v = zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_PERSISTENT)) != NULL) { if (Z_TYPE_P(v) == IS_STRING && - !is_numeric_string(Z_STRVAL_P(v), Z_STRLEN_P(v), NULL, NULL, 0) && Z_STRLEN_P(v) > 0) { + !is_numeric_string(Z_STRVAL_P(v), Z_STRSIZE_P(v), NULL, NULL, 0) && Z_STRSIZE_P(v) > 0) { /* user specified key */ plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source, username ? username : "", @@ -285,8 +285,8 @@ static PHP_METHOD(PDO, dbh_constructor) Z_STRVAL_P(v)); is_persistent = 1; } else { - convert_to_long_ex(v); - is_persistent = Z_LVAL_P(v) ? 1 : 0; + convert_to_int_ex(v); + is_persistent = Z_IVAL_P(v) ? 1 : 0; plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source, username ? username : "", password ? password : ""); @@ -350,7 +350,7 @@ static PHP_METHOD(PDO, dbh_constructor) dbh->default_fetch_type = PDO_FETCH_BOTH; } - dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); + dbh->auto_commit = pdo_attr_ival(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory"); @@ -678,8 +678,8 @@ static PHP_METHOD(PDO, inTransaction) static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_DC) /* {{{ */ { -#define PDO_LONG_PARAM_CHECK \ - if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ +#define PDO_INT_PARAM_CHECK \ + if (Z_TYPE_P(value) != IS_INT && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \ PDO_HANDLE_DBH_ERR(); \ return FAILURE; \ @@ -687,13 +687,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D switch (attr) { case PDO_ATTR_ERRMODE: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - switch (Z_LVAL_P(value)) { + PDO_INT_PARAM_CHECK; + convert_to_int(value); + switch (Z_IVAL_P(value)) { case PDO_ERRMODE_SILENT: case PDO_ERRMODE_WARNING: case PDO_ERRMODE_EXCEPTION: - dbh->error_mode = Z_LVAL_P(value); + dbh->error_mode = Z_IVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode" TSRMLS_CC); @@ -703,13 +703,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D return FAILURE; case PDO_ATTR_CASE: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - switch (Z_LVAL_P(value)) { + PDO_INT_PARAM_CHECK; + convert_to_int(value); + switch (Z_IVAL_P(value)) { case PDO_CASE_NATURAL: case PDO_CASE_UPPER: case PDO_CASE_LOWER: - dbh->desired_case = Z_LVAL_P(value); + dbh->desired_case = Z_IVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode" TSRMLS_CC); @@ -719,35 +719,35 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D return FAILURE; case PDO_ATTR_ORACLE_NULLS: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - dbh->oracle_nulls = Z_LVAL_P(value); + PDO_INT_PARAM_CHECK; + convert_to_int(value); + dbh->oracle_nulls = Z_IVAL_P(value); return SUCCESS; case PDO_ATTR_DEFAULT_FETCH_MODE: if (Z_TYPE_P(value) == IS_ARRAY) { zval *tmp; - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - if (Z_LVAL_P(tmp) == PDO_FETCH_INTO || Z_LVAL_P(tmp) == PDO_FETCH_CLASS) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + if (Z_IVAL_P(tmp) == PDO_FETCH_INTO || Z_IVAL_P(tmp) == PDO_FETCH_CLASS) { pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC); return FAILURE; } } } else { - PDO_LONG_PARAM_CHECK; + PDO_INT_PARAM_CHECK; } - convert_to_long(value); - if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) { + convert_to_int(value); + if (Z_IVAL_P(value) == PDO_FETCH_USE_DEFAULT) { pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC); return FAILURE; } - dbh->default_fetch_type = Z_LVAL_P(value); + dbh->default_fetch_type = Z_IVAL_P(value); return SUCCESS; case PDO_ATTR_STRINGIFY_FETCHES: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - dbh->stringify = Z_LVAL_P(value) ? 1 : 0; + PDO_INT_PARAM_CHECK; + convert_to_int(value); + dbh->stringify = Z_IVAL_P(value) ? 1 : 0; return SUCCESS; case PDO_ATTR_STATEMENT_CLASS: { @@ -872,13 +872,13 @@ static PHP_METHOD(PDO, getAttribute) RETURN_BOOL(dbh->is_persistent); case PDO_ATTR_CASE: - RETURN_LONG(dbh->desired_case); + RETURN_INT(dbh->desired_case); case PDO_ATTR_ORACLE_NULLS: - RETURN_LONG(dbh->oracle_nulls); + RETURN_INT(dbh->oracle_nulls); case PDO_ATTR_ERRMODE: - RETURN_LONG(dbh->error_mode); + RETURN_INT(dbh->error_mode); case PDO_ATTR_DRIVER_NAME: RETURN_STRINGL((char*)dbh->driver->driver_name, dbh->driver->driver_name_len); @@ -892,7 +892,7 @@ static PHP_METHOD(PDO, getAttribute) } return; case PDO_ATTR_DEFAULT_FETCH_MODE: - RETURN_LONG(dbh->default_fetch_type); + RETURN_INT(dbh->default_fetch_type); default: break; } @@ -941,7 +941,7 @@ static PHP_METHOD(PDO, exec) PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } else { - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -1382,99 +1382,99 @@ void pdo_dbh_init(TSRMLS_D) pdo_dbh_object_handlers.get_method = dbh_method_get; pdo_dbh_object_handlers.compare_objects = dbh_compare; - REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (long)PDO_PARAM_BOOL); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (long)PDO_PARAM_NULL); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_INT", (long)PDO_PARAM_INT); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_STR", (long)PDO_PARAM_STR); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_LOB", (long)PDO_PARAM_LOB); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_STMT", (long)PDO_PARAM_STMT); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT); - - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_ALLOC", (long)PDO_PARAM_EVT_ALLOC); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FREE", (long)PDO_PARAM_EVT_FREE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_PRE", (long)PDO_PARAM_EVT_EXEC_PRE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_POST", (long)PDO_PARAM_EVT_EXEC_POST); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_PRE", (long)PDO_PARAM_EVT_FETCH_PRE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_POST", (long)PDO_PARAM_EVT_FETCH_POST); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_NORMALIZE", (long)PDO_PARAM_EVT_NORMALIZE); - - REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (long)PDO_FETCH_LAZY); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC",(long)PDO_FETCH_ASSOC); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (long)PDO_FETCH_NUM); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOTH", (long)PDO_FETCH_BOTH); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_OBJ", (long)PDO_FETCH_OBJ); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOUND",(long)PDO_FETCH_BOUND); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_COLUMN",(long)PDO_FETCH_COLUMN); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASS",(long)PDO_FETCH_CLASS); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_INTO", (long)PDO_FETCH_INTO); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (long)PDO_FETCH_FUNC); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP",(long)PDO_FETCH_GROUP); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_BOOL", (long)PDO_PARAM_BOOL); + REGISTER_PDO_CLASS_CONST_INT("PARAM_NULL", (long)PDO_PARAM_NULL); + REGISTER_PDO_CLASS_CONST_INT("PARAM_INT", (long)PDO_PARAM_INT); + REGISTER_PDO_CLASS_CONST_INT("PARAM_STR", (long)PDO_PARAM_STR); + REGISTER_PDO_CLASS_CONST_INT("PARAM_LOB", (long)PDO_PARAM_LOB); + REGISTER_PDO_CLASS_CONST_INT("PARAM_STMT", (long)PDO_PARAM_STMT); + REGISTER_PDO_CLASS_CONST_INT("PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT); + + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_ALLOC", (long)PDO_PARAM_EVT_ALLOC); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FREE", (long)PDO_PARAM_EVT_FREE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_PRE", (long)PDO_PARAM_EVT_EXEC_PRE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_POST", (long)PDO_PARAM_EVT_EXEC_POST); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_PRE", (long)PDO_PARAM_EVT_FETCH_PRE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_POST", (long)PDO_PARAM_EVT_FETCH_POST); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_NORMALIZE", (long)PDO_PARAM_EVT_NORMALIZE); + + REGISTER_PDO_CLASS_CONST_INT("FETCH_LAZY", (long)PDO_FETCH_LAZY); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ASSOC",(long)PDO_FETCH_ASSOC); + REGISTER_PDO_CLASS_CONST_INT("FETCH_NUM", (long)PDO_FETCH_NUM); + REGISTER_PDO_CLASS_CONST_INT("FETCH_BOTH", (long)PDO_FETCH_BOTH); + REGISTER_PDO_CLASS_CONST_INT("FETCH_OBJ", (long)PDO_FETCH_OBJ); + REGISTER_PDO_CLASS_CONST_INT("FETCH_BOUND",(long)PDO_FETCH_BOUND); + REGISTER_PDO_CLASS_CONST_INT("FETCH_COLUMN",(long)PDO_FETCH_COLUMN); + REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASS",(long)PDO_FETCH_CLASS); + REGISTER_PDO_CLASS_CONST_INT("FETCH_INTO", (long)PDO_FETCH_INTO); + REGISTER_PDO_CLASS_CONST_INT("FETCH_FUNC", (long)PDO_FETCH_FUNC); + REGISTER_PDO_CLASS_CONST_INT("FETCH_GROUP",(long)PDO_FETCH_GROUP); + REGISTER_PDO_CLASS_CONST_INT("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR); + REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE); #if PHP_VERSION_ID >= 50100 - REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE); #endif - REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE",(long)PDO_FETCH_PROPS_LATE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_NAMED",(long)PDO_FETCH_NAMED); - - REGISTER_PDO_CLASS_CONST_LONG("ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CASE", (long)PDO_ATTR_CASE); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR", (long)PDO_ATTR_CURSOR); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_STATEMENT_CLASS", (long)PDO_ATTR_STATEMENT_CLASS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_TABLE_NAMES", (long)PDO_ATTR_FETCH_TABLE_NAMES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_CATALOG_NAMES", (long)PDO_ATTR_FETCH_CATALOG_NAMES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_DRIVER_NAME", (long)PDO_ATTR_DRIVER_NAME); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_STRINGIFY_FETCHES",(long)PDO_ATTR_STRINGIFY_FETCHES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_EMULATE_PREPARES",(long)PDO_ATTR_EMULATE_PREPARES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_DEFAULT_FETCH_MODE",(long)PDO_ATTR_DEFAULT_FETCH_MODE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_PROPS_LATE",(long)PDO_FETCH_PROPS_LATE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_NAMED",(long)PDO_FETCH_NAMED); + + REGISTER_PDO_CLASS_CONST_INT("ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH); + REGISTER_PDO_CLASS_CONST_INT("ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE); + REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION); + REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CASE", (long)PDO_ATTR_CASE); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR", (long)PDO_ATTR_CURSOR); + REGISTER_PDO_CLASS_CONST_INT("ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_STATEMENT_CLASS", (long)PDO_ATTR_STATEMENT_CLASS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_TABLE_NAMES", (long)PDO_ATTR_FETCH_TABLE_NAMES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_CATALOG_NAMES", (long)PDO_ATTR_FETCH_CATALOG_NAMES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_DRIVER_NAME", (long)PDO_ATTR_DRIVER_NAME); + REGISTER_PDO_CLASS_CONST_INT("ATTR_STRINGIFY_FETCHES",(long)PDO_ATTR_STRINGIFY_FETCHES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN); + REGISTER_PDO_CLASS_CONST_INT("ATTR_EMULATE_PREPARES",(long)PDO_ATTR_EMULATE_PREPARES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_DEFAULT_FETCH_MODE",(long)PDO_ATTR_DEFAULT_FETCH_MODE); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION); - REGISTER_PDO_CLASS_CONST_LONG("CASE_NATURAL", (long)PDO_CASE_NATURAL); - REGISTER_PDO_CLASS_CONST_LONG("CASE_LOWER", (long)PDO_CASE_LOWER); - REGISTER_PDO_CLASS_CONST_LONG("CASE_UPPER", (long)PDO_CASE_UPPER); + REGISTER_PDO_CLASS_CONST_INT("CASE_NATURAL", (long)PDO_CASE_NATURAL); + REGISTER_PDO_CLASS_CONST_INT("CASE_LOWER", (long)PDO_CASE_LOWER); + REGISTER_PDO_CLASS_CONST_INT("CASE_UPPER", (long)PDO_CASE_UPPER); - REGISTER_PDO_CLASS_CONST_LONG("NULL_NATURAL", (long)PDO_NULL_NATURAL); - REGISTER_PDO_CLASS_CONST_LONG("NULL_EMPTY_STRING", (long)PDO_NULL_EMPTY_STRING); - REGISTER_PDO_CLASS_CONST_LONG("NULL_TO_STRING", (long)PDO_NULL_TO_STRING); + REGISTER_PDO_CLASS_CONST_INT("NULL_NATURAL", (long)PDO_NULL_NATURAL); + REGISTER_PDO_CLASS_CONST_INT("NULL_EMPTY_STRING", (long)PDO_NULL_EMPTY_STRING); + REGISTER_PDO_CLASS_CONST_INT("NULL_TO_STRING", (long)PDO_NULL_TO_STRING); REGISTER_PDO_CLASS_CONST_STRING("ERR_NONE", PDO_ERR_NONE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL); - REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY); - REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL); + REGISTER_PDO_CLASS_CONST_INT("CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY); + REGISTER_PDO_CLASS_CONST_INT("CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL); #if 0 - REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP); - REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (long)PDO_ERR_SYNTAX); - REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND); - REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (long)PDO_ERR_MISMATCH); - REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (long)PDO_ERR_NO_PERM); + REGISTER_PDO_CLASS_CONST_INT("ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP); + REGISTER_PDO_CLASS_CONST_INT("ERR_SYNTAX", (long)PDO_ERR_SYNTAX); + REGISTER_PDO_CLASS_CONST_INT("ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT); + REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND); + REGISTER_PDO_CLASS_CONST_INT("ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS); + REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED); + REGISTER_PDO_CLASS_CONST_INT("ERR_MISMATCH", (long)PDO_ERR_MISMATCH); + REGISTER_PDO_CLASS_CONST_INT("ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED); + REGISTER_PDO_CLASS_CONST_INT("ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED); + REGISTER_PDO_CLASS_CONST_INT("ERR_NO_PERM", (long)PDO_ERR_NO_PERM); #endif } diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index cbaa0b057b..6530e2222c 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -586,12 +586,12 @@ safe: case IS_FALSE: case IS_TRUE: - convert_to_long(&tmp_param); + convert_to_int(&tmp_param); /* fall through */ - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRLEN(tmp_param); + plc->qlen = Z_STRSIZE(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -599,7 +599,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, + Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -618,7 +618,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRLEN_P(parameter); + plc->qlen = Z_STRSIZE_P(parameter); } newbuffer_len += plc->qlen; } @@ -769,7 +769,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRLEN_P(param->parameter); + newbuffer_len += padding * Z_STRSIZE_P(param->parameter); } zend_hash_move_forward(params); } @@ -805,16 +805,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { @@ -841,16 +841,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 76ac3d115a..8effb4f5e7 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -248,12 +248,12 @@ safe: case IS_FALSE: case IS_TRUE: - convert_to_long(&tmp_param); + convert_to_int(&tmp_param); /* fall through */ - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRLEN(tmp_param); + plc->qlen = Z_STRSIZE(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -261,7 +261,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, + Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -280,7 +280,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRLEN_P(parameter); + plc->qlen = Z_STRSIZE_P(parameter); } newbuffer_len += plc->qlen; } @@ -431,7 +431,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRLEN_P(param->parameter); + newbuffer_len += padding * Z_STRSIZE_P(param->parameter); } zend_hash_move_forward(params); } @@ -467,16 +467,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { @@ -503,16 +503,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index c4ae2f6fe1..6079e7227f 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -328,8 +328,8 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s convert_to_string(parameter); } } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) { - convert_to_long(parameter); - } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) { + convert_to_int(parameter); + } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_INT) { convert_to_boolean(parameter); } @@ -572,7 +572,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ case PDO_PARAM_INT: if (value && value_len == sizeof(long)) { - ZVAL_LONG(dest, *(long*)value); + ZVAL_INT(dest, *(long*)value); break; } ZVAL_NULL(dest); @@ -639,7 +639,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ if (type != new_type) { switch (new_type) { case PDO_PARAM_INT: - convert_to_long_ex(dest); + convert_to_int_ex(dest); break; case PDO_PARAM_BOOL: convert_to_boolean_ex(dest); @@ -661,7 +661,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ if (stmt->dbh->stringify) { switch (Z_TYPE_P(dest)) { - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(dest); break; @@ -1032,8 +1032,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval tmp; fetch_value(stmt, &tmp, ++i, NULL TSRMLS_CC); - if (Z_TYPE(val) == IS_LONG) { - zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_LVAL(val), &tmp); + if (Z_TYPE(val) == IS_INT) { + zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_IVAL(val), &tmp); } else { convert_to_string(&val); zend_symtable_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_STR(val), &tmp); @@ -1110,7 +1110,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ php_unserialize_data_t var_hash; PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL TSRMLS_CC) == FAILURE) { + if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRSIZE(val), NULL TSRMLS_CC) == FAILURE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data" TSRMLS_CC); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return 0; @@ -1121,7 +1121,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); return 0; - } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL TSRMLS_CC) == FAILURE) { + } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRSIZE(val) : 0, NULL TSRMLS_CC) == FAILURE) { zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); zval_dtor(return_value); @@ -1470,8 +1470,8 @@ static PHP_METHOD(PDOStatement, fetchAll) stmt->fetch.column = how & PDO_FETCH_GROUP ? -1 : 0; break; case 2: - convert_to_long(arg2); - stmt->fetch.column = Z_LVAL_P(arg2); + convert_to_int(arg2); + stmt->fetch.column = Z_IVAL_P(arg2); break; case 3: pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC); @@ -1643,7 +1643,7 @@ static PHP_METHOD(PDOStatement, rowCount) { PHP_STMT_GET_OBJ; - RETURN_LONG(stmt->row_count); + RETURN_INT(stmt->row_count); } /* }}} */ @@ -1790,7 +1790,7 @@ static PHP_METHOD(PDOStatement, columnCount) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(stmt->column_count); + RETURN_INT(stmt->column_count); } /* }}} */ @@ -1824,11 +1824,11 @@ static PHP_METHOD(PDOStatement, getColumnMeta) /* add stock items */ col = &stmt->columns[colno]; add_assoc_string(return_value, "name", col->name); - add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ - add_assoc_long(return_value, "precision", col->precision); + add_assoc_int(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ + add_assoc_int(return_value, "precision", col->precision); if (col->param_type != PDO_PARAM_ZVAL) { /* if param_type is PDO_PARAM_ZVAL the driver has to provide correct data */ - add_assoc_long(return_value, "pdo_type", col->param_type); + add_assoc_int(return_value, "pdo_type", col->param_type); } } /* }}} */ @@ -1868,11 +1868,11 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); if (SUCCESS == retval) { - if (Z_TYPE(args[skip]) != IS_LONG) { + if (Z_TYPE(args[skip]) != IS_INT) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer" TSRMLS_CC); retval = FAILURE; } else { - mode = Z_LVAL(args[skip]); + mode = Z_IVAL(args[skip]); flags = mode & PDO_FETCH_FLAGS; retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC); @@ -1906,10 +1906,10 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_COLUMN: if (argc != 2) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument" TSRMLS_CC); - } else if (Z_TYPE(args[skip+1]) != IS_LONG) { + } else if (Z_TYPE(args[skip+1]) != IS_INT) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer" TSRMLS_CC); } else { - stmt->fetch.column = Z_LVAL(args[skip+1]); + stmt->fetch.column = Z_IVAL(args[skip+1]); retval = SUCCESS; } break; @@ -2413,7 +2413,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_D if (I->key == (ulong)-1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } @@ -2489,9 +2489,9 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl ZVAL_NULL(rv); if (stmt) { - if (Z_TYPE_P(member) == IS_LONG) { - if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) { - fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC); + if (Z_TYPE_P(member) == IS_INT) { + if (Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count) { + fetch_value(stmt, rv, Z_IVAL_P(member), NULL TSRMLS_CC); } } else { convert_to_string(member); @@ -2543,8 +2543,8 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c int colno = -1; if (stmt) { - if (Z_TYPE_P(member) == IS_LONG) { - return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count; + if (Z_TYPE_P(member) == IS_INT) { + return Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count; } else { convert_to_string(member); diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h index 0de6743ad4..bbb75ea63f 100644 --- a/ext/pdo/php_pdo.h +++ b/ext/pdo/php_pdo.h @@ -58,13 +58,13 @@ ZEND_END_MODULE_GLOBALS(pdo) # define PDOG(v) (pdo_globals.v) #endif -#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_PDO_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #define REGISTER_PDO_CONST_LONG(const_name, value) { \ zend_class_entry **pce; \ if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \ - zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \ + zend_declare_class_constant_int(*pce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \ } \ #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \ diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 4818bc6232..8eed98952d 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -194,13 +194,13 @@ enum pdo_null_handling { }; /* {{{ utils for reading attributes set as driver_options */ -static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, long defval TSRMLS_DC) +static inline long pdo_attr_ival(zval *options, enum pdo_attribute_type option_name, long defval TSRMLS_DC) { zval *v; if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { - convert_to_long_ex(v); - return Z_LVAL_P(v); + convert_to_int_ex(v); + return Z_IVAL_P(v); } return defval; } @@ -210,7 +210,7 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { convert_to_string_ex(v); - return estrndup(Z_STRVAL_P(v), Z_STRLEN_P(v)); + return estrndup(Z_STRVAL_P(v), Z_STRSIZE_P(v)); } return defval ? estrdup(defval) : NULL; } diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 350a3c670d..67a3241a66 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -60,12 +60,12 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS spprintf(&message, 0, "%s [%d] (severity %d) [%s]", msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : ""); - add_next_index_long(info, einfo->dberr); + add_next_index_int(info, einfo->dberr); // TODO: avoid reallocation ??? add_next_index_string(info, message); efree(message); - add_next_index_long(info, einfo->oserr); - add_next_index_long(info, einfo->severity); + add_next_index_int(info, einfo->oserr); + add_next_index_int(info, einfo->severity); if (einfo->oserrstr) { add_next_index_string(info, einfo->oserrstr); } diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index c13d58bd57..fd0999f7e4 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -303,13 +303,13 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *re if(!dbtypeinfo) return FAILURE; - add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) ); - add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision ); - add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale ); + add_assoc_int(return_value, "max_length", dbcollen(H->link, colno+1) ); + add_assoc_int(return_value, "precision", (int) dbtypeinfo->precision ); + add_assoc_int(return_value, "scale", (int) dbtypeinfo->scale ); add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1)); add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1))); - add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1)); - add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); + add_assoc_int(return_value, "native_type_id", dbcoltype(H->link, colno+1)); + add_assoc_int(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); return 1; } diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 20a41bbb9b..309f206754 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -448,7 +448,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql *ppname++ = 0; if (named_params) { zval tmp; - ZVAL_LONG(&tmp, pindex); + ZVAL_INT(&tmp, pindex); zend_hash_str_update(named_params, pname, (unsigned int)(ppname - pname - 1), &tmp); } } @@ -553,7 +553,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS char tmp[512]; case PDO_ATTR_AUTOCOMMIT: - ZVAL_LONG(val,dbh->auto_commit); + ZVAL_INT(val,dbh->auto_commit); return 1; case PDO_ATTR_CONNECTION_STATUS: @@ -609,7 +609,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval long i = 0, l, sqlcode = isc_sqlcode(s); if (sqlcode) { - add_next_index_long(info, sqlcode); + add_next_index_int(info, sqlcode); while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) { i += l; @@ -617,7 +617,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval } add_next_index_string(info, buf); } else if (H->last_app_error) { - add_next_index_long(info, -999); + add_next_index_int(info, -999); add_next_index_string(info, const_cast(H->last_app_error)); } return 1; diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index d21273366b..2fd60417b6 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -425,7 +425,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T SEPARATE_ZVAL(param); convert_to_string_ex(param); - for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -467,7 +467,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat /* try to determine the index by looking in the named_params hash */ if ((index = zend_hash_find(S->named_params, param->name)) != NULL) { - param->paramno = Z_LVAL_P(index); + param->paramno = Z_IVAL_P(index); } else { /* ... or by looking in the input descriptor */ int i; @@ -549,10 +549,10 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (Z_TYPE_P(parameter)) { int force_null; - case IS_LONG: + case IS_INT: /* keep the allow-NULL flag */ var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); - var->sqldata = (void*)&Z_LVAL_P(parameter); + var->sqldata = (void*)&Z_IVAL_P(parameter); var->sqllen = sizeof(long); break; case IS_DOUBLE: @@ -574,13 +574,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(parameter) == 0); + force_null = (Z_STRSIZE_P(parameter) == 0); } if (!force_null) { /* keep the allow-NULL flag */ var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(parameter); - var->sqllen = Z_STRLEN_P(parameter); + var->sqllen = Z_STRSIZE_P(parameter); break; } case IS_NULL: @@ -626,7 +626,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_INT: if (value) { - ZVAL_LONG(parameter, *(long*)value); + ZVAL_INT(parameter, *(long*)value); break; } case PDO_PARAM_EVT_NORMALIZE: diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index d59aa53fa3..675e6dc7a9 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -62,9 +62,9 @@ ZEND_GET_MODULE(pdo_firebird) PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */ { - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT); php_pdo_register_driver(&pdo_firebird_driver); diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index b39fdfaaa2..1ba46730ca 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -129,7 +129,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in } if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -240,7 +240,7 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, } dbh->alloc_own_columns = 1; - S->max_length = pdo_attr_lval(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); + S->max_length = pdo_attr_ival(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); PDO_DBG_RETURN(1); @@ -400,13 +400,13 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_D PDO_DBG_RETURN(1); #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - convert_to_long(val); - if (Z_LVAL_P(val) < 0) { + convert_to_int(val); + if (Z_IVAL_P(val) < 0) { /* TODO: Johannes, can we throw a warning here? */ ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size); } else { - ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val); + ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_IVAL_P(val); } PDO_DBG_RETURN(1); break; @@ -456,20 +456,20 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value } break; case PDO_ATTR_AUTOCOMMIT: - ZVAL_LONG(return_value, dbh->auto_commit); + ZVAL_INT(return_value, dbh->auto_commit); break; case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY: - ZVAL_LONG(return_value, H->buffered); + ZVAL_INT(return_value, H->buffered); break; case PDO_MYSQL_ATTR_DIRECT_QUERY: - ZVAL_LONG(return_value, H->emulate_prepare); + ZVAL_INT(return_value, H->emulate_prepare); break; #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - ZVAL_LONG(return_value, H->max_buffer_size); + ZVAL_INT(return_value, H->max_buffer_size); break; #endif @@ -596,30 +596,30 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ /* handle MySQL options */ if (driver_options) { - long connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); - long local_infile = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); + long connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + long local_infile = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); char *init_cmd = NULL; #ifndef PDO_USE_MYSQLND char *default_file = NULL, *default_group = NULL; #endif long compress = 0; char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL; - H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); + H->buffered = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); - H->emulate_prepare = pdo_attr_lval(driver_options, + H->emulate_prepare = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_DIRECT_QUERY, H->emulate_prepare TSRMLS_CC); - H->emulate_prepare = pdo_attr_lval(driver_options, + H->emulate_prepare = pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare TSRMLS_CC); #ifndef PDO_USE_MYSQLND - H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); + H->max_buffer_size = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); #endif - if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { + if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { connect_opts |= CLIENT_FOUND_ROWS; } - if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { + if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { connect_opts |= CLIENT_IGNORE_SPACE; } @@ -682,7 +682,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ efree(default_group); } #endif - compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); + compress = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); if (compress) { if (mysql_options(H->server, MYSQL_OPT_COMPRESS, 0)) { pdo_mysql_error(dbh); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 30a2f04f98..9e0a763663 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -550,7 +550,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_VAR_STRING); break; - case IS_LONG: + case IS_INT: #if SIZEOF_LONG==8 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONGLONG); #elif SIZEOF_LONG==4 @@ -576,13 +576,13 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: b->buffer_type = MYSQL_TYPE_STRING; b->buffer = Z_STRVAL_P(parameter); - b->buffer_length = Z_STRLEN_P(parameter); - *b->length = Z_STRLEN_P(parameter); + b->buffer_length = Z_STRSIZE_P(parameter); + *b->length = Z_STRSIZE_P(parameter); PDO_DBG_RETURN(1); - case IS_LONG: + case IS_INT: b->buffer_type = MYSQL_TYPE_LONG; - b->buffer = &Z_LVAL_P(parameter); + b->buffer = &Z_IVAL_P(parameter); PDO_DBG_RETURN(1); case IS_DOUBLE: @@ -879,10 +879,10 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va #if SIZEOF_LONG==8 case MYSQL_TYPE_LONGLONG: #endif - add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT); + add_assoc_int(return_value, "pdo_type", PDO_PARAM_INT); break; default: - add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR); + add_assoc_int(return_value, "pdo_type", PDO_PARAM_STR); break; } #endif diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index c3a90fedac..f77ac7deb8 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -106,25 +106,25 @@ static PHP_MINIT_FUNCTION(pdo_mysql) { REGISTER_INI_ENTRIES(); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE", (long)PDO_MYSQL_ATTR_LOCAL_INFILE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND", (long)PDO_MYSQL_ATTR_INIT_COMMAND); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_LOCAL_INFILE", (long)PDO_MYSQL_ATTR_LOCAL_INFILE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_INIT_COMMAND", (long)PDO_MYSQL_ATTR_INIT_COMMAND); #ifndef PDO_USE_MYSQLND - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MAX_BUFFER_SIZE", (long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE", (long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_MAX_BUFFER_SIZE", (long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_FILE", (long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_GROUP", (long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); #endif - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (long)PDO_MYSQL_ATTR_COMPRESS); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (long)PDO_MYSQL_ATTR_DIRECT_QUERY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS", (long)PDO_MYSQL_ATTR_FOUND_ROWS); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE", (long)PDO_MYSQL_ATTR_IGNORE_SPACE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_KEY", (long)PDO_MYSQL_ATTR_SSL_KEY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CERT", (long)PDO_MYSQL_ATTR_SSL_CERT); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (long)PDO_MYSQL_ATTR_SSL_CA); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (long)PDO_MYSQL_ATTR_SSL_CAPATH); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (long)PDO_MYSQL_ATTR_SSL_CIPHER); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_COMPRESS", (long)PDO_MYSQL_ATTR_COMPRESS); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_DIRECT_QUERY", (long)PDO_MYSQL_ATTR_DIRECT_QUERY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_FOUND_ROWS", (long)PDO_MYSQL_ATTR_FOUND_ROWS); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_IGNORE_SPACE", (long)PDO_MYSQL_ATTR_IGNORE_SPACE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_KEY", (long)PDO_MYSQL_ATTR_SSL_KEY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CERT", (long)PDO_MYSQL_ATTR_SSL_CERT); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CA", (long)PDO_MYSQL_ATTR_SSL_CA); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CAPATH", (long)PDO_MYSQL_ATTR_SSL_CAPATH); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CIPHER", (long)PDO_MYSQL_ATTR_SSL_CIPHER); #if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); #endif diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index a8e7913fa7..279fda7439 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -49,7 +49,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info } if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -258,7 +258,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd int ret; #if HAVE_OCISTMTFETCH2 - S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, + S->exec_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT; #else @@ -302,7 +302,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd } - prefetch = pdo_oci_sanitize_prefetch(pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); + prefetch = pdo_oci_sanitize_prefetch(pdo_attr_ival(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); if (prefetch) { H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, H->err); @@ -456,9 +456,9 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_ dbh->in_txn = 0; } - convert_to_long(val); + convert_to_int(val); - dbh->auto_commit = Z_LVAL_P(val); + dbh->auto_commit = Z_IVAL_P(val); return 1; } else { return 0; diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 4e341c08be..226e3ee493 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -209,7 +209,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv /* regular string bind */ convert_to_string(param->parameter); *bufpp = Z_STRVAL_P(param->parameter); - *alenp = Z_STRLEN_P(param->parameter); + *alenp = Z_STRSIZE_P(param->parameter); } *piecep = OCI_ONE_PIECE; @@ -244,11 +244,11 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d convert_to_string(param->parameter); zval_dtor(param->parameter); - Z_STRLEN_P(param->parameter) = param->max_value_len; - Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRLEN_P(param->parameter)+1); + Z_STRSIZE_P(param->parameter) = param->max_value_len; + Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRSIZE_P(param->parameter)+1); P->used_for_output = 1; - P->actual_len = Z_STRLEN_P(param->parameter); + P->actual_len = Z_STRSIZE_P(param->parameter); *alenpp = &P->actual_len; *bufpp = Z_STRVAL_P(param->parameter); *piecep = OCI_ONE_PIECE; @@ -360,7 +360,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa && Z_STRVAL_P(param->parameter) != empty_string #endif ) { - Z_STRLEN_P(param->parameter) = P->actual_len; + Z_STRSIZE_P(param->parameter) = P->actual_len; Z_STRVAL_P(param->parameter) = erealloc(Z_STRVAL_P(param->parameter), P->actual_len+1); Z_STRVAL_P(param->parameter)[P->actual_len] = '\0'; } @@ -410,7 +410,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa } else if (Z_TYPE_P(param->parameter) == IS_STRING) { /* stick the string into the LOB */ consume = Z_STRVAL_P(param->parameter); - n = Z_STRLEN_P(param->parameter); + n = Z_STRSIZE_P(param->parameter); if (n) { OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE); while (n) { diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 2828b96e81..14f981375d 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -48,7 +48,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf einfo->what, einfo->last_error, einfo->file, einfo->line); - add_next_index_long(info, einfo->last_error); + add_next_index_int(info, einfo->last_error); add_next_index_str(info, message); add_next_index_string(info, einfo->last_state); @@ -181,7 +181,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, p return 0; } - cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); + cursor_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); if (cursor_type != PDO_CURSOR_FWDONLY) { rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -431,7 +431,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D } /* set up the cursor library, if needed, or if configured explicitly */ - cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); + cursor_lib = pdo_attr_ival(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_INTEGER); if (rc != SQL_SUCCESS && cursor_lib != SQL_CUR_USE_IF_NEEDED) { pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS"); diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index ea5650923c..20f725e5b3 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -195,11 +195,11 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), &ulen)) { case PDO_ODBC_CONV_NOT_REQUIRED: SQLPutData(S->stmt, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter)); + Z_STRSIZE_P(parameter)); break; case PDO_ODBC_CONV_OK: SQLPutData(S->stmt, S->convbuf, ulen); @@ -447,10 +447,10 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } else { convert_to_string(parameter); if (P->outbuf) { - P->len = Z_STRLEN_P(parameter); + P->len = Z_STRSIZE_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); } } } else if (Z_TYPE_P(parameter) == IS_NULL || PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL) { @@ -461,11 +461,11 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p unsigned long ulen; switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), &ulen)) { case PDO_ODBC_CONV_FAIL: case PDO_ODBC_CONV_NOT_REQUIRED: - P->len = Z_STRLEN_P(parameter); + P->len = Z_STRSIZE_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); break; case PDO_ODBC_CONV_OK: @@ -474,7 +474,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p break; } } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); } } return 1; @@ -514,7 +514,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p ZVAL_NEW_STR(parameter, STR_ALLOC(srclen, 0)); memcpy(Z_STRVAL_P(parameter), srcbuf, srclen); - Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0'; + Z_STRVAL_P(parameter)[Z_STRSIZE_P(parameter)] = '\0'; } } return 1; @@ -763,7 +763,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) switch (attr) { case PDO_ATTR_CURSOR_NAME: convert_to_string(val); - rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); + rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRSIZE_P(val)); if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { return 1; diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 1fe17c1c30..f78b1af8ec 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -136,11 +136,11 @@ PHP_MINIT_FUNCTION(pdo_odbc) } #endif - REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); + REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); + REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); return SUCCESS; } diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c index fe003f8ab9..b3fd8ef879 100644 --- a/ext/pdo_pgsql/pdo_pgsql.c +++ b/ext/pdo_pgsql/pdo_pgsql.c @@ -85,13 +85,13 @@ ZEND_GET_MODULE(pdo_pgsql) */ PHP_MINIT_FUNCTION(pdo_pgsql) { - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (long)PGSQL_TRANSACTION_IDLE); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (long)PGSQL_TRANSACTION_ACTIVE); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (long)PGSQL_TRANSACTION_INTRANS); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (long)PGSQL_TRANSACTION_INERROR); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (long)PGSQL_TRANSACTION_UNKNOWN); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_IDLE", (long)PGSQL_TRANSACTION_IDLE); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_ACTIVE", (long)PGSQL_TRANSACTION_ACTIVE); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INTRANS", (long)PGSQL_TRANSACTION_INTRANS); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INERROR", (long)PGSQL_TRANSACTION_INERROR); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_UNKNOWN", (long)PGSQL_TRANSACTION_UNKNOWN); php_pdo_register_driver(&pdo_pgsql_driver); return SUCCESS; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 4ab3bdb6d6..06016887b9 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -113,7 +113,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in pdo_pgsql_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -229,7 +229,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, stmt->driver_data = S; stmt->methods = &pgsql_stmt_methods; - scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, + scrollable = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL; if (scrollable) { @@ -239,14 +239,14 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, spprintf(&S->cursor_name, 0, "pdo_crsr_%08x", ++H->stmt_counter); emulate = 1; } else if (driver_options) { - if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); emulate = 1; } - if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { emulate = 1; } - if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { execute_only = 1; } } else { @@ -573,12 +573,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) int query_len; convert_to_string_ex(tmp); - if (buffer_len < Z_STRLEN_P(tmp)) { - buffer_len = Z_STRLEN_P(tmp); + if (buffer_len < Z_STRSIZE_P(tmp)) { + buffer_len = Z_STRSIZE_P(tmp); query = erealloc(query, buffer_len + 2); /* room for \n\0 */ } - memcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); - query_len = Z_STRLEN_P(tmp); + memcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + query_len = Z_STRSIZE_P(tmp); if (query[query_len - 1] != '\n') { query[query_len++] = '\n'; } @@ -1056,11 +1056,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) array_init(return_value); if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_long(return_value, 1, pgsql_notify->be_pid); + add_index_int(return_value, 1, pgsql_notify->be_pid); } if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_long(return_value, "pid", pgsql_notify->be_pid); + add_assoc_int(return_value, "pid", pgsql_notify->be_pid); } PQfreemem(pgsql_notify); @@ -1079,7 +1079,7 @@ static PHP_METHOD(PDO, pgsqlGetPid) H = (pdo_pgsql_db_handle *)dbh->driver_data; - RETURN_LONG(PQbackendPID(H->server)); + RETURN_INT(PQbackendPID(H->server)); } /* }}} */ @@ -1113,17 +1113,17 @@ static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) switch (attr) { case PDO_ATTR_EMULATE_PREPARES: - convert_to_long(val); - H->emulate_prepares = Z_LVAL_P(val); + convert_to_int(val); + H->emulate_prepares = Z_IVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT: - convert_to_long(val); + convert_to_int(val); php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); - H->disable_native_prepares = Z_LVAL_P(val); + H->disable_native_prepares = Z_IVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_PREPARES: - convert_to_long(val); - H->disable_prepares = Z_LVAL_P(val); + convert_to_int(val); + H->disable_prepares = Z_IVAL_P(val); return 1; default: return 0; @@ -1172,7 +1172,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ } if (driver_options) { - connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); } if (dbh->password) { diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 10e775d899..b464211f90 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -358,7 +358,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * //SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); convert_to_string_ex(parameter); S->param_values[param->paramno] = Z_STRVAL_P(parameter); - S->param_lengths[param->paramno] = Z_STRLEN_P(parameter); + S->param_lengths[param->paramno] = Z_STRSIZE_P(parameter); S->param_formats[param->paramno] = 0; } @@ -592,7 +592,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return } array_init(return_value); - add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); + add_assoc_int(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 9b47af562c..27549bdc58 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -92,7 +92,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i pdo_sqlite_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -187,7 +187,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, stmt->methods = &sqlite_stmt_methods; stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED; - if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { + if (PDO_CURSOR_FWDONLY != pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { H->einfo.errcode = SQLITE_ERROR; pdo_sqlite_error(dbh); return 0; @@ -301,8 +301,8 @@ static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) switch (attr) { case PDO_ATTR_TIMEOUT: - convert_to_long(val); - sqlite3_busy_timeout(H->db, Z_LVAL_P(val) * 1000); + convert_to_int(val); + sqlite3_busy_timeout(H->db, Z_IVAL_P(val) * 1000); return 1; } return 0; @@ -351,14 +351,14 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, } ZVAL_REF(&zargs[0], agg_context); } - ZVAL_LONG(&zargs[1], sqlite3_aggregate_count(context)); + ZVAL_INT(&zargs[1], sqlite3_aggregate_count(context)); } for (i = 0; i < argc; i++) { /* get the value */ switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); break; case SQLITE_FLOAT: @@ -399,8 +399,8 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_LONG: - sqlite3_result_int(context, Z_LVAL(retval)); + case IS_INT: + sqlite3_result_int(context, Z_IVAL(retval)); break; case IS_NULL: @@ -413,7 +413,7 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); break; } } else { @@ -496,13 +496,13 @@ static int php_sqlite3_collation_callback(void *context, if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc TSRMLS_CC)) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } ret = 0; - if (Z_LVAL(retval) > 0) { + if (Z_IVAL(retval) > 0) { ret = 1; - } else if (Z_LVAL(retval) < 0) { + } else if (Z_IVAL(retval) < 0) { ret = -1; } zval_ptr_dtor(&retval); @@ -823,7 +823,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS } if (driver_options) { - timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); + timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); } sqlite3_busy_timeout(H->db, timeout * 1000); diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 5f18c8a0cf..ccd2dc5efd 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -117,13 +117,13 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d return 1; } } else { - convert_to_long(parameter); + convert_to_int(parameter); #if LONG_MAX > 2147483647 - if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { + if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { return 1; } #else - if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { + if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { return 1; } #endif @@ -159,7 +159,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d if (SQLITE_OK == sqlite3_bind_blob(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), SQLITE_STATIC)) { return 1; } @@ -180,7 +180,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d convert_to_string(parameter); if (SQLITE_OK == sqlite3_bind_text(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), SQLITE_STATIC)) { return 1; } diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 40f24ff940..2e86baf597 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -63,7 +63,7 @@ #define PGSQL_STATUS_LONG 1 #define PGSQL_STATUS_STRING 2 -#define PGSQL_MAX_LENGTH_OF_LONG 30 +#define PGSQL_MAX_LENGTH_OF_ZEND_INT 30 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60 #if LONG_MAX < UINT_MAX @@ -74,10 +74,10 @@ smart_str_0(&s); \ RETURN_STR(s.s); \ } \ - RETURN_LONG((long)oid); \ + RETURN_INT((long)oid); \ } while(0) #else -#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid)) +#define PGSQL_RETURN_OID(oid) (RETURN_INT((long)oid)) #endif #if HAVE_PQSETNONBLOCKING @@ -1113,88 +1113,88 @@ PHP_MINIT_FUNCTION(pgsql) REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT); #endif /* For connection option */ - REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); /* For pg_fetch_array() */ - REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); /* For pg_connection_status() */ - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); #ifdef CONNECTION_SSL_STARTUP - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); /* For pg_connect_poll() */ - REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); #if HAVE_PGTRANSACTIONSTATUS /* For pg_transaction_status() */ - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_PQSETERRORVERBOSITY /* For pg_set_error_verbosity() */ - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); #endif /* For lo_seek() */ - REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value type */ - REGISTER_LONG_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value */ - REGISTER_LONG_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); #if HAVE_PQRESULTERRORFIELD /* For pg_result_error_field() field codes */ - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); #ifdef PG_DIAG_INTERNAL_POSITION - REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); #endif #ifdef PG_DIAG_INTERNAL_QUERY - REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); #endif /* pg_convert options */ - REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); /* pg_insert/update/delete/select options */ - REGISTER_LONG_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -1288,16 +1288,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections * can re-use this connection. Bug #39979 */ - if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_LONG) { - if (Z_LVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { + if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_INT) { + if (Z_IVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { continue; - } else if (Z_LVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { - smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); + } else if (Z_IVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { + smart_str_append_int(&str, Z_IVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); } } convert_to_string_ex(&args[i]); smart_str_appendc(&str, '_'); - smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i])); + smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); } smart_str_0(&str); @@ -1306,8 +1306,8 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) connstring = Z_STRVAL(args[0]); } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */ connstring = Z_STRVAL(args[0]); - convert_to_long_ex(&args[1]); - connect_type = Z_LVAL(args[1]); + convert_to_int_ex(&args[1]); + connect_type = Z_IVAL(args[1]); } else { host = Z_STRVAL(args[0]); port = Z_STRVAL(args[1]); @@ -1535,7 +1535,7 @@ PHP_FUNCTION(pg_connect_poll) ret = PQconnectPoll(pgsql); - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1642,7 +1642,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type array_init(return_value); add_assoc_string(return_value, "client", PG_VERSION); #if HAVE_PQPROTOCOLVERSION - add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql)); + add_assoc_int(return_value, "protocol", PQprotocolVersion(pgsql)); #if HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3) { /* 8.0 or grater supports protorol version 3 */ @@ -1977,7 +1977,7 @@ PHP_FUNCTION(pg_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } i++; @@ -2178,7 +2178,7 @@ PHP_FUNCTION(pg_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -2252,17 +2252,17 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty switch (entry_type) { case PHP_PG_NUM_ROWS: - RETVAL_LONG(PQntuples(pgsql_result)); + RETVAL_INT(PQntuples(pgsql_result)); break; case PHP_PG_NUM_FIELDS: - RETVAL_LONG(PQnfields(pgsql_result)); + RETVAL_INT(PQnfields(pgsql_result)); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES - RETVAL_LONG(atoi(PQcmdTuples(pgsql_result))); + RETVAL_INT(atoi(PQcmdTuples(pgsql_result))); #else php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build"); - RETVAL_LONG(0); + RETVAL_INT(0); #endif break; default: @@ -2420,7 +2420,7 @@ PHP_FUNCTION(pg_field_table) RETURN_STR(oidstr.s); } else #endif - RETURN_LONG((long)oid); + RETURN_INT((long)oid); } /* try to lookup the table name in the resource list */ @@ -2503,7 +2503,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ RETURN_STRING(PQfname(pgsql_result, field)); break; case PHP_PG_FIELD_SIZE: - RETURN_LONG(PQfsize(pgsql_result, field)); + RETURN_INT(PQfsize(pgsql_result, field)); break; case PHP_PG_FIELD_TYPE: { char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC); @@ -2523,7 +2523,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ } else #endif { - RETURN_LONG((long)oid); + RETURN_INT((long)oid); } break; default: @@ -2582,7 +2582,7 @@ PHP_FUNCTION(pg_field_num) pgsql_result = pg_result->result; - RETURN_LONG(PQfnumber(pgsql_result, field)); + RETURN_INT(PQfnumber(pgsql_result, field)); } /* }}} */ @@ -2621,7 +2621,7 @@ PHP_FUNCTION(pg_fetch_result) pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + row, Z_IVAL_P(result)); RETURN_FALSE; } } @@ -2630,8 +2630,8 @@ PHP_FUNCTION(pg_fetch_result) field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2684,8 +2684,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, if (zrow == NULL) { row = -1; } else { - convert_to_long(zrow); - row = Z_LVAL_P(zrow); + convert_to_int(zrow); + row = Z_IVAL_P(zrow); if (row < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The row parameter must be greater or equal to zero"); RETURN_FALSE; @@ -2707,7 +2707,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, pg_result->row = pgsql_row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + row, Z_IVAL_P(result)); RETURN_FALSE; } } else { @@ -2972,7 +2972,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + row, Z_IVAL_P(result)); RETURN_FALSE; } } @@ -2983,8 +2983,8 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2994,10 +2994,10 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_DATA_LENGTH: - RETVAL_LONG(PQgetlength(pgsql_result, pgsql_row, field_offset)); + RETVAL_INT(PQgetlength(pgsql_result, pgsql_row, field_offset)); break; case PHP_PG_DATA_ISNULL: - RETVAL_LONG(PQgetisnull(pgsql_result, pgsql_row, field_offset)) + RETVAL_INT(PQgetisnull(pgsql_result, pgsql_row, field_offset)) break; } } @@ -3179,19 +3179,19 @@ PHP_FUNCTION(pg_lo_create) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_LONG: - if (Z_LVAL_P(oid) < (long)InvalidOid) { + case IS_INT: + if (Z_IVAL_P(oid) < (long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_LVAL_P(oid); + wanted_oid = (Oid)Z_IVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3501,7 +3501,7 @@ PHP_FUNCTION(pg_lo_write) RETURN_FALSE; } - RETURN_LONG(nbytes); + RETURN_INT(nbytes); } /* }}} */ @@ -3526,7 +3526,7 @@ PHP_FUNCTION(pg_lo_read_all) PHPWRITE(buf, nbytes); tbytes += nbytes; } - RETURN_LONG(tbytes); + RETURN_INT(tbytes); } /* }}} */ @@ -3579,19 +3579,19 @@ PHP_FUNCTION(pg_lo_import) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_LONG: - if (Z_LVAL_P(oid) < (long)InvalidOid) { + case IS_INT: + if (Z_IVAL_P(oid) < (long)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_LVAL_P(oid); + wanted_oid = (Oid)Z_IVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3769,7 +3769,7 @@ PHP_FUNCTION(pg_lo_tell) #else offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd); #endif - RETURN_LONG(offset); + RETURN_INT(offset); } /* }}} */ @@ -3837,7 +3837,7 @@ PHP_FUNCTION(pg_set_error_verbosity) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) { - RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity)); + RETURN_INT(PQsetErrorVerbosity(pgsql, verbosity)); } else { RETURN_FALSE; } @@ -3874,7 +3874,7 @@ PHP_FUNCTION(pg_set_client_encoding) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQsetClientEncoding(pgsql, encoding)); + RETURN_INT(PQsetClientEncoding(pgsql, encoding)); } /* }}} */ @@ -4175,10 +4175,10 @@ PHP_FUNCTION(pg_copy_from) #if HAVE_PQPUTCOPYDATA ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); - if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); + query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); + if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); @@ -4194,10 +4194,10 @@ PHP_FUNCTION(pg_copy_from) #else ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); - if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); + query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); + if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); @@ -4613,7 +4613,7 @@ PHP_FUNCTION(pg_connection_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQstatus(pgsql)); + RETURN_INT(PQstatus(pgsql)); } /* }}} */ @@ -4634,7 +4634,7 @@ PHP_FUNCTION(pg_transaction_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQtransactionStatus(pgsql)); + RETURN_INT(PQtransactionStatus(pgsql)); } #endif @@ -4709,10 +4709,10 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch(entry_type) { case PHP_PG_ASYNC_IS_BUSY: PQconsumeInput(pgsql); - RETVAL_LONG(PQisBusy(pgsql)); + RETVAL_INT(PQisBusy(pgsql)); break; case PHP_PG_ASYNC_REQUEST_CANCEL: - RETVAL_LONG(PQrequestCancel(pgsql)); + RETVAL_INT(PQrequestCancel(pgsql)); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } @@ -4819,7 +4819,7 @@ PHP_FUNCTION(pg_send_query) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -4879,7 +4879,7 @@ PHP_FUNCTION(pg_send_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -4924,7 +4924,7 @@ PHP_FUNCTION(pg_send_query_params) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -4998,7 +4998,7 @@ PHP_FUNCTION(pg_send_prepare) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -5060,7 +5060,7 @@ PHP_FUNCTION(pg_send_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -5104,7 +5104,7 @@ PHP_FUNCTION(pg_send_execute) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -5159,7 +5159,7 @@ PHP_FUNCTION(pg_result_status) pgsql_result = pg_result->result; if (result_type == PGSQL_STATUS_LONG) { status = PQresultStatus(pgsql_result); - RETURN_LONG((int)status); + RETURN_INT((int)status); } else if (result_type == PGSQL_STATUS_STRING) { RETURN_STRING(PQcmdStatus(pgsql_result)); @@ -5202,7 +5202,7 @@ PHP_FUNCTION(pg_get_notify) array_init(return_value); if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_long(return_value, 1, pgsql_notify->be_pid); + add_index_int(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5215,7 +5215,7 @@ PHP_FUNCTION(pg_get_notify) } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_long(return_value, "pid", pgsql_notify->be_pid); + add_assoc_int(return_value, "pid", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5245,7 +5245,7 @@ PHP_FUNCTION(pg_get_pid) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQbackendPID(pgsql)); + RETURN_INT(PQbackendPID(pgsql)); } /* }}} */ @@ -5384,7 +5384,7 @@ PHP_FUNCTION(pg_flush) switch (ret) { case 0: RETURN_TRUE; break; - case 1: RETURN_LONG(0); break; + case 1: RETURN_INT(0); break; default: RETURN_FALSE; } } @@ -5468,17 +5468,17 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z char *name; array_init(&elem); /* pg_attribute.attnum */ - add_assoc_long(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); + add_assoc_int(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); /* pg_type.typname */ add_assoc_string(&elem, "type", PQgetvalue(pg_result,i,2)); /* pg_attribute.attlen */ - add_assoc_long(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); + add_assoc_int(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); /* pg_attribute.attnonull */ add_assoc_bool(&elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t")); /* pg_attribute.atthasdef */ add_assoc_bool(&elem, "has default", !strcmp(PQgetvalue(pg_result,i,5), "t")); /* pg_attribute.attndims */ - add_assoc_long(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); + add_assoc_int(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); /* pg_type.typtype */ add_assoc_bool(&elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e")); if (extended) { @@ -5678,7 +5678,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) smart_str_appendc(&str, 'E'); smart_str_appendc(&str, '\''); - smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src)); + smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRSIZE_P(src)); smart_str_appendc(&str, '\''); smart_str_0(&str); @@ -5774,7 +5774,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* enums need to be treated like strings */ data_type = PG_TEXT; } else { - data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRLEN_P(type)); + data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRSIZE_P(type)); } switch(data_type) @@ -5782,7 +5782,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BOOL: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -5807,8 +5807,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_LONG: - if (Z_LVAL_P(val)) { + case IS_INT: + if (Z_IVAL_P(val)) { ZVAL_STRINGL(&new_val, "'t'", sizeof("'t'")-1); } else { @@ -5843,27 +5843,27 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } } break; case IS_DOUBLE: ZVAL_DOUBLE(&new_val, Z_DVAL_P(val)); - convert_to_long_ex(&new_val); + convert_to_int_ex(&new_val); break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_NULL: @@ -5885,12 +5885,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_FLOAT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { @@ -5899,8 +5899,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_DOUBLE: @@ -5941,7 +5941,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_UNKNOWN: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { if (opt & PGSQL_CONV_FORCE_NULL) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { @@ -5951,17 +5951,17 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con else { zend_string *str; /* PostgreSQL ignores \0 */ - str = STR_ALLOC(Z_STRLEN_P(val) * 2, 0); + str = STR_ALLOC(Z_STRSIZE_P(val) * 2, 0); /* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */ - str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); str = STR_REALLOC(str, str->len, 0); ZVAL_STR(&new_val, str); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -5988,28 +5988,28 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* these are the actallay a integer */ switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); - convert_to_long_ex(&new_val); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + convert_to_int_ex(&new_val); } } break; case IS_DOUBLE: ZVAL_DOUBLE(&new_val, Z_DVAL_P(val)); - convert_to_long_ex(&new_val); + convert_to_int_ex(&new_val); break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_NULL: @@ -6029,16 +6029,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INET: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? IPV6 and IPV4 */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6062,13 +6062,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIMESTAMP_WITH_TIMEZONE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else if (!strcasecmp(Z_STRVAL_P(val), "now()")) { ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(&new_val, Z_STRVAL_P(val)); @@ -6093,16 +6093,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_DATE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6124,16 +6124,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIME: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6155,7 +6155,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INTERVAL: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6176,7 +6176,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10 sec'. */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(@?[ \\t]+)?(" /* Textual time units and their abbreviations: */ @@ -6234,7 +6234,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BYTEA: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6242,22 +6242,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con size_t to_len; smart_str s = {0}; #ifdef HAVE_PQESCAPE_BYTEA_CONN - tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRLEN_P(val), &to_len); + tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRSIZE_P(val), &to_len); #else - tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRLEN_P(val), &to_len); + tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRSIZE_P(val), &to_len); #endif ZVAL_STRINGL(&new_val, (char *)tmp, to_len - 1); /* PQescapeBytea's to_len includes additional '\0' */ PQfreemem(tmp); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); - smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val)); + smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRSIZE(new_val)); smart_str_0(&s); zval_ptr_dtor(&new_val); ZVAL_STR(&new_val, s.s); } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -6283,15 +6283,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_MACADDR: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6502,18 +6502,18 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var if (opt & PGSQL_DML_ESCAPE) { size_t new_len; char *tmp; - tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); smart_str_appendc(&querystr, '\''); smart_str_appendl(&querystr, tmp, new_len); smart_str_appendc(&querystr, '\''); efree(tmp); } else { - smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); + smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } break; - case IS_LONG: - smart_str_append_long(&querystr, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(&querystr, Z_IVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val))); @@ -6671,18 +6671,18 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, case IS_STRING: if (opt & PGSQL_DML_ESCAPE) { size_t new_len; - tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); smart_str_appendc(querystr, '\''); smart_str_appendl(querystr, tmp, new_len); smart_str_appendc(querystr, '\''); efree(tmp); } else { - smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); + smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } break; - case IS_LONG: - smart_str_append_long(querystr, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(querystr, Z_IVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf)-1)); diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index 392f7d73ab..995d919505 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -307,7 +307,7 @@ notfound: } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } skip_phar: @@ -477,32 +477,32 @@ static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value T switch (type) { case FS_PERMS: - RETURN_LONG((long)stat_sb->st_mode); + RETURN_INT((long)stat_sb->st_mode); case FS_INODE: - RETURN_LONG((long)stat_sb->st_ino); + RETURN_INT((long)stat_sb->st_ino); case FS_SIZE: - RETURN_LONG((long)stat_sb->st_size); + RETURN_INT((long)stat_sb->st_size); case FS_OWNER: - RETURN_LONG((long)stat_sb->st_uid); + RETURN_INT((long)stat_sb->st_uid); case FS_GROUP: - RETURN_LONG((long)stat_sb->st_gid); + RETURN_INT((long)stat_sb->st_gid); case FS_ATIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_atime.tv_sec); + RETURN_INT((long)stat_sb->st_atime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_atime); + RETURN_INT((long)stat_sb->st_atime); #endif case FS_MTIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_mtime.tv_sec); + RETURN_INT((long)stat_sb->st_mtime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_mtime); + RETURN_INT((long)stat_sb->st_mtime); #endif case FS_CTIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_ctime.tv_sec); + RETURN_INT((long)stat_sb->st_ctime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_ctime); + RETURN_INT((long)stat_sb->st_ctime); #endif case FS_TYPE: if (S_ISLNK(stat_sb->st_mode)) { @@ -533,36 +533,36 @@ static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value T case FS_STAT: array_init(return_value); - ZVAL_LONG(&stat_dev, stat_sb->st_dev); - ZVAL_LONG(&stat_ino, stat_sb->st_ino); - ZVAL_LONG(&stat_mode, stat_sb->st_mode); - ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); - ZVAL_LONG(&stat_uid, stat_sb->st_uid); - ZVAL_LONG(&stat_gid, stat_sb->st_gid); + ZVAL_INT(&stat_dev, stat_sb->st_dev); + ZVAL_INT(&stat_ino, stat_sb->st_ino); + ZVAL_INT(&stat_mode, stat_sb->st_mode); + ZVAL_INT(&stat_nlink, stat_sb->st_nlink); + ZVAL_INT(&stat_uid, stat_sb->st_uid); + ZVAL_INT(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); + ZVAL_INT(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_sb->st_size); + ZVAL_INT(&stat_size, stat_sb->st_size); #ifdef NETWARE - ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec); - ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec); - ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec); + ZVAL_INT(&stat_atime, (stat_sb->st_atime).tv_sec); + ZVAL_INT(&stat_mtime, (stat_sb->st_mtime).tv_sec); + ZVAL_INT(&stat_ctime, (stat_sb->st_ctime).tv_sec); #else - ZVAL_LONG(&stat_atime, stat_sb->st_atime); - ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); - ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); + ZVAL_INT(&stat_atime, stat_sb->st_atime); + ZVAL_INT(&stat_mtime, stat_sb->st_mtime); + ZVAL_INT(&stat_ctime, stat_sb->st_ctime); #endif #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); + ZVAL_INT(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); + ZVAL_INT(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 62b08cc642..03686108d7 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1618,7 +1618,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_long(&filterparams, "window", MAX_WBITS + 32); + add_assoc_int(&filterparams, "window", MAX_WBITS + 32); /* entire file is gzip-compressed, uncompress to temporary file */ if (!(temp = php_stream_fopen_tmpfile())) { @@ -1630,7 +1630,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a if (!filter) { err = 1; - add_assoc_long(&filterparams, "window", MAX_WBITS); + add_assoc_int(&filterparams, "window", MAX_WBITS); filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC); zval_dtor(&filterparams); @@ -3230,7 +3230,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, zval filterparams; array_init(&filterparams); - add_assoc_long(&filterparams, "window", MAX_WBITS+16); + add_assoc_int(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index e9acfe435b..abb29fef72 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -75,7 +75,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char /* PATH_INFO and PATH_TRANSLATED should always be munged */ if (NULL != (stuff = zend_hash_str_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > entry_len && !memcmp(path_info, entry, entry_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len); @@ -99,7 +99,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len); @@ -111,7 +111,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); @@ -601,11 +601,11 @@ PHP_METHOD(Phar, webPhar) if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) && IS_STRING == Z_TYPE_P(z_path_info)) { - entry_len = Z_STRLEN_P(z_path_info); + entry_len = Z_STRSIZE_P(z_path_info); entry = estrndup(Z_STRVAL_P(z_path_info), entry_len); - path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1); - memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); - memcpy(path_info + Z_STRLEN_P(z_script_name), entry, entry_len + 1); + path_info = emalloc(Z_STRSIZE_P(z_script_name) + entry_len + 1); + memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); + memcpy(path_info + Z_STRSIZE_P(z_script_name), entry, entry_len + 1); free_pathinfo = 1; } else { entry_len = 0; @@ -613,7 +613,7 @@ PHP_METHOD(Phar, webPhar) path_info = Z_STRVAL_P(z_script_name); } - pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); + pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); } else { char *testit; @@ -702,8 +702,8 @@ PHP_METHOD(Phar, webPhar) switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); - entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); - entry_len = Z_STRLEN_P(fci.retval); + entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRSIZE_P(fci.retval)); + entry_len = Z_STRSIZE_P(fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -809,10 +809,10 @@ PHP_METHOD(Phar, webPhar) if (NULL != (val = zend_hash_str_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)))) { switch (Z_TYPE_P(val)) { - case IS_LONG: - if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) { + case IS_INT: + if (Z_IVAL_P(val) == PHAR_MIME_PHP || Z_IVAL_P(val) == PHAR_MIME_PHPS) { mime_type = ""; - code = Z_LVAL_P(val); + code = Z_IVAL_P(val); } else { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed"); #ifdef PHP_WIN32 @@ -876,11 +876,11 @@ PHP_METHOD(Phar, mungServer) return; } - if (Z_STRLEN_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { + if (Z_STRSIZE_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_PHP_SELF; } - if (Z_STRLEN_P(data) == sizeof("REQUEST_URI")-1) { + if (Z_STRSIZE_P(data) == sizeof("REQUEST_URI")-1) { if (!strncmp(Z_STRVAL_P(data), "REQUEST_URI", sizeof("REQUEST_URI")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_REQUEST_URI; } @@ -889,7 +889,7 @@ PHP_METHOD(Phar, mungServer) } } - if (Z_STRLEN_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { + if (Z_STRSIZE_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME; } } ZEND_HASH_FOREACH_END(); @@ -1214,7 +1214,7 @@ PHP_METHOD(Phar, __construct) } ZVAL_STRINGL(&arg1, fname, fname_len); - ZVAL_LONG(&arg2, flags); + ZVAL_INT(&arg2, flags); zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj), &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2); @@ -1435,7 +1435,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + str_key_len = Z_STRSIZE(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1504,7 +1504,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ } fname = Z_STRVAL_P(value); - fname_len = Z_STRLEN_P(value); + fname_len = Z_STRSIZE_P(value); phar_spl_fileinfo: if (base_len) { @@ -1563,7 +1563,7 @@ phar_spl_fileinfo: return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + str_key_len = Z_STRSIZE(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1737,7 +1737,7 @@ PHP_METHOD(Phar, buildFromDirectory) } ZVAL_STRINGL(&arg, dir, dir_len); - ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); + ZVAL_INT(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); @@ -1907,7 +1907,7 @@ PHP_METHOD(Phar, count) RETURN_FALSE; } - RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest)); + RETURN_INT(zend_hash_num_elements(&phar_obj->archive->manifest)); } /* }}} */ @@ -2506,11 +2506,11 @@ PHP_METHOD(Phar, isCompressed) } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) { - RETURN_LONG(PHAR_ENT_COMPRESSED_GZ); + RETURN_INT(PHAR_ENT_COMPRESSED_GZ); } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) { - RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2); + RETURN_INT(PHAR_ENT_COMPRESSED_BZ2); } RETURN_FALSE; @@ -4242,7 +4242,7 @@ PHP_METHOD(Phar, extractTo) goto all_files; case IS_STRING: filename = Z_STRVAL_P(zval_files); - filename_len = Z_STRLEN_P(zval_files); + filename_len = Z_STRSIZE_P(zval_files); break; case IS_ARRAY: nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); @@ -4419,7 +4419,7 @@ PHP_METHOD(PharFileInfo, getCompressedSize) return; } - RETURN_LONG(entry_obj->entry->compressed_filesize); + RETURN_INT(entry_obj->entry->compressed_filesize); } /* }}} */ @@ -4468,7 +4468,7 @@ PHP_METHOD(PharFileInfo, getCRC32) } if (entry_obj->entry->is_crc_checked) { - RETURN_LONG(entry_obj->entry->crc32); + RETURN_INT(entry_obj->entry->crc32); } else { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ "Phar entry was not CRC checked"); \ @@ -4502,7 +4502,7 @@ PHP_METHOD(PharFileInfo, getPharFlags) return; } - RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); + RETURN_INT(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); } /* }}} */ @@ -5266,8 +5266,8 @@ zend_function_entry phar_exception_methods[] = { }; /* }}} */ -#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #define phar_exception_get_default() zend_exception_get_default(TSRMLS_C) @@ -5301,20 +5301,20 @@ void phar_object_init(TSRMLS_D) /* {{{ */ phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS; #endif - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHP", PHAR_MIME_PHP) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "MD5", PHAR_SIG_MD5) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHP", PHAR_MIME_PHP) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "MD5", PHAR_SIG_MD5) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) } /* }}} */ diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 5aa6aa43ea..d4ff1efc76 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -213,11 +213,11 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 && (pzoption = zend_hash_str_find(pharcontext, "compress", sizeof("compress")-1)) != NULL - && Z_TYPE_P(pzoption) == IS_LONG - && (Z_LVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 + && Z_TYPE_P(pzoption) == IS_INT + && (Z_IVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 ) { idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; - idata->internal_file->flags |= Z_LVAL_P(pzoption); + idata->internal_file->flags |= Z_IVAL_P(pzoption); } if ((pzoption = zend_hash_str_find(pharcontext, "metadata", sizeof("metadata")-1)) != NULL) { if (Z_TYPE(idata->internal_file->metadata) != IS_UNDEF) { diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 6d210cbf5d..e2237cc9ba 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -1300,7 +1300,7 @@ nostub: #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_long(&filterparams, "window", MAX_WBITS + 16); + add_assoc_int(&filterparams, "window", MAX_WBITS + 16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/util.c b/ext/phar/util.c index 4bac776511..ba8eb7ba24 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1406,7 +1406,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, ZVAL_EMPTY_STRING(&zp[0]); } - if (end != Z_STRLEN(zp[0])) { + if (end != Z_STRSIZE(zp[0])) { zval_dtor(&zp[0]); zval_dtor(&zp[1]); zval_dtor(&zp[2]); @@ -1457,15 +1457,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, switch (Z_TYPE(retval)) { default: - case IS_LONG: + case IS_INT: zval_dtor(&zp[1]); - if (1 == Z_LVAL(retval)) { + if (1 == Z_IVAL(retval)) { return SUCCESS; } return FAILURE; case IS_TRUE: - *signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1])); - *signature_len = Z_STRLEN(zp[1]); + *signature = estrndup(Z_STRVAL(zp[1]), Z_STRSIZE(zp[1])); + *signature_len = Z_STRSIZE(zp[1]); zval_dtor(&zp[1]); return SUCCESS; case IS_FALSE: diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 301507f655..463cb76d36 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -325,24 +325,24 @@ static PHP_GINIT_FUNCTION(posix) /* {{{ */ */ static PHP_MINIT_FUNCTION(posix) { - REGISTER_LONG_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); #ifdef S_IFREG - REGISTER_LONG_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFCHR - REGISTER_LONG_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFBLK - REGISTER_LONG_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFIFO - REGISTER_LONG_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFSOCK - REGISTER_LONG_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -375,9 +375,9 @@ ZEND_GET_MODULE(posix) #define PHP_POSIX_NO_ARGS if (zend_parse_parameters_none() == FAILURE) return; -#define PHP_POSIX_RETURN_LONG_FUNC(func_name) \ +#define PHP_POSIX_RETURN_INT_FUNC(func_name) \ PHP_POSIX_NO_ARGS \ - RETURN_LONG(func_name()); + RETURN_INT(func_name()); #define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \ long val; \ @@ -412,7 +412,7 @@ PHP_FUNCTION(posix_kill) Get the current process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getpid) { - PHP_POSIX_RETURN_LONG_FUNC(getpid); + PHP_POSIX_RETURN_INT_FUNC(getpid); } /* }}} */ @@ -420,7 +420,7 @@ PHP_FUNCTION(posix_getpid) Get the parent process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getppid) { - PHP_POSIX_RETURN_LONG_FUNC(getppid); + PHP_POSIX_RETURN_INT_FUNC(getppid); } /* }}} */ @@ -428,7 +428,7 @@ PHP_FUNCTION(posix_getppid) Get the current user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getuid) { - PHP_POSIX_RETURN_LONG_FUNC(getuid); + PHP_POSIX_RETURN_INT_FUNC(getuid); } /* }}} */ @@ -436,7 +436,7 @@ PHP_FUNCTION(posix_getuid) Get the current group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getgid) { - PHP_POSIX_RETURN_LONG_FUNC(getgid); + PHP_POSIX_RETURN_INT_FUNC(getgid); } /* }}} */ @@ -444,7 +444,7 @@ PHP_FUNCTION(posix_getgid) Get the current effective user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_geteuid) { - PHP_POSIX_RETURN_LONG_FUNC(geteuid); + PHP_POSIX_RETURN_INT_FUNC(geteuid); } /* }}} */ @@ -452,7 +452,7 @@ PHP_FUNCTION(posix_geteuid) Get the current effective group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getegid) { - PHP_POSIX_RETURN_LONG_FUNC(getegid); + PHP_POSIX_RETURN_INT_FUNC(getegid); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(posix_getgroups) array_init(return_value); for (i=0; i<result; i++) { - add_next_index_long(return_value, gidlist[i]); + add_next_index_int(return_value, gidlist[i]); } } #endif @@ -540,7 +540,7 @@ PHP_FUNCTION(posix_getlogin) Get current process group id (POSIX.1, 4.3.1) */ PHP_FUNCTION(posix_getpgrp) { - PHP_POSIX_RETURN_LONG_FUNC(getpgrp); + PHP_POSIX_RETURN_INT_FUNC(getpgrp); } /* }}} */ @@ -549,7 +549,7 @@ PHP_FUNCTION(posix_getpgrp) #ifdef HAVE_SETSID PHP_FUNCTION(posix_setsid) { - PHP_POSIX_RETURN_LONG_FUNC(setsid); + PHP_POSIX_RETURN_INT_FUNC(setsid); } #endif /* }}} */ @@ -587,7 +587,7 @@ PHP_FUNCTION(posix_getpgid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_LONG(val); + RETURN_INT(val); } #endif /* }}} */ @@ -606,7 +606,7 @@ PHP_FUNCTION(posix_getsid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_LONG(val); + RETURN_INT(val); } #endif /* }}} */ @@ -658,11 +658,11 @@ PHP_FUNCTION(posix_times) array_init(return_value); - add_assoc_long(return_value, "ticks", ticks); /* clock ticks */ - add_assoc_long(return_value, "utime", t.tms_utime); /* user time */ - add_assoc_long(return_value, "stime", t.tms_stime); /* system time */ - add_assoc_long(return_value, "cutime", t.tms_cutime); /* user time of children */ - add_assoc_long(return_value, "cstime", t.tms_cstime); /* system time of children */ + add_assoc_int(return_value, "ticks", ticks); /* clock ticks */ + add_assoc_int(return_value, "utime", t.tms_utime); /* user time */ + add_assoc_int(return_value, "stime", t.tms_stime); /* system time */ + add_assoc_int(return_value, "cutime", t.tms_cutime); /* user time of children */ + add_assoc_int(return_value, "cstime", t.tms_cstime); /* system time of children */ } /* }}} */ @@ -738,8 +738,8 @@ PHP_FUNCTION(posix_ttyname) } break; default: - convert_to_long_ex(z_fd); - fd = Z_LVAL_P(z_fd); + convert_to_int_ex(z_fd); + fd = Z_IVAL_P(z_fd); } #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) buflen = sysconf(_SC_TTY_NAME_MAX); @@ -783,8 +783,8 @@ PHP_FUNCTION(posix_isatty) } break; default: - convert_to_long_ex(z_fd); - fd = Z_LVAL_P(z_fd); + convert_to_int_ex(z_fd); + fd = Z_IVAL_P(z_fd); } if (isatty(fd)) { @@ -931,7 +931,7 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ add_next_index_string(&array_members, g->gr_mem[count]); } zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members); - add_assoc_long(array_group, "gid", g->gr_gid); + add_assoc_int(array_group, "gid", g->gr_gid); return 1; } /* }}} */ @@ -1096,8 +1096,8 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */ add_assoc_string(return_value, "name", pw->pw_name); add_assoc_string(return_value, "passwd", pw->pw_passwd); - add_assoc_long (return_value, "uid", pw->pw_uid); - add_assoc_long (return_value, "gid", pw->pw_gid); + add_assoc_int (return_value, "uid", pw->pw_uid); + add_assoc_int (return_value, "gid", pw->pw_gid); add_assoc_string(return_value, "gecos", pw->pw_gecos); add_assoc_string(return_value, "dir", pw->pw_dir); add_assoc_string(return_value, "shell", pw->pw_shell); @@ -1229,13 +1229,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) { if (rl.rlim_cur == RLIM_INFINITY) { add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_long(return_value, soft, rl.rlim_cur); + add_assoc_int(return_value, soft, rl.rlim_cur); } if (rl.rlim_max == RLIM_INFINITY) { add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_long(return_value, hard, rl.rlim_max); + add_assoc_int(return_value, hard, rl.rlim_max); } return SUCCESS; @@ -1328,7 +1328,7 @@ PHP_FUNCTION(posix_get_last_error) { PHP_POSIX_NO_ARGS; - RETURN_LONG(POSIX_G(last_error)); + RETURN_INT(POSIX_G(last_error)); } /* }}} */ diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index f95ecc8b58..6d1a1026ea 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -249,10 +249,10 @@ static void php_pspell_close_config(zend_resource *rsrc TSRMLS_DC) */ static PHP_MINIT_FUNCTION(pspell) { - REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number); le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number); return SUCCESS; @@ -352,7 +352,7 @@ static PHP_FUNCTION(pspell_new) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -457,7 +457,7 @@ static PHP_FUNCTION(pspell_new_personal) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -487,7 +487,7 @@ static PHP_FUNCTION(pspell_new_config) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -744,7 +744,7 @@ static PHP_FUNCTION(pspell_config_create) pspell_config_replace(config, "save-repl", "false"); ind = zend_list_insert(config, le_pspell_config TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -798,7 +798,7 @@ static PHP_FUNCTION(pspell_config_mode) Ignore words <= n chars */ static PHP_FUNCTION(pspell_config_ignore) { - char ignore_str[MAX_LENGTH_OF_LONG + 1]; + char ignore_str[MAX_LENGTH_OF_ZEND_INT + 1]; long conf, ignore = 0L; PspellConfig *config; diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 22b727b6a4..ef82d5f8a3 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -250,21 +250,21 @@ PHP_FUNCTION(readline_info) if (!what) { array_init(return_value); add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer)); - add_assoc_long(return_value,"point",rl_point); - add_assoc_long(return_value,"end",rl_end); + add_assoc_int(return_value,"point",rl_point); + add_assoc_int(return_value,"end",rl_end); #ifdef HAVE_LIBREADLINE - add_assoc_long(return_value,"mark",rl_mark); - add_assoc_long(return_value,"done",rl_done); - add_assoc_long(return_value,"pending_input",rl_pending_input); + add_assoc_int(return_value,"mark",rl_mark); + add_assoc_int(return_value,"done",rl_done); + add_assoc_int(return_value,"pending_input",rl_pending_input); add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt)); add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name)); #endif #if HAVE_ERASE_EMPTY_LINE - add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); + add_assoc_int(return_value,"erase_empty_line",rl_erase_empty_line); #endif add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version)); add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name)); - add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over); + add_assoc_int(return_value,"attempted_completion_over",rl_attempted_completion_over); } else { if (!strcasecmp(what,"line_buffer")) { oldstr = rl_line_buffer; @@ -275,26 +275,26 @@ PHP_FUNCTION(readline_info) } RETVAL_STRING(SAFE_STRING(oldstr)); } else if (!strcasecmp(what, "point")) { - RETVAL_LONG(rl_point); + RETVAL_INT(rl_point); } else if (!strcasecmp(what, "end")) { - RETVAL_LONG(rl_end); + RETVAL_INT(rl_end); #ifdef HAVE_LIBREADLINE } else if (!strcasecmp(what, "mark")) { - RETVAL_LONG(rl_mark); + RETVAL_INT(rl_mark); } else if (!strcasecmp(what, "done")) { oldval = rl_done; if (value) { - convert_to_long_ex(value); - rl_done = Z_LVAL_P(value); + convert_to_int_ex(value); + rl_done = Z_IVAL_P(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } else if (!strcasecmp(what, "pending_input")) { oldval = rl_pending_input; if (value) { convert_to_string_ex(value); rl_pending_input = Z_STRVAL_P(value)[0]; } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } else if (!strcasecmp(what, "prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt)); } else if (!strcasecmp(what, "terminal_name")) { @@ -304,10 +304,10 @@ PHP_FUNCTION(readline_info) } else if (!strcasecmp(what, "erase_empty_line")) { oldval = rl_erase_empty_line; if (value) { - convert_to_long_ex(value); - rl_erase_empty_line = Z_LVAL_PP(value); + convert_to_int_ex(value); + rl_erase_empty_line = Z_IVAL_PP(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); #endif } else if (!strcasecmp(what,"library_version")) { RETVAL_STRING((char *)SAFE_STRING(rl_library_version)); @@ -322,10 +322,10 @@ PHP_FUNCTION(readline_info) } else if (!strcasecmp(what, "attempted_completion_over")) { oldval = rl_attempted_completion_over; if (value) { - convert_to_long_ex(value); - rl_attempted_completion_over = Z_LVAL_P(value); + convert_to_int_ex(value); + rl_attempted_completion_over = Z_IVAL_P(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } } } @@ -473,7 +473,7 @@ static void _readline_string_zval(zval *ret, const char *str) static void _readline_long_zval(zval *ret, long l) { - ZVAL_LONG(ret, l); + ZVAL_INT(ret, l); } static char **_readline_completion_cb(const char *text, int start, int end) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 9e09dff83b..40bb88813b 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -26,9 +26,9 @@ ps_module ps_mod_user = { PS_MOD_SID(user) }; -#define SESS_ZVAL_LONG(val, a) \ +#define SESS_ZVAL_INT(val, a) \ { \ - ZVAL_LONG(a, val); \ + ZVAL_INT(a, val); \ } #define SESS_ZVAL_STRING(vl, a) \ @@ -73,10 +73,10 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRML ret = SUCCESS; \ } else if (Z_TYPE(retval) == IS_FALSE) { \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \ + } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == -1)) { \ /* BC for clever users - Deprecate me */ \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \ + } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == 0)) { \ /* BC for clever users - Deprecate me */ \ ret = SUCCESS; \ } else { \ @@ -189,7 +189,7 @@ PS_GC_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_LONG(maxlifetime, &args[0]); + SESS_ZVAL_INT(maxlifetime, &args[0]); ps_call_handler(&PSF(gc), 1, args, &retval TSRMLS_CC); diff --git a/ext/session/session.c b/ext/session/session.c index b03cfaa614..6482073881 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1343,7 +1343,7 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */ STR_RELEASE(date_fmt); smart_str_appends(&ncookie, COOKIE_MAX_AGE); - smart_str_append_long(&ncookie, PS(cookie_lifetime)); + smart_str_append_int(&ncookie, PS(cookie_lifetime)); } } @@ -1412,7 +1412,7 @@ static void ppid2sid(zval *ppid TSRMLS_DC) { PS(send_cookie) = 1; } else { convert_to_string(ppid); - PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRLEN_P(ppid), 0); + PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRSIZE_P(ppid), 0); PS(send_cookie) = 0; } } @@ -1559,7 +1559,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) && (data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) && Z_TYPE_P(data) == IS_STRING && - Z_STRLEN_P(data) != 0 && + Z_STRSIZE_P(data) != 0 && strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL ) { STR_RELEASE(PS(id)); @@ -1655,7 +1655,7 @@ static PHP_FUNCTION(session_set_cookie_params) convert_to_string_ex(lifetime); ini_name = STR_INIT("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRLEN_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRSIZE_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); STR_RELEASE(ini_name); if (path) { @@ -1692,7 +1692,7 @@ static PHP_FUNCTION(session_get_cookie_params) array_init(return_value); - add_assoc_long(return_value, "lifetime", PS(cookie_lifetime)); + add_assoc_int(return_value, "lifetime", PS(cookie_lifetime)); add_assoc_string(return_value, "path", PS(cookie_path)); add_assoc_string(return_value, "domain", PS(cookie_domain)); add_assoc_bool(return_value, "secure", PS(cookie_secure)); @@ -2027,12 +2027,12 @@ static PHP_FUNCTION(session_cache_expire) return; } - RETVAL_LONG(PS(cache_expire)); + RETVAL_INT(PS(cache_expire)); if (expires) { convert_to_string_ex(expires); ini_name = STR_INIT("session.cache_expire", sizeof("session.cache_expire") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRLEN_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRSIZE_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); STR_RELEASE(ini_name); } } @@ -2156,7 +2156,7 @@ static PHP_FUNCTION(session_status) return; } - RETURN_LONG(PS(session_status)); + RETURN_INT(PS(session_status)); } /* }}} */ @@ -2459,9 +2459,9 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_iface_entry); zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_id_iface_entry); - REGISTER_LONG_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2602,7 +2602,7 @@ static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, int force_update TSRMLS_DC) /* {{{ */ { if (!force_update) { - if (Z_LVAL_P(progress->post_bytes_processed) < progress->next_update) { + if (Z_IVAL_P(progress->post_bytes_processed) < progress->next_update) { return; } #ifdef HAVE_GETTIMEOFDAY @@ -2617,7 +2617,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i progress->next_update_time = dtv + PS(rfc1867_min_freq); } #endif - progress->next_update = Z_LVAL_P(progress->post_bytes_processed) + progress->update_step; + progress->next_update = Z_IVAL_P(progress->post_bytes_processed) + progress->update_step; } php_session_initialize(TSRMLS_C); @@ -2719,16 +2719,16 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo array_init(&progress->data); array_init(&progress->files); - add_assoc_long_ex(&progress->data, "start_time", sizeof("start_time") - 1, (long)sapi_get_request_time(TSRMLS_C)); - add_assoc_long_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); - add_assoc_long_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); + add_assoc_int_ex(&progress->data, "start_time", sizeof("start_time") - 1, (long)sapi_get_request_time(TSRMLS_C)); + add_assoc_int_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); + add_assoc_int_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 0); add_assoc_zval_ex(&progress->data, "files", sizeof("files") - 1, &progress->files); progress->post_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->data), "bytes_processed", sizeof("bytes_processed") - 1); php_rinit_session(0 TSRMLS_CC); - PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0); + PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRSIZE(progress->sid), 0); PS(apply_trans_sid) = progress->apply_trans_sid; PS(send_cookie) = 0; } @@ -2739,17 +2739,17 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name); add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename); add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1); - add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0); + add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, 0); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 0); - add_assoc_long_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (long)time(NULL)); - add_assoc_long_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); + add_assoc_int_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (long)time(NULL)); + add_assoc_int_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); add_next_index_zval(&progress->files, &progress->current_file); progress->current_file_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->current_file), "bytes_processed", sizeof("bytes_processed") - 1); - Z_LVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; @@ -2760,8 +2760,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo break; } - Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2777,10 +2777,10 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename); } - add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); + add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 1); - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2793,7 +2793,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo php_session_rfc1867_cleanup(progress TSRMLS_CC); } else { add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 1); - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 1 TSRMLS_CC); } php_rshutdown_session_globals(TSRMLS_C); diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index c6569aa4c8..97e0ce14e9 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -216,7 +216,7 @@ PHP_FUNCTION(shmop_open) shmop->size = shm.shm_segsz; ZEND_REGISTER_RESOURCE(return_value, shmop, shm_type); - RETURN_LONG(Z_RES_HANDLE_P(return_value)); + RETURN_INT(Z_RES_HANDLE_P(return_value)); err: efree(shmop); RETURN_FALSE; @@ -289,7 +289,7 @@ PHP_FUNCTION(shmop_size) ZEND_FETCH_RESOURCE(shmop, struct php_shmop *, NULL, shmid, "shmop", shm_type); - RETURN_LONG(shmop->size); + RETURN_INT(shmop->size); } /* }}} */ @@ -322,7 +322,7 @@ PHP_FUNCTION(shmop_write) writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset; memcpy(shmop->addr + offset, data, writesize); - RETURN_LONG(writesize); + RETURN_INT(writesize); } /* }}} */ diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 014bf2f4f6..66d4bd2ab6 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -255,7 +255,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -299,11 +299,11 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (node) { if (attribs) { - if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) { - if (Z_TYPE_P(member) == IS_LONG) { - while (attr && nodendx <= Z_LVAL_P(member)) { + if (Z_TYPE_P(member) != IS_INT || sxe->iter.type == SXE_ITER_ATTRLIST) { + if (Z_TYPE_P(member) == IS_INT) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { _node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); break; } @@ -327,7 +327,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (!sxe->node) { php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL TSRMLS_CC); } - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { long cnt = 0; xmlNodePtr mynode = node; @@ -335,19 +335,19 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } if (sxe->iter.type == SXE_ITER_NONE) { - if (member && Z_LVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); + if (member && Z_IVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); } } else if (member) { - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); } else { node = NULL; } if (node) { _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); } else if (type == BP_VAR_W || type == BP_VAR_RW) { - if (member && cnt < Z_LVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_LVAL_P(member), cnt); + if (member && cnt < Z_IVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_IVAL_P(member), cnt); } node = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, NULL); _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); @@ -410,7 +410,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC) return; } switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -462,7 +462,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -479,12 +479,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool trim_zv = *member; zval_copy_ctor(&trim_zv); convert_to_string(&trim_zv); - php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); + php_trim(Z_STRVAL(trim_zv), Z_STRSIZE(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); zval_dtor(&trim_zv); member = &tmp_zv; } - if (!Z_STRLEN_P(member)) { + if (!Z_STRSIZE_P(member)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element"); if (member == &tmp_zv) { zval_dtor(&tmp_zv); @@ -525,7 +525,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (value) { switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -559,10 +559,10 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { - while (attr && nodendx <= Z_LVAL_P(member)) { + if (Z_TYPE_P(member) == IS_INT) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { is_attr = 1; ++counter; break; @@ -585,7 +585,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool } if (elements) { - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (node->type == XML_ATTRIBUTE_NODE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot create duplicate attribute"); return FAILURE; @@ -594,12 +594,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (sxe->iter.type == SXE_ITER_NONE) { newnode = node; ++counter; - if (member && Z_LVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); + if (member && Z_IVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); retval = FAILURE; } } else if (member) { - newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); + newnode = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); if (newnode) { ++counter; } @@ -636,21 +636,21 @@ next_iter: retval = FAILURE; } else if (elements) { if (!node) { - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } else { newnode = xmlNewTextChild(mynode, mynode->ns, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } - } else if (!member || Z_TYPE_P(member) == IS_LONG) { - if (member && cnt < Z_LVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_LVAL_P(member), cnt); + } else if (!member || Z_TYPE_P(member) == IS_INT) { + if (member && cnt < Z_IVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_IVAL_P(member), cnt); retval = FAILURE; } newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } } else if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %ld when only %d attributes exist", Z_LVAL_P(member), nodendx); + if (Z_TYPE_P(member) == IS_INT) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %ld when only %d attributes exist", Z_IVAL_P(member), nodendx); retval = FAILURE; } else { newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); @@ -735,7 +735,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend int test = 0; zval tmp_zv; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -746,7 +746,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -770,12 +770,12 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { int nodendx = 0; - while (attr && nodendx <= Z_LVAL_P(member)) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { exists = 1; break; } @@ -801,11 +801,11 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } if (elements) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); } else { node = node->children; @@ -865,7 +865,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zval tmp_zv; int test = 0; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -876,7 +876,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -900,12 +900,12 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { int nodendx = 0; - while (attr && nodendx <= Z_LVAL_P(member)) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { xmlUnlinkNode((xmlNodePtr) attr); php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC); break; @@ -928,11 +928,11 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, } if (elements) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); if (node) { xmlUnlinkNode(node); php_libxml_node_free_resource(node TSRMLS_CC); @@ -1770,8 +1770,8 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC) case _IS_BOOL: convert_to_boolean(object); break; - case IS_LONG: - convert_to_long(object); + case IS_INT: + convert_to_int(object); break; case IS_DOUBLE: convert_to_double(object); @@ -1903,8 +1903,8 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ zval_ptr_dtor(&intern->tmp); } ZVAL_ZVAL(&intern->tmp, &rv, 0, 0); - convert_to_long(&intern->tmp); - *count = (long)Z_LVAL(intern->tmp); + convert_to_int(&intern->tmp); + *count = (long)Z_IVAL(intern->tmp); return SUCCESS; } return FAILURE; @@ -1926,7 +1926,7 @@ SXE_METHOD(count) php_sxe_count_elements_helper(sxe, &count TSRMLS_CC); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index 50bd272204..3590fd8cf2 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -132,8 +132,8 @@ ZEND_END_MODULE_GLOBALS(snmp) #define SNMP_G(v) (snmp_globals.v) #endif -#define REGISTER_SNMP_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(php_snmp_ce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_SNMP_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(php_snmp_ce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #else diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 3afa0af9f1..4846af9446 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -680,7 +680,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D if (valueretrieval & SNMP_VALUE_OBJECT) { object_init(snmpval); - add_property_long(snmpval, "type", vars->type); + add_property_int(snmpval, "type", vars->type); add_property_zval(snmpval, "value", &val); } else { ZVAL_COPY(snmpval, &val); @@ -1014,8 +1014,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu objid_query->vars[objid_query->count].oid = Z_STRVAL_P(oid); if (st & SNMP_CMD_SET) { if (Z_TYPE_P(type) == IS_STRING && Z_TYPE_P(value) == IS_STRING) { - if (Z_STRLEN_P(type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRLEN_P(type)); + if (Z_STRSIZE_P(type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRSIZE_P(type)); efree(objid_query->vars); return FALSE; } @@ -1054,8 +1054,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu } else if (Z_TYPE_P(type) == IS_ARRAY) { if ((tmp_type = zend_hash_get_current_data_ex(Z_ARRVAL_P(type), &pos_type)) != NULL) { convert_to_string_ex(tmp_type); - if (Z_STRLEN_P(tmp_type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRLEN_P(tmp_type)); + if (Z_STRSIZE_P(tmp_type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRSIZE_P(tmp_type)); efree(objid_query->vars); return FALSE; } @@ -1781,7 +1781,7 @@ PHP_FUNCTION(snmp_get_valueretrieval) RETURN_FALSE; } - RETURN_LONG(SNMP_G(valueretrieval)); + RETURN_INT(SNMP_G(valueretrieval)); } /* }}} */ @@ -1942,7 +1942,7 @@ PHP_METHOD(snmp, getErrno) snmp_object = Z_SNMP_P(object); - RETVAL_LONG(snmp_object->snmp_errno); + RETVAL_INT(snmp_object->snmp_errno); return; } /* }}} */ @@ -2127,13 +2127,13 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ ZVAL_STRINGL(&val, snmp_object->session->peername, strlen(snmp_object->session->peername)); add_assoc_zval(retval, "hostname", &val); - ZVAL_LONG(&val, snmp_object->session->remote_port); + ZVAL_INT(&val, snmp_object->session->remote_port); add_assoc_zval(retval, "port", &val); - ZVAL_LONG(&val, snmp_object->session->timeout); + ZVAL_INT(&val, snmp_object->session->timeout); add_assoc_zval(retval, "timeout", &val); - ZVAL_LONG(&val, snmp_object->session->retries); + ZVAL_INT(&val, snmp_object->session->retries); add_assoc_zval(retval, "retries", &val); return SUCCESS; @@ -2144,7 +2144,7 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) { if (snmp_object->max_oids > 0) { - ZVAL_LONG(retval, snmp_object->max_oids); + ZVAL_INT(retval, snmp_object->max_oids); } else { ZVAL_NULL(retval); } @@ -2163,16 +2163,16 @@ PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(oid_increasing_check) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(quick_print) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(enum_print) -#define PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(name) \ +#define PHP_SNMP_INT_PROPERTY_READER_FUNCTION(name) \ static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) \ { \ - ZVAL_LONG(retval, snmp_object->name); \ + ZVAL_INT(retval, snmp_object->name); \ return SUCCESS; \ } -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(valueretrieval) -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(oid_output_format) -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(exceptions_enabled) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(valueretrieval) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(oid_output_format) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(exceptions_enabled) /* {{{ */ static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval TSRMLS_DC) @@ -2193,17 +2193,17 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval TS return ret; } - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ztmp = *newval; zval_copy_ctor(&ztmp); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - if (Z_LVAL_P(newval) > 0) { - snmp_object->max_oids = Z_LVAL_P(newval); + if (Z_IVAL_P(newval) > 0) { + snmp_object->max_oids = Z_IVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %ld", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %ld", Z_IVAL_P(newval)); } if (newval == &ztmp) { @@ -2220,17 +2220,17 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ztmp = *newval; zval_copy_ctor(&ztmp); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { - snmp_object->valueretrieval = Z_LVAL_P(newval); + if (Z_IVAL_P(newval) >= 0 && Z_IVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { + snmp_object->valueretrieval = Z_IVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%ld'", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%ld'", Z_IVAL_P(newval)); ret = FAILURE; } @@ -2264,23 +2264,23 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval * { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ZVAL_COPY(&ztmp, newval); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - switch(Z_LVAL_P(newval)) { + switch(Z_IVAL_P(newval)) { case NETSNMP_OID_OUTPUT_SUFFIX: case NETSNMP_OID_OUTPUT_MODULE: case NETSNMP_OID_OUTPUT_FULL: case NETSNMP_OID_OUTPUT_NUMERIC: case NETSNMP_OID_OUTPUT_UCD: case NETSNMP_OID_OUTPUT_NONE: - snmp_object->oid_output_format = Z_LVAL_P(newval); + snmp_object->oid_output_format = Z_IVAL_P(newval); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%ld'", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%ld'", Z_IVAL_P(newval)); ret = FAILURE; break; } @@ -2297,13 +2297,13 @@ static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ZVAL_COPY(&ztmp, newval); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - snmp_object->exceptions_enabled = Z_LVAL_P(newval); + snmp_object->exceptions_enabled = Z_IVAL_P(newval); if (newval == &ztmp) { zval_ptr_dtor(newval); @@ -2391,43 +2391,43 @@ PHP_MINIT_FUNCTION(snmp) zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1); PHP_SNMP_ADD_PROPERTIES(&php_snmp_properties, php_snmp_property_entries); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); - - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_1", SNMP_VERSION_1); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2c", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2C", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_3", SNMP_VERSION_3); - - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); + + REGISTER_SNMP_CLASS_CONST_INT("VERSION_1", SNMP_VERSION_1); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_2c", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_2C", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_3", SNMP_VERSION_3); + + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); /* Register SNMPException class */ INIT_CLASS_ENTRY(cex, "SNMPException", NULL); diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 8aeab65a1b..28ffc618b9 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -145,7 +145,7 @@ encode defaultEncoding[] = { {{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null}, {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string}, - {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, + {{IS_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{IS_FALSE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, {{IS_TRUE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, @@ -317,7 +317,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1)); @@ -334,7 +334,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1); @@ -397,23 +397,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype)); } else { zns = NULL; - enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); + enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); } if (enc == NULL && SOAP_GLOBAL(typemap)) { smart_str nscat = {0}; if (zns != NULL) { - smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRLEN_P(zns)); + smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRSIZE_P(zns)); smart_str_appendc(&nscat, ':'); } - smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); + smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); smart_str_0(&nscat); enc = zend_hash_find_ptr(SOAP_GLOBAL(typemap), nscat.s); smart_str_free(&nscat); } } if (enc == NULL) { - enc = get_conversion(Z_LVAL_P(ztype)); + enc = get_conversion(Z_IVAL_P(ztype)); } if (enc == NULL) { enc = encode; @@ -449,7 +449,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) { if (Z_TYPE_P(tmp) == IS_STRING && - ce->name->len == Z_STRLEN_P(tmp) && + ce->name->len == Z_STRSIZE_P(tmp) && zend_binary_strncasecmp(ce->name->val, ce->name->len, Z_STRVAL_P(tmp), ce->name->len, ce->name->len) == 0 && type_name) { @@ -600,7 +600,7 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par soap_error0(E_ERROR, "Encoding: Error calling to_xml callback"); } if (Z_TYPE(return_value) == IS_STRING) { - xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRLEN(return_value)); + xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRSIZE(return_value)); if (doc && doc->children) { ret = xmlDocCopyNode(doc->children, parent->doc, 1); } @@ -831,15 +831,15 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); - new_len = Z_STRLEN_P(data); + str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); + new_len = Z_STRSIZE_P(data); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); - new_len = Z_STRLEN(tmp); + str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + new_len = Z_STRSIZE(tmp); zval_dtor(&tmp); } @@ -918,7 +918,7 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data)); + str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRSIZE_P(data)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); STR_RELEASE(str); @@ -927,7 +927,7 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo ZVAL_DUP(&tmp, data); convert_to_string(&tmp); - str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp)); + str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRSIZE(tmp)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); STR_RELEASE(str); @@ -958,15 +958,15 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo convert_to_string(&tmp); data = &tmp; } - str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); + str = (unsigned char *) safe_emalloc(Z_STRSIZE_P(data) * 2, sizeof(char), 1); - for (i = j = 0; i < Z_STRLEN_P(data); i++) { + for (i = j = 0; i < Z_STRSIZE_P(data); i++) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4]; str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15]; } str[j] = '\0'; - text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char)); + text = xmlNewTextLen(str, Z_STRSIZE_P(data) * 2 * sizeof(char)); xmlAddChild(ret, text); efree(str); if (data == &tmp) { @@ -991,7 +991,7 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML whiteSpace_collapse(data->children->content); switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_LONG: + case IS_INT: ZVAL_DOUBLE(ret, lval); break; case IS_DOUBLE: @@ -1031,8 +1031,8 @@ static zval *to_zval_long(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_ errno = 0; switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_LONG: - ZVAL_LONG(ret, lval); + case IS_INT: + ZVAL_INT(ret, lval); break; case IS_DOUBLE: ZVAL_DOUBLE(ret, dval); @@ -1066,11 +1066,11 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode zval tmp = *data; zval_copy_ctor(&tmp); - if (Z_TYPE(tmp) != IS_LONG) { - convert_to_long(&tmp); + if (Z_TYPE(tmp) != IS_INT) { + convert_to_int(&tmp); } convert_to_string(&tmp); - xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); + xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); zval_dtor(&tmp); } @@ -2347,10 +2347,10 @@ iterator_done: } } - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } efree(value); @@ -2375,15 +2375,15 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } } else { dims = emalloc(sizeof(int)); *dims = 0; - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); } } else if (sdl_type && sdl_type->attributes && @@ -2395,10 +2395,10 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } if (sdl_type && sdl_type->elements && @@ -2422,14 +2422,14 @@ iterator_done: enc = elementType->encode; get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type); - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } else { enc = get_array_type(xmlParam, data, &array_type TSRMLS_CC); - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } @@ -2712,7 +2712,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP xmlNodeSetContent(key, BAD_CAST(key_val->val)); } else { smart_str tmp = {0}; - smart_str_append_long(&tmp, int_val); + smart_str_append_int(&tmp, int_val); smart_str_0(&tmp); if (style == SOAP_ENCODED) { @@ -2765,8 +2765,8 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_D if (Z_TYPE(key) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(ret), Z_STR(key), &value); - } else if (Z_TYPE(key) == IS_LONG) { - zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL(key), &value); + } else if (Z_TYPE(key) == IS_INT) { + zend_hash_index_update(Z_ARRVAL_P(ret), Z_IVAL(key), &value); } else { soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys"); } @@ -2863,7 +2863,7 @@ static zval *guess_zval_convert(zval *ret, encodeTypePtr type, xmlNodePtr data T xmlNsPtr nsptr; object_init_ex(&soapvar, soap_var_class_entry); - add_property_long(&soapvar, "enc_type", enc->details.type); + add_property_int(&soapvar, "enc_type", enc->details.type); Z_DELREF_P(ret); add_property_zval(&soapvar, "enc_value", ret); parse_namespace(type_name, &cptype, &ns); @@ -2896,12 +2896,12 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlAddChild(parent, xmlParam); FIND_ZVAL_NULL(data, xmlParam, style); - if (Z_TYPE_P(data) == IS_LONG) { - timestamp = Z_LVAL_P(data); + if (Z_TYPE_P(data) == IS_INT) { + timestamp = Z_IVAL_P(data); ta = php_localtime_r(×tamp, &tmbuf); /*ta = php_gmtime_r(×tamp, &tmbuf);*/ if (!ta) { - soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_LVAL_P(data)); + soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_IVAL_P(data)); } buf = (char *) emalloc(buf_len); @@ -2935,7 +2935,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlNodeSetContent(xmlParam, BAD_CAST(buf)); efree(buf); } else if (Z_TYPE_P(data) == IS_STRING) { - xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); + xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); } if (style == SOAP_ENCODED) { @@ -3043,7 +3043,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP convert_to_string(&tmp); data = &tmp; } - str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); + str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); whiteSpace_collapse(BAD_CAST(str)); start = str; while (start != NULL && *start != '\0') { @@ -3144,13 +3144,13 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP return ret; } if (Z_TYPE_P(data) == IS_STRING) { - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); zval_dtor(&tmp); } @@ -3251,20 +3251,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo if (type) { if (type->restrictions && Z_TYPE_P(data) == IS_STRING) { if (type->restrictions->enumeration) { - if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) { + if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRSIZE_P(data)+1)) { soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data)); } } if (type->restrictions->minLength && - Z_STRLEN_P(data) < type->restrictions->minLength->value) { + Z_STRSIZE_P(data) < type->restrictions->minLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'"); } if (type->restrictions->maxLength && - Z_STRLEN_P(data) > type->restrictions->maxLength->value) { + Z_STRSIZE_P(data) > type->restrictions->maxLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'"); } if (type->restrictions->length && - Z_STRLEN_P(data) != type->restrictions->length->value) { + Z_STRSIZE_P(data) != type->restrictions->length->value) { soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); } } @@ -3426,7 +3426,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) while (1) { smart_str_appendl(&prefix, "ns", 2); - smart_str_append_long(&prefix, num); + smart_str_append_int(&prefix, num); smart_str_0(&prefix); if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.s->val)) == NULL) { break; @@ -3536,7 +3536,7 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } - cur_type = Z_LVAL_P(ztype); + cur_type = Z_IVAL_P(ztype); if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) { cur_stype = Z_STRVAL_P(ztype); diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index bb2a6c7a53..4ad824ae41 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -40,10 +40,10 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -67,10 +67,10 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string* buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -95,7 +95,7 @@ void http_context_headers(php_stream_context* context, if (context && (tmp = php_stream_context_get_option(context, "http", "header")) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp)) { char *s = Z_STRVAL_P(tmp); char *p; int name_len; @@ -170,17 +170,17 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_LONG) { + Z_TYPE_P(proxy_port) == IS_INT) { host = Z_STRVAL_P(proxy_host); - port = Z_LVAL_P(proxy_port); + port = Z_IVAL_P(proxy_port); *use_proxy = 1; } else { host = phpurl->host; port = phpurl->port; } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) { - tv.tv_sec = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) > 0) { + tv.tv_sec = Z_IVAL_P(tmp); tv.tv_usec = 0; timeout = &tv; } @@ -191,9 +191,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph /* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */ if (use_ssl && !*use_proxy) { if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { + Z_TYPE_P(tmp) == IS_INT) { /* uses constants declared in soap.c to determine ssl uri protocol */ - switch (Z_LVAL_P(tmp)) { + switch (Z_IVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: protocol = "tls"; break; @@ -274,8 +274,8 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph proper encrypyion method based on constants defined in soap.c */ int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - switch (Z_LVAL_P(tmp)) { + Z_TYPE_P(tmp) == IS_INT) { + switch (Z_IVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; break; @@ -363,13 +363,13 @@ int make_http_soap_request(zval *this_ptr, request = buf; request_size = buf_size; /* Compress request */ - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - int level = Z_LVAL_P(tmp) & 0x0f; - int kind = Z_LVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + int level = Z_IVAL_P(tmp) & 0x0f; + int kind = Z_IVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; if (level > 9) {level = 9;} - if ((Z_LVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { + if ((Z_IVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n"); } if (level > 0) { @@ -379,7 +379,7 @@ int make_http_soap_request(zval *this_ptr, int n; ZVAL_STRINGL(¶ms[0], buf, buf_size); - ZVAL_LONG(¶ms[1], level); + ZVAL_INT(¶ms[1], level); if (kind == SOAP_COMPRESSION_DEFLATE) { n = 2; ZVAL_STRING(&func, "gzcompress"); @@ -388,7 +388,7 @@ int make_http_soap_request(zval *this_ptr, n = 3; ZVAL_STRING(&func, "gzencode"); smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n"); - ZVAL_LONG(¶ms[2], 0x1f); + ZVAL_INT(¶ms[2], 0x1f); } if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && Z_TYPE(retval) == IS_STRING) { @@ -396,7 +396,7 @@ int make_http_soap_request(zval *this_ptr, zval_ptr_dtor(&func); // TODO: free retval ??? request = Z_STRVAL(retval); - request_size = Z_STRLEN(retval); + request_size = Z_STRSIZE(retval); } else { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); @@ -409,8 +409,8 @@ int make_http_soap_request(zval *this_ptr, if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1)) != NULL) { php_stream_from_zval_no_verify(stream,tmp); - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - use_proxy = Z_LVAL_P(tmp); + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + use_proxy = Z_IVAL_P(tmp); } } else { stream = NULL; @@ -427,9 +427,9 @@ int make_http_soap_request(zval *this_ptr, if (context && (tmp = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) { - if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &redirect_max, NULL, 1)) { - if (Z_TYPE_P(tmp) == IS_LONG) - redirect_max = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), &redirect_max, NULL, 1)) { + if (Z_TYPE_P(tmp) == IS_INT) + redirect_max = Z_IVAL_P(tmp); } } @@ -504,7 +504,7 @@ try_again: if (stream) { php_stream_auto_cleanup(stream); add_property_resource(this_ptr, "httpsocket", stream->res); - add_property_long(this_ptr, "_use_proxy", use_proxy); + add_property_int(this_ptr, "_use_proxy", use_proxy); } else { php_url_free(phpurl); if (request != buf) {efree(request);} @@ -566,7 +566,7 @@ try_again: } if (!http_1_1 || ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL && - Z_LVAL_P(tmp) == 0)) { + Z_IVAL_P(tmp) == 0)) { smart_str_append_const(&soap_headers, "\r\n" "Connection: close\r\n"); } else { @@ -575,17 +575,17 @@ try_again: } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRLEN_P(tmp) > 0) { + if (Z_STRSIZE_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (context && (tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRLEN_P(tmp) > 0) { + if (Z_STRSIZE_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (FG(user_agent)) { @@ -615,7 +615,7 @@ try_again: } } smart_str_append_const(&soap_headers,"Content-Length: "); - smart_str_append_long(&soap_headers, request_size); + smart_str_append_int(&soap_headers, request_size); smart_str_append_const(&soap_headers, "\r\n"); /* HTTP Authentication */ @@ -637,38 +637,38 @@ try_again: make_digest(cnonce, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - Z_LVAL_P(tmp)++; - snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + Z_IVAL_P(tmp)++; + snprintf(nc, sizeof(nc), "%08ld", Z_IVAL_P(tmp)); } else { - add_assoc_long(digest, "nc", 1); + add_assoc_int(digest, "nc", 1); strcpy(nc, "00000001"); } PHP_MD5Init(&md5ctx); - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRLEN_P(login)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRSIZE_P(login)); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRSIZE_P(password)); } PHP_MD5Final(hash, &md5ctx); make_digest(HA1, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING && - Z_STRLEN_P(tmp) == sizeof("md5-sess")-1 && + Z_STRSIZE_P(tmp) == sizeof("md5-sess")-1 && stricmp(Z_STRVAL_P(tmp), "md5-sess") == 0) { PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); @@ -692,7 +692,7 @@ try_again: /* if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING && - Z_STRLEN_PP(tmp) == sizeof("auth-int")-1 && + Z_STRSIZE_PP(tmp) == sizeof("auth-int")-1 && stricmp(Z_STRVAL_PP(tmp), "auth-int") == 0) { PHP_MD5Update(&md5ctx, ":", 1); PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN); @@ -706,7 +706,7 @@ try_again: PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && @@ -724,16 +724,16 @@ try_again: make_digest(response, hash); smart_str_append_const(&soap_headers, "Authorization: Digest username=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRSIZE_P(login)); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", realm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", nonce=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } smart_str_append_const(&soap_headers, "\", uri=\""); if (phpurl->path) { @@ -763,12 +763,12 @@ try_again: if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", opaque=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", algorithm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } smart_str_append_const(&soap_headers, "\"\r\n"); } @@ -776,11 +776,11 @@ try_again: zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -819,13 +819,13 @@ try_again: Z_TYPE_P(value) == IS_STRING) { zval *tmp; if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL || - strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) && + strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRSIZE_P(tmp)) == 0) && ((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL || in_domain(phpurl->host,Z_STRVAL_P(tmp))) && (use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) { smart_str_appendl(&soap_headers, key->val, key->len); smart_str_appendc(&soap_headers, '='); - smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRLEN_P(value)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRSIZE_P(value)); smart_str_appendc(&soap_headers, ';'); } } @@ -841,7 +841,7 @@ try_again: smart_str_append_const(&soap_headers, "\r\n"); smart_str_0(&soap_headers); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len); } smart_str_appendl(&soap_headers, request, request_size); @@ -886,7 +886,7 @@ try_again: } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size); } @@ -1283,9 +1283,9 @@ try_again: if (http_status >= 400) { int error = 0; - if (Z_STRLEN_P(return_value) == 0) { + if (Z_STRSIZE_P(return_value) == 0) { error = 1; - } else if (Z_STRLEN_P(return_value) > 0) { + } else if (Z_STRSIZE_P(return_value) > 0) { if (!content_type_xml) { char *s = Z_STRVAL_P(return_value); diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 5ba3bd3de5..b1fb8935b4 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -460,7 +460,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -558,7 +558,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -1931,7 +1931,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len); diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 8de779a5f7..e9c681a74f 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -292,9 +292,9 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC) zval new_header; rest += 2; - ZVAL_STR(&new_header, STR_ALLOC(Z_STRLEN_P(header) - (rest - s), 0)); + ZVAL_STR(&new_header, STR_ALLOC(Z_STRSIZE_P(header) - (rest - s), 0)); memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header)); - memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1); + memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRSIZE_P(header) - (rest - Z_STRVAL_P(header)) + 1); ZVAL_COPY(&ctx->old_header, header); php_stream_context_set_option(ctx->context, "http", "header", &new_header); zval_dtor(&new_header); @@ -1805,7 +1805,7 @@ static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, sm if (enc) { zval *encoder_num; if ((encoder_num = zend_hash_str_find(tmp_encoders, (char*)&enc, sizeof(enc))) != 0) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(encoder_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(encoder_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1818,7 +1818,7 @@ static void sdl_serialize_type_ref(sdlTypePtr type, HashTable *tmp_types, smart_ if (type) { zval *type_num; if ((type_num = zend_hash_str_find(tmp_types, (char*)&type, sizeof(type))) != NULL) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(type_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(type_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1974,7 +1974,7 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) { sdl_serialize_key(key, out); sdl_serialize_type(tmp, tmp_encoders, tmp_types, out); - ZVAL_LONG(&zv, i); + ZVAL_INT(&zv, i); zend_hash_str_add(tmp_elements, (char*)&tmp, sizeof(tmp), &zv); i--; } ZEND_HASH_FOREACH_END(); @@ -2140,7 +2140,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->groups, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2157,7 +2157,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->types, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2174,7 +2174,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->elements, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2191,7 +2191,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->encoders, tmp) { - ZVAL_LONG(&zv, encoder_num); + ZVAL_INT(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&tmp, sizeof(tmp), &zv); ++encoder_num; } ZEND_HASH_FOREACH_END(); @@ -2200,7 +2200,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s while (enc->details.type != END_KNOWN_TYPES) { zval zv; - ZVAL_LONG(&zv, encoder_num); + ZVAL_INT(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), &zv); enc++; ++encoder_num; @@ -2272,7 +2272,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_1(0,out); } - ZVAL_LONG(&zv, binding_num); + ZVAL_INT(&zv, binding_num); zend_hash_str_add(&tmp_bindings, (char*)&tmp, sizeof(tmp), &zv); binding_num++; } ZEND_HASH_FOREACH_END(); @@ -2296,8 +2296,8 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s if (tmp->binding) { binding_num = zend_hash_str_find(&tmp_bindings,(char*)&tmp->binding, sizeof(tmp->binding)); if (binding_num) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(binding_num), out); - if (Z_LVAL_P(binding_num) >= 0) { + WSDL_CACHE_PUT_INT(Z_IVAL_P(binding_num), out); + if (Z_IVAL_P(binding_num) >= 0) { if (tmp->binding->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) { sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)tmp->bindingAttributes; WSDL_CACHE_PUT_1(binding->style, out); @@ -2338,7 +2338,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_INT(0, out); } - ZVAL_LONG(&zv, function_num); + ZVAL_INT(&zv, function_num); zend_hash_str_add(&tmp_functions, (char*)&tmp, sizeof(tmp), &zv); function_num++; } ZEND_HASH_FOREACH_END(); @@ -2358,7 +2358,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->requests, key, tmp) { function_num = zend_hash_str_find(&tmp_functions, (char*)&tmp, sizeof(tmp)); - WSDL_CACHE_PUT_INT(Z_LVAL_P(function_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(function_num), out); sdl_serialize_key(key, out); } ZEND_HASH_FOREACH_END(); } @@ -3230,7 +3230,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp) > 0) { smart_str_appends(&headers, "User-Agent: "); smart_str_appends(&headers, Z_STRVAL_P(tmp)); smart_str_appends(&headers, "\r\n"); @@ -3239,7 +3239,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_LONG) { + Z_TYPE_P(proxy_port) == IS_INT) { zval str_port, str_proxy; smart_str proxy = {0}; ZVAL_DUP(&str_port, proxy_port); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a1d2ca4f48..7a2eea242c 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -687,103 +687,103 @@ PHP_MINIT_FUNCTION(soap) le_service = zend_register_list_destructors_ex(delete_service_res, NULL, "SOAP service", module_number); le_typemap = zend_register_list_destructors_ex(delete_hashtable_res, NULL, "SOAP table", module_number); - REGISTER_LONG_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); /* New SOAP SSL Method Constants */ - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); old_error_handler = zend_error_cb; zend_error_cb = soap_error_handler; @@ -855,13 +855,13 @@ PHP_METHOD(SoapHeader, SoapHeader) } add_property_bool(this_ptr, "mustUnderstand", must_understand); if (actor == NULL) { - } else if (Z_TYPE_P(actor) == IS_LONG && - (Z_LVAL_P(actor) == SOAP_ACTOR_NEXT || - Z_LVAL_P(actor) == SOAP_ACTOR_NONE || - Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { - add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); - } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) { - add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor)); + } else if (Z_TYPE_P(actor) == IS_INT && + (Z_IVAL_P(actor) == SOAP_ACTOR_NEXT || + Z_IVAL_P(actor) == SOAP_ACTOR_NONE || + Z_IVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { + add_property_int(this_ptr, "actor", Z_IVAL_P(actor)); + } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRSIZE_P(actor) > 0) { + add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRSIZE_P(actor)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor"); } @@ -886,7 +886,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(code) == IS_NULL) { } else if (Z_TYPE_P(code) == IS_STRING) { fault_code = Z_STRVAL_P(code); - fault_code_len = Z_STRLEN_P(code); + fault_code_len = Z_STRSIZE_P(code); } else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) { zval *t_ns, *t_code; @@ -897,7 +897,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { fault_code_ns = Z_STRVAL_P(t_ns); fault_code = Z_STRVAL_P(t_code); - fault_code_len = Z_STRLEN_P(t_code); + fault_code_len = Z_STRSIZE_P(t_code); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code"); return; @@ -957,8 +957,8 @@ PHP_METHOD(SoapFault, __toString) zval_ptr_dtor(&fci.function_name); str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s", - Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line), - Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); + Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_IVAL_P(line), + Z_STRSIZE(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); zval_ptr_dtor(&trace); @@ -980,10 +980,10 @@ PHP_METHOD(SoapVar, SoapVar) this_ptr = getThis(); if (Z_TYPE_P(type) == IS_NULL) { - add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE); + add_property_int(this_ptr, "enc_type", UNKNOWN_TYPE); } else { - if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) { - add_property_long(this_ptr, "enc_type", Z_LVAL_P(type)); + if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_IVAL_P(type))) { + add_property_int(this_ptr, "enc_type", Z_IVAL_P(type)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type ID"); return; @@ -1145,9 +1145,9 @@ PHP_METHOD(SoapServer, SoapServer) zval *tmp; if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_1_1 || Z_LVAL_P(tmp) == SOAP_1_2)) { - version = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_1_1 || Z_IVAL_P(tmp) == SOAP_1_2)) { + version = Z_IVAL_P(tmp); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'soap_version' option must be SOAP_1_1 or SOAP_1_2"); } @@ -1155,14 +1155,14 @@ PHP_METHOD(SoapServer, SoapServer) if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode"); } if ((tmp = zend_hash_str_find(ht, "actor", sizeof("actor")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && @@ -1190,13 +1190,13 @@ PHP_METHOD(SoapServer, SoapServer) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - service->features = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + service->features = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - cache_wsdl = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + cache_wsdl = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "send_errors", sizeof("send_errors")-1)) != NULL) { @@ -1204,8 +1204,8 @@ PHP_METHOD(SoapServer, SoapServer) service->send_errors = 0; } else if (Z_TYPE_P(tmp) == IS_TRUE) { service->send_errors = 1; - } else if (Z_TYPE_P(tmp) == IS_LONG) { - service->send_errors = Z_LVAL_P(tmp); + } else if (Z_TYPE_P(tmp) == IS_INT) { + service->send_errors = Z_IVAL_P(tmp); } } @@ -1421,8 +1421,8 @@ PHP_METHOD(SoapServer, addFunction) return; } - key = STR_ALLOC(Z_STRLEN_P(tmp_function), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function)); + key = STR_ALLOC(Z_STRSIZE_P(tmp_function), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRSIZE_P(tmp_function)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function)); @@ -1439,8 +1439,8 @@ PHP_METHOD(SoapServer, addFunction) zend_string *key; zend_function *f; - key = STR_ALLOC(Z_STRLEN_P(function_name), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); + key = STR_ALLOC(Z_STRSIZE_P(function_name), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); @@ -1455,8 +1455,8 @@ PHP_METHOD(SoapServer, addFunction) ZVAL_STR(&function_copy, STR_COPY(f->common.function_name)); zend_hash_update(service->soap_functions.ft, key, &function_copy); STR_RELEASE(key); - } else if (Z_TYPE_P(function_name) == IS_LONG) { - if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { + } else if (Z_TYPE_P(function_name) == IS_INT) { + if (Z_IVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { if (service->soap_functions.ft != NULL) { zend_hash_destroy(service->soap_functions.ft); efree(service->soap_functions.ft); @@ -1573,7 +1573,7 @@ PHP_METHOD(SoapServer, handle) zval filter_params; array_init_size(&filter_params, 1); - add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ + add_assoc_int_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC); zval_dtor(&filter_params); @@ -1786,8 +1786,8 @@ PHP_METHOD(SoapServer, handle) } } #endif - fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name)) || + fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRSIZE(h->function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(h->function_name)), Z_STRSIZE(h->function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1839,8 +1839,8 @@ PHP_METHOD(SoapServer, handle) } } - fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name)) || + fn_name = estrndup(Z_STRVAL(function_name),Z_STRSIZE(function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(function_name)), Z_STRSIZE(function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1897,9 +1897,9 @@ PHP_METHOD(SoapServer, handle) if (function && function->responseName) { response_name = estrdup(function->responseName); } else { - response_name = emalloc(Z_STRLEN(function_name) + sizeof("Response")); - memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name)); - memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response")); + response_name = emalloc(Z_STRSIZE(function_name) + sizeof("Response")); + memcpy(response_name,Z_STRVAL(function_name),Z_STRSIZE(function_name)); + memcpy(response_name+Z_STRSIZE(function_name),"Response",sizeof("Response")); } doc_return = serialize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC); efree(response_name); @@ -1947,7 +1947,7 @@ PHP_METHOD(SoapServer, handle) xmlFreeDoc(doc_return); - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2096,7 +2096,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade if (use_http_error_status) { sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1); } - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2265,7 +2265,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const } /* Get output buffer and send as fault detials */ - if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) { + if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_IVAL(outbuflen) != 0) { php_output_get_contents(&outbuf TSRMLS_CC); } php_output_discard(TSRMLS_C); @@ -2361,15 +2361,15 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "style", sizeof("style")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_RPC || Z_LVAL_P(tmp) == SOAP_DOCUMENT)) { - add_property_long(this_ptr, "style", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_RPC || Z_IVAL_P(tmp) == SOAP_DOCUMENT)) { + add_property_int(this_ptr, "style", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "use", sizeof("use")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_LITERAL || Z_LVAL_P(tmp) == SOAP_ENCODED)) { - add_property_long(this_ptr, "use", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_LITERAL || Z_IVAL_P(tmp) == SOAP_ENCODED)) { + add_property_int(this_ptr, "use", Z_IVAL_P(tmp)); } } @@ -2387,9 +2387,9 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_LONG || - (Z_LVAL_P(tmp) == SOAP_1_1 && Z_LVAL_P(tmp) == SOAP_1_2)) { - soap_version = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_INT || + (Z_IVAL_P(tmp) == SOAP_1_1 && Z_IVAL_P(tmp) == SOAP_1_2)) { + soap_version = Z_IVAL_P(tmp); } } if ((tmp = zend_hash_str_find(ht, "login", sizeof("login")-1)) != NULL && @@ -2400,8 +2400,8 @@ PHP_METHOD(SoapClient, SoapClient) add_property_str(this_ptr, "_password", STR_COPY(Z_STR_P(tmp))); } if ((tmp = zend_hash_str_find(ht, "authentication", sizeof("authentication")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - Z_LVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { + Z_TYPE_P(tmp) == IS_INT && + Z_IVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { add_property_null(this_ptr, "_digest"); } } @@ -2409,11 +2409,11 @@ PHP_METHOD(SoapClient, SoapClient) Z_TYPE_P(tmp) == IS_STRING) { add_property_str(this_ptr, "_proxy_host", STR_COPY(Z_STR_P(tmp))); if ((tmp = zend_hash_str_find(ht, "proxy_port", sizeof("proxy_port")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { - ZVAL_LONG(&tmp2, zval_get_long(tmp)); + if (Z_TYPE_P(tmp) != IS_INT) { + ZVAL_INT(&tmp2, zval_get_int(tmp)); tmp = &tmp2; } - add_property_long(this_ptr, "_proxy_port", Z_LVAL_P(tmp)); + add_property_int(this_ptr, "_proxy_port", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "proxy_login", sizeof("proxy_login")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2437,24 +2437,24 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL && (Z_TYPE_P(tmp) == IS_TRUE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) { - add_property_long(this_ptr, "trace", 1); + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 1))) { + add_property_int(this_ptr, "trace", 1); } if ((tmp = zend_hash_str_find(ht, "exceptions", sizeof("exceptions")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { add_property_bool(this_ptr, "_exceptions", 0); } if ((tmp = zend_hash_str_find(ht, "compression", sizeof("compression")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && + Z_TYPE_P(tmp) == IS_INT && zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1) && zend_hash_str_exists(EG(function_table), "gzdeflate", sizeof("gzdeflate")-1) && zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1) && zend_hash_str_exists(EG(function_table), "gzcompress", sizeof("gzcompress")-1) && zend_hash_str_exists(EG(function_table), "gzencode", sizeof("gzencode")-1)) { - add_property_long(this_ptr, "compression", Z_LVAL_P(tmp)); + add_property_int(this_ptr, "compression", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2486,17 +2486,17 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - add_property_long(this_ptr, "_features", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + add_property_int(this_ptr, "_features", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "connection_timeout", sizeof("connection_timeout")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { - ZVAL_LONG(&tmp2, zval_get_long(tmp)); + if (Z_TYPE_P(tmp) != IS_INT) { + ZVAL_INT(&tmp2, zval_get_int(tmp)); tmp = &tmp2; } - if (Z_LVAL_P(tmp) > 0) { - add_property_long(this_ptr, "_connection_timeout", Z_LVAL_P(tmp)); + if (Z_IVAL_P(tmp) > 0) { + add_property_int(this_ptr, "_connection_timeout", Z_IVAL_P(tmp)); } } @@ -2505,8 +2505,8 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - cache_wsdl = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + cache_wsdl = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "user_agent", sizeof("user_agent")-1)) != NULL && @@ -2516,19 +2516,19 @@ PHP_METHOD(SoapClient, SoapClient) if ((tmp = zend_hash_str_find(ht, "keep_alive", sizeof("keep_alive")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { - add_property_long(this_ptr, "_keep_alive", 0); + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { + add_property_int(this_ptr, "_keep_alive", 0); } if ((tmp = zend_hash_str_find(ht, "ssl_method", sizeof("ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + add_property_int(this_ptr, "_ssl_method", Z_IVAL_P(tmp)); } } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode"); } - add_property_long(this_ptr, "_soap_version", soap_version); + add_property_int(this_ptr, "_soap_version", soap_version); if (Z_TYPE_P(wsdl) != IS_NULL) { int old_soap_version; @@ -2577,7 +2577,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request", buf, buf_size); } @@ -2593,8 +2593,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } else { ZVAL_STRING(¶ms[2], action); } - ZVAL_LONG(¶ms[3], version); - ZVAL_LONG(¶ms[4], one_way); + ZVAL_INT(¶ms[3], version); + ZVAL_INT(¶ms[4], one_way); if (call_user_function(NULL, this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) { add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC); @@ -2605,7 +2605,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } ret = FALSE; } else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_str(this_ptr, "__last_response", STR_COPY(Z_STR_P(response))); } zval_ptr_dtor(&func); @@ -2651,12 +2651,12 @@ static void do_soap_call(zval* this_ptr, SOAP_CLIENT_BEGIN_CODE(); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL - && Z_LVAL_P(trace) > 0) { + && Z_IVAL_P(trace) > 0) { zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1); } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL - && Z_LVAL_P(tmp) == SOAP_1_2) { + && Z_IVAL_P(tmp) == SOAP_1_2) { soap_version = SOAP_1_2; } else { soap_version = SOAP_1_1; @@ -2699,8 +2699,8 @@ static void do_soap_call(zval* this_ptr, SOAP_GLOBAL(typemap) = typemap; old_features = SOAP_GLOBAL(features); if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - SOAP_GLOBAL(features) = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + SOAP_GLOBAL(features) = Z_IVAL_P(tmp); } else { SOAP_GLOBAL(features) = 0; } @@ -2734,7 +2734,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -2779,7 +2779,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -3643,7 +3643,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c smart_str_appends(&key, (char*)hdr_func->ns->href); smart_str_appendc(&key, ':'); } - smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRLEN(h->function_name)); + smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRSIZE(h->function_name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(fnb->input.headers, key.s)) != NULL) { h->hdr = hdr; @@ -3711,17 +3711,17 @@ static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version) } else { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_P(tmp))); } - } else if (Z_TYPE_P(tmp) == IS_LONG) { + } else if (Z_TYPE_P(tmp) == IS_INT) { if (version == SOAP_1_1) { - if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT)); } } else { - if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT)); - } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_NONE) { + } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_NONE) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE)); - } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { + } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); } } @@ -3885,13 +3885,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -3978,7 +3978,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if (version == SOAP_1_1) { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode")); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); xmlAddChild(param, node); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -4002,7 +4002,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -4101,13 +4101,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function ht = Z_OBJPROP(h->retval); if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -4239,7 +4239,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } } else { if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) { - style = Z_LVAL_P(zstyle); + style = Z_IVAL_P(zstyle); } else { style = SOAP_RPC; } @@ -4261,7 +4261,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL && - Z_LVAL_P(zuse) == SOAP_LITERAL) { + Z_IVAL_P(zuse) == SOAP_LITERAL) { use = SOAP_LITERAL; } else { use = SOAP_ENCODED; @@ -4330,9 +4330,9 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function smart_str key = {0}; sdlSoapBindingFunctionHeaderPtr hdr; - smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); smart_str_appendc(&key, ':'); - smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRLEN_P(name)); + smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRSIZE_P(name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) { hdr_use = hdr->use; diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 66d1938f07..fd350b264f 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -309,21 +309,21 @@ static long from_zval_integer_common(const zval *arr_value, ser_context *ctx) zval lzval; ZVAL_NULL(&lzval); - if (Z_TYPE_P(arr_value) != IS_LONG) { + if (Z_TYPE_P(arr_value) != IS_INT) { ZVAL_COPY(&lzval, arr_value); arr_value = &lzval; } switch (Z_TYPE_P(arr_value)) { - case IS_LONG: + case IS_INT: long_case: - ret = Z_LVAL_P(arr_value); + ret = Z_IVAL_P(arr_value); break; /* if not long we're operating on lzval */ case IS_DOUBLE: double_case: - convert_to_long(&lzval); + convert_to_int(&lzval); goto long_case; case IS_OBJECT: @@ -333,15 +333,15 @@ double_case: convert_to_string(&lzval); - switch (is_numeric_string(Z_STRVAL(lzval), Z_STRLEN(lzval), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL(lzval), Z_STRSIZE(lzval), &lval, &dval, 0)) { case IS_DOUBLE: zval_dtor(&lzval); ZVAL_DOUBLE(&lzval, dval); goto double_case; - case IS_LONG: + case IS_INT: zval_dtor(&lzval); - ZVAL_LONG(&lzval, lval); + ZVAL_INT(&lzval, lval); goto long_case; } @@ -490,49 +490,49 @@ void to_zval_read_int(const char *data, zval *zv, res_context *ctx) int ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) { unsigned ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) { uint16_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ntohs(ival)); + ZVAL_INT(zv, (long)ntohs(ival)); } static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) { uint32_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) { sa_family_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) { pid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) { uid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } /* CONVERSIONS for sockaddr */ @@ -576,7 +576,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in, sin_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -635,7 +635,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in6[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in6, sin6_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -669,18 +669,18 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ /* code in this file relies on the path being nul terminated, even though * this is not required, at least on linux for abstract paths. It also * assumes that the path is not empty */ - if (Z_STRLEN_P(path) == 0) { + if (Z_STRSIZE_P(path) == 0) { do_from_zval_err(ctx, "%s", "the path is cannot be empty"); return; } - if (Z_STRLEN_P(path) >= sizeof(saddr->sun_path)) { + if (Z_STRSIZE_P(path) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " "length is %ld", sizeof(saddr->sun_path) - 1); return; } - memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRLEN_P(path)); - saddr->sun_path[Z_STRLEN_P(path)] = '\0'; + memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRSIZE_P(path)); + saddr->sun_path[Z_STRSIZE_P(path)] = '\0'; zval_dtor(&lzval); } @@ -1101,7 +1101,7 @@ static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, s } convert_to_string_ex(elem); - len = Z_STRLEN_P(elem); + len = Z_STRSIZE_P(elem); msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx); msg->msg_iov[i - 1].iov_len = len; memcpy(msg->msg_iov[i - 1].iov_base, Z_STRVAL_P(elem), len); @@ -1257,12 +1257,12 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context ZVAL_NULL(&lzval); - if (Z_TYPE_P(zv) == IS_LONG) { - if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ + if (Z_TYPE_P(zv) == IS_INT) { + if (Z_IVAL_P(zv) < 0 || Z_IVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ do_from_zval_err(ctx, "the interface index cannot be negative or " - "larger than %u; given %ld", UINT_MAX, Z_LVAL_P(zv)); + "larger than %u; given %ld", UINT_MAX, Z_IVAL_P(zv)); } else { - ret = (unsigned)Z_LVAL_P(zv); + ret = (unsigned)Z_IVAL_P(zv); } } else { if (Z_TYPE_P(zv) != IS_STRING) { diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 2bc86b1dba..0fc3dbb2cf 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -89,14 +89,14 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC) { int ret; - if (Z_TYPE_P(val) == IS_LONG) { - if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) { + if (Z_TYPE_P(val) == IS_INT) { + if (Z_IVAL_P(val) < 0 || Z_IVAL_P(val) > UINT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "the interface index cannot be negative or larger than %u;" - " given %ld", UINT_MAX, Z_LVAL_P(val)); + " given %ld", UINT_MAX, Z_IVAL_P(val)); ret = FAILURE; } else { - *out = Z_LVAL_P(val); + *out = Z_IVAL_P(val); ret = SUCCESS; } } else { @@ -288,13 +288,13 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock, goto ipv4_loop_ttl; case IP_MULTICAST_TTL: - convert_to_long_ex(arg4); - if (Z_LVAL_P(arg4) < 0L || Z_LVAL_P(arg4) > 255L) { + convert_to_int_ex(arg4); + if (Z_IVAL_P(arg4) < 0L || Z_IVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between 0 and 255"); return FAILURE; } - ipv4_mcast_ttl_lback = (unsigned char) Z_LVAL_P(arg4); + ipv4_mcast_ttl_lback = (unsigned char) Z_IVAL_P(arg4); ipv4_loop_ttl: opt_ptr = &ipv4_mcast_ttl_lback; optlen = sizeof(ipv4_mcast_ttl_lback); @@ -353,13 +353,13 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock, ov = (int) Z_TYPE_P(arg4) == IS_TRUE; goto ipv6_loop_hops; case IPV6_MULTICAST_HOPS: - convert_to_long_ex(arg4); - if (Z_LVAL_P(arg4) < -1L || Z_LVAL_P(arg4) > 255L) { + convert_to_int_ex(arg4); + if (Z_IVAL_P(arg4) < -1L || Z_IVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between -1 and 255"); return FAILURE; } - ov = (int) Z_LVAL_P(arg4); + ov = (int) Z_IVAL_P(arg4); ipv6_loop_hops: opt_ptr = &ov; optlen = sizeof(ov); diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 72c7286eb5..b9e66f1920 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -198,7 +198,7 @@ PHP_FUNCTION(socket_sendmsg) zend_llist_destroy(allocations); efree(allocations); - RETURN_LONG((long)res); + RETURN_INT((long)res); } else { PHP_SOCKET_ERROR(php_sock, "error in sendmsg", errno); RETURN_FALSE; @@ -268,7 +268,7 @@ PHP_FUNCTION(socket_recvmsg) RETURN_FALSE; } - RETURN_LONG((long)res); + RETURN_INT((long)res); } PHP_FUNCTION(socket_cmsg_space) @@ -308,7 +308,7 @@ PHP_FUNCTION(socket_cmsg_space) return; } - RETURN_LONG((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); + RETURN_INT((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); } #if HAVE_IPV6 @@ -409,35 +409,35 @@ void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS) { /* IPv6 ancillary data */ #if defined(IPV6_RECVPKTINFO) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); #endif #if defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); #endif /* would require some effort: - REGISTER_LONG_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); */ #if defined(IPV6_RECVTCLASS) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); #endif /* - REGISTER_LONG_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); */ #ifdef SCM_RIGHTS - REGISTER_LONG_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); #endif #ifdef SO_PASSCRED - REGISTER_LONG_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ZTS diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index 1c1a90d58f..ad7347f0ec 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -65,7 +65,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ double dval = 0; unsigned scope_id = 0; - if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { + if (IS_INT == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { if (lval > 0 && lval <= UINT_MAX) { scope_id = lval; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index dd7f27260f..9dae998577 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -611,100 +611,100 @@ static PHP_MINIT_FUNCTION(sockets) { le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number); - REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); #ifdef MSG_EOR - REGISTER_LONG_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_EOF - REGISTER_LONG_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CONFIRM - REGISTER_LONG_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_ERRQUEUE - REGISTER_LONG_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_NOSIGNAL - REGISTER_LONG_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_DONTWAIT - REGISTER_LONG_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_MORE - REGISTER_LONG_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_WAITFORONE - REGISTER_LONG_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CMSG_CLOEXEC - REGISTER_LONG_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); #ifdef SO_REUSEPORT - REGISTER_LONG_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); #ifdef SO_FAMILY - REGISTER_LONG_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); #ifdef SO_BINDTODEVICE - REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); #ifdef TCP_NODELAY - REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); #ifdef HAS_MCAST_EXT - REGISTER_LONG_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #endif #ifndef WIN32 @@ -713,16 +713,16 @@ static PHP_MINIT_FUNCTION(sockets) # include "win32_socket_constants.h" #endif - REGISTER_LONG_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); #endif php_socket_sendrecvmsg_init(INIT_FUNC_ARGS_PASSTHRU); @@ -861,19 +861,19 @@ PHP_FUNCTION(socket_select) if (sec != NULL) { zval tmp; - if (Z_TYPE_P(sec) != IS_LONG) { + if (Z_TYPE_P(sec) != IS_INT) { tmp = *sec; zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); sec = &tmp; } /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_LVAL_P(sec); + tv.tv_sec = Z_IVAL_P(sec); tv.tv_usec = usec; } @@ -896,7 +896,7 @@ PHP_FUNCTION(socket_select) if (w_array != NULL) php_sock_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) php_sock_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1100,7 +1100,7 @@ PHP_FUNCTION(socket_write) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1206,7 +1206,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_LONG(port, htons(sin6->sin6_port)); + ZVAL_INT(port, htons(sin6->sin6_port)); } RETURN_TRUE; break; @@ -1223,7 +1223,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_LONG(port, htons(sin->sin_port)); + ZVAL_INT(port, htons(sin->sin_port)); } RETURN_TRUE; break; @@ -1283,7 +1283,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_LONG(arg3, htons(sin6->sin6_port)); + ZVAL_INT(arg3, htons(sin6->sin6_port)); } RETURN_TRUE; @@ -1301,7 +1301,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_LONG(arg3, htons(sin->sin_port)); + ZVAL_INT(arg3, htons(sin->sin_port)); } RETURN_TRUE; @@ -1592,7 +1592,7 @@ PHP_FUNCTION(socket_recv) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1619,7 +1619,7 @@ PHP_FUNCTION(socket_send) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1703,7 +1703,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, address ? address : "0.0.0.0"); - ZVAL_LONG(arg6, ntohs(sin.sin_port)); + ZVAL_INT(arg6, ntohs(sin.sin_port)); break; #if HAVE_IPV6 case AF_INET6: @@ -1735,7 +1735,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, addr6[0] ? addr6 : "::"); - ZVAL_LONG(arg6, ntohs(sin6.sin6_port)); + ZVAL_INT(arg6, ntohs(sin6.sin6_port)); break; #endif default: @@ -1743,7 +1743,7 @@ PHP_FUNCTION(socket_recvfrom) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1820,7 +1820,7 @@ PHP_FUNCTION(socket_sendto) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1856,7 +1856,7 @@ PHP_FUNCTION(socket_get_option) RETURN_FALSE; } if (php_add4_to_if_index(&if_addr, php_sock, &if_index TSRMLS_CC) == SUCCESS) { - RETURN_LONG((long) if_index); + RETURN_INT((long) if_index); } else { RETURN_FALSE; } @@ -1885,8 +1885,8 @@ PHP_FUNCTION(socket_get_option) } array_init(return_value); - add_assoc_long(return_value, "l_onoff", linger_val.l_onoff); - add_assoc_long(return_value, "l_linger", linger_val.l_linger); + add_assoc_int(return_value, "l_onoff", linger_val.l_onoff); + add_assoc_int(return_value, "l_linger", linger_val.l_linger); break; case SO_RCVTIMEO: @@ -1912,8 +1912,8 @@ PHP_FUNCTION(socket_get_option) array_init(return_value); - add_assoc_long(return_value, "sec", tv.tv_sec); - add_assoc_long(return_value, "usec", tv.tv_usec); + add_assoc_int(return_value, "sec", tv.tv_sec); + add_assoc_int(return_value, "usec", tv.tv_usec); break; default: @@ -1926,7 +1926,7 @@ PHP_FUNCTION(socket_get_option) if (optlen == 1) other_val = *((unsigned char *)&other_val); - RETURN_LONG(other_val); + RETURN_INT(other_val); break; } } @@ -2000,11 +2000,11 @@ PHP_FUNCTION(socket_set_option) RETURN_FALSE; } - convert_to_long_ex(l_onoff); - convert_to_long_ex(l_linger); + convert_to_int_ex(l_onoff); + convert_to_int_ex(l_linger); - lv.l_onoff = (unsigned short)Z_LVAL_P(l_onoff); - lv.l_linger = (unsigned short)Z_LVAL_P(l_linger); + lv.l_onoff = (unsigned short)Z_IVAL_P(l_onoff); + lv.l_linger = (unsigned short)Z_IVAL_P(l_linger); optlen = sizeof(lv); opt_ptr = &lv; @@ -2028,15 +2028,15 @@ PHP_FUNCTION(socket_set_option) RETURN_FALSE; } - convert_to_long_ex(sec); - convert_to_long_ex(usec); + convert_to_int_ex(sec); + convert_to_int_ex(usec); #ifndef PHP_WIN32 - tv.tv_sec = Z_LVAL_P(sec); - tv.tv_usec = Z_LVAL_P(usec); + tv.tv_sec = Z_IVAL_P(sec); + tv.tv_usec = Z_IVAL_P(usec); optlen = sizeof(tv); opt_ptr = &tv; #else - timeout = Z_LVAL_P(sec) * 1000 + Z_LVAL_P(usec) / 1000; + timeout = Z_IVAL_P(sec) * 1000 + Z_IVAL_P(usec) / 1000; optlen = sizeof(int); opt_ptr = &timeout; #endif @@ -2046,7 +2046,7 @@ PHP_FUNCTION(socket_set_option) case SO_BINDTODEVICE: { if (Z_TYPE_P(arg4) == IS_STRING) { opt_ptr = Z_STRVAL_P(arg4); - optlen = Z_STRLEN_P(arg4); + optlen = Z_STRSIZE_P(arg4); } else { opt_ptr = ""; optlen = 0; @@ -2057,8 +2057,8 @@ PHP_FUNCTION(socket_set_option) default: default_case: - convert_to_long_ex(arg4); - ov = Z_LVAL_P(arg4); + convert_to_int_ex(arg4); + ov = Z_IVAL_P(arg4); optlen = sizeof(ov); opt_ptr = &ov; @@ -2175,9 +2175,9 @@ PHP_FUNCTION(socket_last_error) if (arg1) { ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, le_socket_name, le_socket); - RETVAL_LONG(php_sock->error); + RETVAL_INT(php_sock->error); } else { - RETVAL_LONG(SOCKETS_G(last_error)); + RETVAL_INT(SOCKETS_G(last_error)); } } /* }}} */ diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h index 485b2534d2..645b018cbf 100644 --- a/ext/sockets/unix_socket_constants.h +++ b/ext/sockets/unix_socket_constants.h @@ -22,405 +22,405 @@ #ifdef EPERM /* Operation not permitted */ - REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOENT /* No such file or directory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINTR /* Interrupted system call */ - REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIO /* I/O error */ - REGISTER_LONG_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENXIO /* No such device or address */ - REGISTER_LONG_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef E2BIG /* Arg list too long */ - REGISTER_LONG_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADF /* Bad file number */ - REGISTER_LONG_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAGAIN /* Try again */ - REGISTER_LONG_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEM /* Out of memory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EACCES /* Permission denied */ - REGISTER_LONG_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); #endif #ifdef EFAULT /* Bad address */ - REGISTER_LONG_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTBLK /* Block device required */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBUSY /* Device or resource busy */ - REGISTER_LONG_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EEXIST /* File exists */ - REGISTER_LONG_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXDEV /* Cross-device link */ - REGISTER_LONG_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODEV /* No such device */ - REGISTER_LONG_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTDIR /* Not a directory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISDIR /* Is a directory */ - REGISTER_LONG_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINVAL /* Invalid argument */ - REGISTER_LONG_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENFILE /* File table overflow */ - REGISTER_LONG_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMFILE /* Too many open files */ - REGISTER_LONG_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTTY /* Not a typewriter */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSPC /* No space left on device */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESPIPE /* Illegal seek */ - REGISTER_LONG_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EROFS /* Read-only file system */ - REGISTER_LONG_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMLINK /* Too many links */ - REGISTER_LONG_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPIPE /* Broken pipe */ - REGISTER_LONG_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENAMETOOLONG /* File name too long */ - REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLCK /* No record locks available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSYS /* Function not implemented */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTEMPTY /* Directory not empty */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELOOP /* Too many symbolic links encountered */ - REGISTER_LONG_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EWOULDBLOCK /* Operation would block */ - REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMSG /* No message of desired type */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIDRM /* Identifier removed */ - REGISTER_LONG_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECHRNG /* Channel number out of range */ - REGISTER_LONG_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2NSYNC /* Level 2 not synchronized */ - REGISTER_LONG_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3HLT /* Level 3 halted */ - REGISTER_LONG_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3RST /* Level 3 reset */ - REGISTER_LONG_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELNRNG /* Link number out of range */ - REGISTER_LONG_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUNATCH /* Protocol driver not attached */ - REGISTER_LONG_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOCSI /* No CSI structure available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2HLT /* Level 2 halted */ - REGISTER_LONG_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADE /* Invalid exchange */ - REGISTER_LONG_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADR /* Invalid request descriptor */ - REGISTER_LONG_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXFULL /* Exchange full */ - REGISTER_LONG_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOANO /* No anode */ - REGISTER_LONG_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADRQC /* Invalid request code */ - REGISTER_LONG_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADSLT /* Invalid slot */ - REGISTER_LONG_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSTR /* Device not a stream */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODATA /* No data available */ - REGISTER_LONG_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIME /* Timer expired */ - REGISTER_LONG_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSR /* Out of streams resources */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENONET /* Machine is not on the network */ - REGISTER_LONG_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTE /* Object is remote */ - REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLINK /* Link has been severed */ - REGISTER_LONG_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADV /* Advertise error */ - REGISTER_LONG_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESRMNT /* Srmount error */ - REGISTER_LONG_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECOMM /* Communication error on send */ - REGISTER_LONG_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTO /* Protocol error */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMULTIHOP /* Multihop attempted */ - REGISTER_LONG_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADMSG /* Not a data message */ - REGISTER_LONG_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTUNIQ /* Name not unique on network */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADFD /* File descriptor in bad state */ - REGISTER_LONG_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMCHG /* Remote address changed */ - REGISTER_LONG_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ERESTART /* Interrupted system call should be restarted */ - REGISTER_LONG_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESTRPIPE /* Streams pipe error */ - REGISTER_LONG_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUSERS /* Too many users */ - REGISTER_LONG_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTSOCK /* Socket operation on non-socket */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDESTADDRREQ /* Destination address required */ - REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMSGSIZE /* Message too long */ - REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTOTYPE /* Protocol wrong type for socket */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOPROTOOPT /* Protocol not available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTONOSUPPORT /* Protocol not supported */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESOCKTNOSUPPORT /* Socket type not supported */ - REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EOPNOTSUPP /* Operation not supported on transport endpoint */ - REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPFNOSUPPORT /* Protocol family not supported */ - REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAFNOSUPPORT /* Address family not supported by protocol */ - REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRINUSE /* Address already in use */ - REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRNOTAVAIL /* Cannot assign requested address */ - REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETDOWN /* Network is down */ - REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETUNREACH /* Network is unreachable */ - REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETRESET /* Network dropped connection because of reset */ - REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNABORTED /* Software caused connection abort */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNRESET /* Connection reset by peer */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOBUFS /* No buffer space available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISCONN /* Transport endpoint is already connected */ - REGISTER_LONG_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTCONN /* Transport endpoint is not connected */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESHUTDOWN /* Cannot send after transport endpoint shutdown */ - REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETOOMANYREFS /* Too many references: cannot splice */ - REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIMEDOUT /* Connection timed out */ - REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNREFUSED /* Connection refused */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTDOWN /* Host is down */ - REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTUNREACH /* No route to host */ - REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef EALREADY /* Operation already in progress */ - REGISTER_LONG_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINPROGRESS /* Operation now in progress */ - REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISNAM /* Is a named type file */ - REGISTER_LONG_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTEIO /* Remote I/O error */ - REGISTER_LONG_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDQUOT /* Quota exceeded */ - REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEDIUM /* No medium found */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMEDIUMTYPE /* Wrong medium type */ - REGISTER_LONG_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h index 848e14fb51..2d633efdb7 100644 --- a/ext/sockets/win32_socket_constants.h +++ b/ext/sockets/win32_socket_constants.h @@ -20,55 +20,55 @@ /* This file is to be included by sockets.c */ -REGISTER_LONG_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 54c80972c9..075d43b7bc 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -249,7 +249,7 @@ PHP_METHOD(sqlite3, version) array_init(return_value); add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion()); - add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number()); + add_assoc_int(return_value, "versionNumber", sqlite3_libversion_number()); return; } @@ -269,7 +269,7 @@ PHP_METHOD(sqlite3, lastInsertRowID) return; } - RETURN_LONG(sqlite3_last_insert_rowid(db_obj->db)); + RETURN_INT(sqlite3_last_insert_rowid(db_obj->db)); } /* }}} */ @@ -287,7 +287,7 @@ PHP_METHOD(sqlite3, lastErrorCode) return; } - RETURN_LONG(sqlite3_errcode(db_obj->db)); + RETURN_INT(sqlite3_errcode(db_obj->db)); } /* }}} */ @@ -424,7 +424,7 @@ PHP_METHOD(sqlite3, changes) return; } - RETURN_LONG(sqlite3_changes(db_obj->db)); + RETURN_INT(sqlite3_changes(db_obj->db)); } /* }}} */ @@ -579,7 +579,7 @@ static void sqlite_value_to_zval(sqlite3_stmt *stmt, int column, zval *data) /* if ((sqlite3_column_int64(stmt, column)) >= INT_MAX || sqlite3_column_int64(stmt, column) <= INT_MIN) { ZVAL_STRINGL(data, (char *)sqlite3_column_text(stmt, column), sqlite3_column_bytes(stmt, column)); } else { - ZVAL_LONG(data, sqlite3_column_int64(stmt, column)); + ZVAL_INT(data, sqlite3_column_int64(stmt, column)); } break; @@ -711,16 +711,16 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s ZVAL_NULL(&agg_context->zval_context); } ZVAL_COPY_VALUE(&zargs[0], &agg_context->zval_context); - ZVAL_LONG(&zargs[1], agg_context->row_count); + ZVAL_INT(&zargs[1], agg_context->row_count); } for (i = 0; i < argc; i++) { switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: #if LONG_MAX > 2147483647 - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); #else - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); #endif break; @@ -762,11 +762,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_LONG: + case IS_INT: #if LONG_MAX > 2147483647 - sqlite3_result_int64(context, Z_LVAL(retval)); + sqlite3_result_int64(context, Z_IVAL(retval)); #else - sqlite3_result_int(context, Z_LVAL(retval)); + sqlite3_result_int(context, Z_IVAL(retval)); #endif break; @@ -780,7 +780,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); break; } } else { @@ -871,13 +871,13 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in zval_ptr_dtor(&zargs[1]); efree(zargs); - //retval ought to contain a ZVAL_LONG by now + //retval ought to contain a ZVAL_INT by now // (the result of a comparison, i.e. most likely -1, 0, or 1) //I suppose we could accept any scalar return type, though. - if (Z_TYPE(retval) != IS_LONG){ + if (Z_TYPE(retval) != IS_INT){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the compare callback (invalid return type). Collation behaviour is undefined."); }else{ - ret = Z_LVAL(retval); + ret = Z_IVAL(retval); } zval_ptr_dtor(&retval); @@ -1252,7 +1252,7 @@ PHP_METHOD(sqlite3stmt, paramCount) SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); - RETURN_LONG(sqlite3_bind_parameter_count(stmt_obj->stmt)); + RETURN_INT(sqlite3_bind_parameter_count(stmt_obj->stmt)); } /* }}} */ @@ -1493,11 +1493,11 @@ PHP_METHOD(sqlite3stmt, execute) switch (param->type) { case SQLITE_INTEGER: - convert_to_long(parameter); + convert_to_int(parameter); #if LONG_MAX > 2147483647 - sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); + sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); #else - sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); + sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); #endif break; @@ -1532,7 +1532,7 @@ PHP_METHOD(sqlite3stmt, execute) case SQLITE3_TEXT: convert_to_string(parameter); - sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRLEN_P(parameter), SQLITE_STATIC); + sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRSIZE_P(parameter), SQLITE_STATIC); break; case SQLITE_NULL: @@ -1641,7 +1641,7 @@ PHP_METHOD(sqlite3result, numColumns) return; } - RETURN_LONG(sqlite3_column_count(result_obj->stmt_obj->stmt)); + RETURN_INT(sqlite3_column_count(result_obj->stmt_obj->stmt)); } /* }}} */ @@ -1689,7 +1689,7 @@ PHP_METHOD(sqlite3result, columnType) RETURN_FALSE; } - RETURN_LONG(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); + RETURN_INT(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); } /* }}} */ @@ -2223,19 +2223,19 @@ PHP_MINIT_FUNCTION(sqlite3) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 97aa204892..56244ec343 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -419,19 +419,19 @@ static int _call_message_handler(zval *callback_name, CS_SERVERMSG *srvmsg TSRML /* Build arguments */ MAKE_STD_ZVAL(msgnumber); - ZVAL_LONG(msgnumber, srvmsg->msgnumber); + ZVAL_INT(msgnumber, srvmsg->msgnumber); args[0] = &msgnumber; MAKE_STD_ZVAL(severity); - ZVAL_LONG(severity, srvmsg->severity); + ZVAL_INT(severity, srvmsg->severity); args[1] = &severity; MAKE_STD_ZVAL(state); - ZVAL_LONG(state, srvmsg->state); + ZVAL_INT(state, srvmsg->state); args[2] = &state; MAKE_STD_ZVAL(line); - ZVAL_LONG(line, srvmsg->line); + ZVAL_INT(line, srvmsg->line); args[3] = &line; MAKE_STD_ZVAL(text); @@ -559,7 +559,7 @@ static PHP_GINIT_FUNCTION(sybase) * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. */ - if (cfg_get_long("sybct.timeout", &opt)==SUCCESS) { + if (cfg_get_int("sybct.timeout", &opt)==SUCCESS) { CS_INT cs_timeout = opt; if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update the timeout"); @@ -678,7 +678,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } } - if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { + if (cfg_get_int("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize"); } @@ -864,7 +864,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link, &type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_LVAL_P(return_value) = SybCtG(default_link) = link; + Z_IVAL_P(return_value) = SybCtG(default_link) = link; Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; @@ -889,7 +889,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { ct_close(sybase_ptr->connection, CS_UNUSED); @@ -901,7 +901,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) SybCtG(num_links)++; } efree(hashed_details); - SybCtG(default_link)=Z_LVAL_P(return_value); + SybCtG(default_link)=Z_IVAL_P(return_value); zend_list_addref(SybCtG(default_link)); } @@ -1225,7 +1225,7 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS switch (result->numerics[j]) { case 1: { /* This indicates a long */ - ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); + ZVAL_INT(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); break; } @@ -1238,14 +1238,14 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS case 3: { /* This indicates either a long or a float, which ever fits */ errno = 0; - Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); + Z_IVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); if (errno == ERANGE) { /* An overflow occurred, so try to fit it into a double */ RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); break; } - Z_TYPE(result->data[i][j]) = IS_LONG; + Z_TYPE(result->data[i][j]) = IS_INT; break; } @@ -1469,7 +1469,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) /* Get the resultset and free it */ ALLOC_ZVAL(tmp); - Z_LVAL_P(tmp)= sybase_ptr->active_result_index; + Z_IVAL_P(tmp)= sybase_ptr->active_result_index; Z_TYPE_P(tmp)= IS_RESOURCE; INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); @@ -1701,7 +1701,7 @@ PHP_FUNCTION(sybase_free_result) php_sybase_finish_results(result TSRMLS_CC); } - zend_list_delete(Z_LVAL_P(sybase_result_index)); + zend_list_delete(Z_IVAL_P(sybase_result_index)); RETURN_TRUE; } @@ -1727,8 +1727,8 @@ PHP_FUNCTION(sybase_num_rows) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_LVAL_P(return_value) = result->num_rows; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = result->num_rows; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ @@ -1745,8 +1745,8 @@ PHP_FUNCTION(sybase_num_fields) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_LVAL_P(return_value) = result->num_fields; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = result->num_fields; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ @@ -1867,7 +1867,7 @@ PHP_FUNCTION(sybase_fetch_object) zend_class_entry **pce = NULL; convert_to_string(object); - if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Class %s has not been declared", Z_STRVAL_P(object)); /* Use default (ZEND_STANDARD_CLASS_DEF_PTR) */ } else { @@ -2002,9 +2002,9 @@ PHP_FUNCTION(sybase_fetch_field) object_init(return_value); add_property_string(return_value, "name", result->fields[field_offset].name); - add_property_long(return_value, "max_length", result->fields[field_offset].max_length); + add_property_int(return_value, "max_length", result->fields[field_offset].max_length); add_property_string(return_value, "column_source", result->fields[field_offset].column_source); - add_property_long(return_value, "numeric", result->fields[field_offset].numeric); + add_property_int(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -2076,8 +2076,8 @@ PHP_FUNCTION(sybase_result) break; } default: - convert_to_long(field); - field_offset = Z_LVAL_P(field); + convert_to_int(field); + field_offset = Z_IVAL_P(field); if (field_offset < 0 || field_offset >= result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset specified"); RETURN_FALSE; @@ -2110,8 +2110,8 @@ PHP_FUNCTION(sybase_affected_rows) ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink); - Z_LVAL_P(return_value) = sybase_ptr->affected_rows; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = sybase_ptr->affected_rows; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index b1cbedbbc1..30d51a672a 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -130,11 +130,11 @@ static void sysvmsg_release(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(sysvmsg) { le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg queue", module_number); - REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); return SUCCESS; } /* }}} */ @@ -171,20 +171,20 @@ PHP_FUNCTION(msg_set_queue) /* now pull out members of data and set them in the stat buffer */ if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.uid = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.uid = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.gid = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.gid = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.mode = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.mode = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_qbytes = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_qbytes = Z_IVAL_P(item); } if (msgctl(mq->id, IPC_SET, &stat) == 0) { RETVAL_TRUE; @@ -212,16 +212,16 @@ PHP_FUNCTION(msg_stat_queue) if (msgctl(mq->id, IPC_STAT, &stat) == 0) { array_init(return_value); - add_assoc_long(return_value, "msg_perm.uid", stat.msg_perm.uid); - add_assoc_long(return_value, "msg_perm.gid", stat.msg_perm.gid); - add_assoc_long(return_value, "msg_perm.mode", stat.msg_perm.mode); - add_assoc_long(return_value, "msg_stime", stat.msg_stime); - add_assoc_long(return_value, "msg_rtime", stat.msg_rtime); - add_assoc_long(return_value, "msg_ctime", stat.msg_ctime); - add_assoc_long(return_value, "msg_qnum", stat.msg_qnum); - add_assoc_long(return_value, "msg_qbytes", stat.msg_qbytes); - add_assoc_long(return_value, "msg_lspid", stat.msg_lspid); - add_assoc_long(return_value, "msg_lrpid", stat.msg_lrpid); + add_assoc_int(return_value, "msg_perm.uid", stat.msg_perm.uid); + add_assoc_int(return_value, "msg_perm.gid", stat.msg_perm.gid); + add_assoc_int(return_value, "msg_perm.mode", stat.msg_perm.mode); + add_assoc_int(return_value, "msg_stime", stat.msg_stime); + add_assoc_int(return_value, "msg_rtime", stat.msg_rtime); + add_assoc_int(return_value, "msg_ctime", stat.msg_ctime); + add_assoc_int(return_value, "msg_qnum", stat.msg_qnum); + add_assoc_int(return_value, "msg_qbytes", stat.msg_qbytes); + add_assoc_int(return_value, "msg_lspid", stat.msg_lspid); + add_assoc_int(return_value, "msg_lrpid", stat.msg_lrpid); } } /* }}} */ @@ -344,18 +344,18 @@ PHP_FUNCTION(msg_receive) zval_dtor(out_msgtype); zval_dtor(out_message); - ZVAL_LONG(out_msgtype, 0); + ZVAL_INT(out_msgtype, 0); ZVAL_FALSE(out_message); if (zerrcode) { ZVAL_DEREF(zerrcode); zval_dtor(zerrcode); - ZVAL_LONG(zerrcode, 0); + ZVAL_INT(zerrcode, 0); } if (result >= 0) { /* got it! */ - ZVAL_LONG(out_msgtype, messagebuffer->mtype); + ZVAL_INT(out_msgtype, messagebuffer->mtype); RETVAL_TRUE; if (do_unserialize) { @@ -375,7 +375,7 @@ PHP_FUNCTION(msg_receive) ZVAL_STRINGL(out_message, messagebuffer->mtext, result); } } else if (zerrcode) { - ZVAL_LONG(zerrcode, errno); + ZVAL_INT(zerrcode, errno); } efree(messagebuffer); } @@ -421,11 +421,11 @@ PHP_FUNCTION(msg_send) switch (Z_TYPE_P(message)) { case IS_STRING: p = Z_STRVAL_P(message); - message_len = Z_STRLEN_P(message); + message_len = Z_STRSIZE_P(message); break; - case IS_LONG: - message_len = spprintf(&p, 0, "%ld", Z_LVAL_P(message)); + case IS_INT: + message_len = spprintf(&p, 0, "%ld", Z_IVAL_P(message)); break; case IS_FALSE: message_len = spprintf(&p, 0, "0"); @@ -459,7 +459,7 @@ PHP_FUNCTION(msg_send) if (result == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "msgsnd failed: %s", strerror(errno)); if (zerror) { - ZVAL_LONG(zerror, errno); + ZVAL_INT(zerror, errno); } } else { RETVAL_TRUE; diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index 75c5f8baa5..e8751174e3 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -309,7 +309,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire) ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semaphore", php_sysvsem_module.le_sem); if (!acquire && sem_ptr->count == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_IVAL_P(arg_id), sem_ptr->key); RETURN_FALSE; } @@ -374,7 +374,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_LVAL_P(arg_id)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_IVAL_P(arg_id)); RETURN_FALSE; } @@ -383,7 +383,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_LVAL_P(arg_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_IVAL_P(arg_id), strerror(errno)); RETURN_FALSE; } diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index bb908a4113..444444d701 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -136,7 +136,7 @@ PHP_MINIT_FUNCTION(sysvshm) { php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, PHP_SHM_RSRC_NAME, module_number); - if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { + if (cfg_get_int("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { php_sysvshm.init_mem=10000; } return SUCCESS; @@ -229,7 +229,7 @@ PHP_FUNCTION(shm_remove) SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_IVAL_P(shm_id), strerror(errno)); RETURN_FALSE; } diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 5617dca7d6..84425950a8 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -98,8 +98,8 @@ tidy_object_handlers_ ## name.clone_obj = NULL; \ } -#define TIDY_TAG_CONST(tag) REGISTER_LONG_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) -#define TIDY_NODE_CONST(name, type) REGISTER_LONG_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) +#define TIDY_TAG_CONST(tag) REGISTER_INT_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) +#define TIDY_NODE_CONST(name, type) REGISTER_INT_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) #ifndef TRUE #define TRUE 1 @@ -134,7 +134,7 @@ #define ADD_PROPERTY_LONG(_table, _key, _long) \ { \ zval tmp; \ - ZVAL_LONG(&tmp, _long); \ + ZVAL_INT(&tmp, _long); \ zend_hash_str_update(_table, #_key, sizeof(#_key) - 1, &tmp); \ } @@ -524,21 +524,21 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS break; case TidyInteger: - if (Z_TYPE(conv) != IS_LONG) { + if (Z_TYPE(conv) != IS_INT) { zval_copy_ctor(&conv); - convert_to_long(&conv); + convert_to_int(&conv); } - if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) { + if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_IVAL(conv))) { return SUCCESS; } break; case TidyBoolean: - if (Z_TYPE(conv) != IS_LONG) { + if (Z_TYPE(conv) != IS_INT) { zval_copy_ctor(&conv); - convert_to_long(&conv); + convert_to_int(&conv); } - if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_LVAL(conv))) { + if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_IVAL(conv))) { return SUCCESS; } break; @@ -734,8 +734,8 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch (type) { - case IS_LONG: - ZVAL_LONG(out, 0); + case IS_INT: + ZVAL_INT(out, 0); break; case IS_DOUBLE: @@ -767,8 +767,8 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch(type) { - case IS_LONG: - ZVAL_LONG(out, 0); + case IS_INT: + ZVAL_INT(out, 0); break; case IS_DOUBLE: @@ -1396,7 +1396,7 @@ static PHP_FUNCTION(tidy_get_config) break; case TidyInteger: - add_assoc_long(return_value, opt_name, (long)opt_value); + add_assoc_int(return_value, opt_name, (long)opt_value); break; case TidyBoolean: @@ -1415,7 +1415,7 @@ static PHP_FUNCTION(tidy_get_status) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyStatus(obj->ptdoc->doc)); + RETURN_INT(tidyStatus(obj->ptdoc->doc)); } /* }}} */ @@ -1425,7 +1425,7 @@ static PHP_FUNCTION(tidy_get_html_ver) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyDetectedHtmlVersion(obj->ptdoc->doc)); + RETURN_INT(tidyDetectedHtmlVersion(obj->ptdoc->doc)); } /* }}} */ @@ -1455,7 +1455,7 @@ static PHP_FUNCTION(tidy_error_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyErrorCount(obj->ptdoc->doc)); + RETURN_INT(tidyErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1465,7 +1465,7 @@ static PHP_FUNCTION(tidy_warning_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyWarningCount(obj->ptdoc->doc)); + RETURN_INT(tidyWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1475,7 +1475,7 @@ static PHP_FUNCTION(tidy_access_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyAccessWarningCount(obj->ptdoc->doc)); + RETURN_INT(tidyAccessWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1485,7 +1485,7 @@ static PHP_FUNCTION(tidy_config_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyConfigErrorCount(obj->ptdoc->doc)); + RETURN_INT(tidyConfigErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1529,7 +1529,7 @@ static PHP_FUNCTION(tidy_getopt) return; case TidyInteger: - RETURN_LONG((long)optval); + RETURN_INT((long)optval); break; case TidyBoolean: diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 1a5411ca27..d2c58ff2b7 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -131,7 +131,7 @@ static void tokenize(zval *return_value TSRMLS_DC) if (token_type >= 256) { array_init(&keyword); - add_next_index_long(&keyword, token_type); + add_next_index_int(&keyword, token_type); if (token_type == T_END_HEREDOC) { if (CG(increment_lineno)) { token_line = ++CG(zend_lineno); @@ -139,7 +139,7 @@ static void tokenize(zval *return_value TSRMLS_DC) } } add_next_index_stringl(&keyword, (char *)zendtext, zendleng); - add_next_index_long(&keyword, token_line); + add_next_index_int(&keyword, token_line); add_next_index_zval(return_value, &keyword); } else { add_next_index_stringl(return_value, (char *)zendtext, zendleng); @@ -158,9 +158,9 @@ static void tokenize(zval *return_value TSRMLS_DC) // fetch the rest into a T_INLINE_HTML if (zendcursor != zendlimit) { array_init(&keyword); - add_next_index_long(&keyword, T_INLINE_HTML); + add_next_index_int(&keyword, T_INLINE_HTML); add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor); - add_next_index_long(&keyword, token_line); + add_next_index_int(&keyword, token_line); add_next_index_zval(return_value, &keyword); } break; diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index beb9ea8e5b..b797518ed7 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -29,139 +29,139 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); } char *get_token_type_name(int token_type) diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 0b853f34f2..e0cde68cc1 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -300,7 +300,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx) if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { if (key == NULL) { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); } else { STR_ADDREF(key); } @@ -389,10 +389,10 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC) { php_wddx_add_chunk_static(packet, WDDX_STRING_S); - if (Z_STRLEN_P(var) > 0) { + if (Z_STRSIZE_P(var) > 0) { zend_string *buf; - buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); + buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); php_wddx_add_chunk_ex(packet, buf->val, buf->len); @@ -512,7 +512,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) php_wddx_serialize_var(packet, ent, tmp TSRMLS_CC); STR_RELEASE(tmp); } else { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); STR_RELEASE(key); } @@ -568,7 +568,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) if (key) { php_wddx_serialize_var(packet, ent, key TSRMLS_CC); } else { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); STR_RELEASE(key); } @@ -612,7 +612,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS php_wddx_serialize_string(packet, var TSRMLS_CC); break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: php_wddx_serialize_number(packet, var); break; @@ -750,7 +750,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_NUMBER; SET_STACK_VARNAME; - ZVAL_LONG(&ent.data, 0); + ZVAL_INT(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp((char *)name, EL_BOOLEAN)) { int i; @@ -854,7 +854,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_DATETIME; SET_STACK_VARNAME; - ZVAL_LONG(&ent.data, 0); + ZVAL_INT(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } } @@ -886,7 +886,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (!strcmp((char *)name, EL_BINARY)) { zend_string *new_str; - new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); zval_ptr_dtor(&ent1->data); ZVAL_STR(&ent1->data, new_str); } @@ -919,10 +919,10 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (ent1->varname) { if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) && - Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data)) { + Z_TYPE(ent1->data) == IS_STRING && Z_STRSIZE(ent1->data)) { zend_bool incomplete_class = 0; - zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + zend_str_tolower(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); STR_FORGET_HASH_VAL(Z_STR(ent1->data)); if ((pce = zend_hash_find_ptr(EG(class_table), Z_STR(ent1->data))) == NULL) { incomplete_class = 1; @@ -938,7 +938,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) zval_add_ref, 0); if (incomplete_class) { - php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); } /* Clean up old array entry */ @@ -992,13 +992,13 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) switch (ent->type) { case ST_BINARY: case ST_STRING: - if (Z_STRLEN(ent->data) == 0) { + if (Z_STRSIZE(ent->data) == 0) { zval_ptr_dtor(&ent->data); ZVAL_STRINGL(&ent->data, (char *)s, len); } else { - Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRLEN(ent->data) + len, 0); - memcpy(Z_STRVAL(ent->data) + Z_STRLEN(ent->data) - len, (char *)s, len); - Z_STRVAL(ent->data)[Z_STRLEN(ent->data)] = '\0'; + Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRSIZE(ent->data) + len, 0); + memcpy(Z_STRVAL(ent->data) + Z_STRSIZE(ent->data) - len, (char *)s, len); + Z_STRVAL(ent->data)[Z_STRSIZE(ent->data)] = '\0'; } break; case ST_NUMBER: @@ -1008,9 +1008,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) case ST_BOOLEAN: if (!strcmp((char *)s, "true")) { - Z_LVAL(ent->data) = 1; + Z_IVAL(ent->data) = 1; } else if (!strcmp((char *)s, "false")) { - Z_LVAL(ent->data) = 0; + Z_IVAL(ent->data) = 0; } else { stack->top--; zval_ptr_dtor(&ent->data); @@ -1027,9 +1027,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) memcpy(tmp, (char *)s, len); tmp[len] = '\0'; - Z_LVAL(ent->data) = php_parse_date(tmp, NULL); + Z_IVAL(ent->data) = php_parse_date(tmp, NULL); /* date out of range < 1969 or > 2038 */ - if (Z_LVAL(ent->data) == -1) { + if (Z_IVAL(ent->data) == -1) { ZVAL_STRINGL(&ent->data, (char *)s, len); } efree(tmp); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 2886d6c686..dd88f4b226 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -314,33 +314,33 @@ PHP_MINIT_FUNCTION(xml) { le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number); - REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); /* this object should not be pre-initialised at compile time, as the order of members may vary */ @@ -456,7 +456,7 @@ static void xml_set_handler(zval *handler, zval *data) /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */ if (Z_TYPE_P(data) != IS_ARRAY && Z_TYPE_P(data) != IS_OBJECT) { convert_to_string_ex(data); - if (Z_STRLEN_P(data) == 0) { + if (Z_STRSIZE_P(data) == 0) { ZVAL_UNDEF(handler); return; } @@ -663,9 +663,9 @@ static int _xml_xmlcharlen(const XML_Char *s) PHPAPI char *_xml_zval_strdup(zval *val) { if (Z_TYPE_P(val) == IS_STRING) { - char *buf = emalloc(Z_STRLEN_P(val) + 1); - memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)); - buf[Z_STRLEN_P(val)] = '\0'; + char *buf = emalloc(Z_STRSIZE_P(val) + 1); + memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + buf[Z_STRSIZE_P(val)] = '\0'; return buf; } return NULL; @@ -687,7 +687,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values); } - add_next_index_long(element, parser->curtag); + add_next_index_int(element, parser->curtag); parser->curtag++; } @@ -756,7 +756,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "open"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); parser->ltags[parser->level-1] = estrdup(tag_name->val); parser->lastwasopen = 1; @@ -827,7 +827,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "close"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } @@ -887,9 +887,9 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) /* check if the current tag already has a value - if yes append to that! */ if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) { - int newlen = Z_STRLEN_P(myval) + decoded_value->len; + int newlen = Z_STRSIZE_P(myval) + decoded_value->len; Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, + strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); STR_RELEASE(decoded_value); } else { @@ -904,9 +904,9 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) { if (!strcmp(Z_STRVAL_P(mytype), "cdata")) { if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) { - int newlen = Z_STRLEN_P(myval) + decoded_value->len; + int newlen = Z_STRSIZE_P(myval) + decoded_value->len; Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, + strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); STR_RELEASE(decoded_value); return; @@ -924,7 +924,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) add_assoc_string(&tag, "tag", parser->ltags[parser->level-1] + parser->toffset); add_assoc_str(&tag, "value", decoded_value); add_assoc_string(&tag, "type", "cdata"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } else if (parser->level == (XML_MAXLEVEL + 1)) { @@ -1041,8 +1041,8 @@ int _xml_externalEntityRefHandler(XML_Parser parserPtr, _xml_xmlchar_zval(publicId, 0, parser->target_encoding, &args[4]); xml_call_handler(parser, &parser->externalEntityRefHandler, parser->externalEntityRefPtr, 5, args, &retval); if (!Z_ISUNDEF(retval)) { - convert_to_long(&retval); - ret = Z_LVAL(retval); + convert_to_int(&retval); + ret = Z_IVAL(retval); } else { ret = 0; } @@ -1376,7 +1376,7 @@ PHP_FUNCTION(xml_parse) parser->isparsing = 1; ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal); parser->isparsing = 0; - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} */ @@ -1422,7 +1422,7 @@ PHP_FUNCTION(xml_parse_into_struct) ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, 1); parser->isparsing = 0; - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} */ @@ -1439,7 +1439,7 @@ PHP_FUNCTION(xml_get_error_code) ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETURN_LONG((long)XML_GetErrorCode(parser->parser)); + RETURN_INT((long)XML_GetErrorCode(parser->parser)); } /* }}} */ @@ -1474,7 +1474,7 @@ PHP_FUNCTION(xml_get_current_line_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser)); + RETVAL_INT(XML_GetCurrentLineNumber(parser->parser)); } /* }}} */ @@ -1491,7 +1491,7 @@ PHP_FUNCTION(xml_get_current_column_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser)); + RETVAL_INT(XML_GetCurrentColumnNumber(parser->parser)); } /* }}} */ @@ -1508,7 +1508,7 @@ PHP_FUNCTION(xml_get_current_byte_index) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser)); + RETVAL_INT(XML_GetCurrentByteIndex(parser->parser)); } /* }}} */ @@ -1554,16 +1554,16 @@ PHP_FUNCTION(xml_parser_set_option) switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: - convert_to_long_ex(val); - parser->case_folding = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->case_folding = Z_IVAL_P(val); break; case PHP_XML_OPTION_SKIP_TAGSTART: - convert_to_long_ex(val); - parser->toffset = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->toffset = Z_IVAL_P(val); break; case PHP_XML_OPTION_SKIP_WHITE: - convert_to_long_ex(val); - parser->skipwhite = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->skipwhite = Z_IVAL_P(val); break; case PHP_XML_OPTION_TARGET_ENCODING: { xml_encoding *enc; @@ -1600,7 +1600,7 @@ PHP_FUNCTION(xml_parser_get_option) switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: - RETURN_LONG(parser->case_folding); + RETURN_INT(parser->case_folding); break; case PHP_XML_OPTION_TARGET_ENCODING: RETURN_STRING((char *)parser->target_encoding); diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 443fca3355..eb3e7ab84f 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -100,8 +100,8 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl case IS_FALSE: ZVAL_BOOL(rv, retint); break; - case IS_LONG: - ZVAL_LONG(rv, retint); + case IS_INT: + ZVAL_INT(rv, retint); break; default: ZVAL_NULL(rv); @@ -1313,9 +1313,9 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&xmlreader_prop_handlers, 0, NULL, php_xmlreader_free_prop_handler, 1); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderConstBaseUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasAttributes", xmlTextReaderHasAttributes, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasValue", xmlTextReaderHasValue, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isDefault", xmlTextReaderIsDefault, NULL, IS_FALSE TSRMLS_CC); @@ -1323,43 +1323,43 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_register_prop_handler(&xmlreader_prop_handlers, "localName", NULL, xmlTextReaderConstLocalName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "name", NULL, xmlTextReaderConstName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "namespaceURI", NULL, xmlTextReaderConstNamespaceUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "prefix", NULL, xmlTextReaderConstPrefix, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "value", NULL, xmlTextReaderConstValue, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "xmlLang", NULL, xmlTextReaderConstXmlLang, IS_STRING TSRMLS_CC); /* Constants for NodeType - cannot define common types to share with dom as there are differences in these types */ - REGISTER_XMLREADER_CLASS_CONST_LONG("NONE", XML_READER_TYPE_NONE); - REGISTER_XMLREADER_CLASS_CONST_LONG("ELEMENT", XML_READER_TYPE_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); - REGISTER_XMLREADER_CLASS_CONST_LONG("TEXT", XML_READER_TYPE_TEXT); - REGISTER_XMLREADER_CLASS_CONST_LONG("CDATA", XML_READER_TYPE_CDATA); - REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); - REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY", XML_READER_TYPE_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_LONG("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); - REGISTER_XMLREADER_CLASS_CONST_LONG("COMMENT", XML_READER_TYPE_COMMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC", XML_READER_TYPE_DOCUMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("NOTATION", XML_READER_TYPE_NOTATION); - REGISTER_XMLREADER_CLASS_CONST_LONG("WHITESPACE", XML_READER_TYPE_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_LONG("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_LONG("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("END_ENTITY", XML_READER_TYPE_END_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_LONG("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); + REGISTER_XMLREADER_CLASS_CONST_INT("NONE", XML_READER_TYPE_NONE); + REGISTER_XMLREADER_CLASS_CONST_INT("ELEMENT", XML_READER_TYPE_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); + REGISTER_XMLREADER_CLASS_CONST_INT("TEXT", XML_READER_TYPE_TEXT); + REGISTER_XMLREADER_CLASS_CONST_INT("CDATA", XML_READER_TYPE_CDATA); + REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); + REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY", XML_READER_TYPE_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_INT("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); + REGISTER_XMLREADER_CLASS_CONST_INT("COMMENT", XML_READER_TYPE_COMMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC", XML_READER_TYPE_DOCUMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("NOTATION", XML_READER_TYPE_NOTATION); + REGISTER_XMLREADER_CLASS_CONST_INT("WHITESPACE", XML_READER_TYPE_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_INT("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_INT("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("END_ENTITY", XML_READER_TYPE_END_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_INT("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); /* Constants for Parser options */ - REGISTER_XMLREADER_CLASS_CONST_LONG("LOADDTD", XML_PARSER_LOADDTD); - REGISTER_XMLREADER_CLASS_CONST_LONG("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDATE", XML_PARSER_VALIDATE); - REGISTER_XMLREADER_CLASS_CONST_LONG("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); + REGISTER_XMLREADER_CLASS_CONST_INT("LOADDTD", XML_PARSER_LOADDTD); + REGISTER_XMLREADER_CLASS_CONST_INT("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDATE", XML_PARSER_VALIDATE); + REGISTER_XMLREADER_CLASS_CONST_INT("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); /* Constants for Errors when loading - not yet used until we implement custom error handling - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); */ return SUCCESS; diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h index 63653213fe..1ceb2e1e61 100644 --- a/ext/xmlreader/php_xmlreader.h +++ b/ext/xmlreader/php_xmlreader.h @@ -50,8 +50,8 @@ PHP_MINIT_FUNCTION(xmlreader); PHP_MSHUTDOWN_FUNCTION(xmlreader); PHP_MINFO_FUNCTION(xmlreader); -#define REGISTER_XMLREADER_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_XMLREADER_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #ifdef ZTS #define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v) diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index e4be0f032c..1c560f38d3 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -316,8 +316,8 @@ PHP_MINFO_FUNCTION(xmlrpc) */ #if 0 static int add_long(zval* list, char* id, int num) { - if(id) return add_assoc_long(list, id, num); - else return add_next_index_long(list, num); + if(id) return add_assoc_int(list, id, num); + else return add_next_index_int(list, num); } static int add_double(zval* list, char* id, double num) { @@ -342,7 +342,7 @@ static void add_zval(zval* list, const char* id, zval* val) if (list && val) { if (id) { int id_len = strlen(id); - if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) { + if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_INT) { long index = strtol(id, NULL, 0); zend_hash_index_update(Z_ARRVAL_P(list), index, val); } else { @@ -514,7 +514,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep xReturn = XMLRPC_CreateValueEmpty(); XMLRPC_SetValueID(xReturn, key, 0); } else { - xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val)); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRSIZE(val)); } break; case xmlrpc_datetime: @@ -526,8 +526,8 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep xReturn = XMLRPC_CreateValueBoolean(key, Z_TYPE(val) == IS_TRUE); break; case xmlrpc_int: - convert_to_long(&val); - xReturn = XMLRPC_CreateValueInt(key, Z_LVAL(val)); + convert_to_int(&val); + xReturn = XMLRPC_CreateValueInt(key, Z_IVAL(val)); break; case xmlrpc_double: convert_to_double(&val); @@ -535,7 +535,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep break; case xmlrpc_string: convert_to_string(&val); - xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val)); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRSIZE(val)); break; case xmlrpc_vector: { @@ -616,7 +616,7 @@ static void XMLRPC_to_PHP(XMLRPC_VALUE el, zval *elem) } break; case xmlrpc_int: - ZVAL_LONG(elem, XMLRPC_GetValueInt(el)); + ZVAL_INT(elem, XMLRPC_GetValueInt(el)); break; case xmlrpc_boolean: ZVAL_BOOL(elem, XMLRPC_GetValueBoolean(el)); @@ -1127,9 +1127,9 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) if (xDesc) { int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc); XMLRPC_CleanupValue(xDesc); - RETURN_LONG(retval); + RETURN_INT(retval); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -1273,7 +1273,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ if (timestamp != -1) { zval ztimestamp; - ZVAL_LONG(&ztimestamp, timestamp); + ZVAL_INT(&ztimestamp, timestamp); convert_to_object(value); if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) { @@ -1318,7 +1318,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ #else case IS_BOOL: #endif - case IS_LONG: + case IS_INT: case IS_RESOURCE: type = xmlrpc_int; break; diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index d743a29113..3c3b8a7e7e 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -1756,7 +1756,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) xmlBufferEmpty(buffer); } } else { - RETVAL_LONG(output_bytes); + RETVAL_INT(output_bytes); } return; } diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index bda02498ed..2b08a8a49b 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -161,23 +161,23 @@ PHP_MINIT_FUNCTION(xsl) xsl_ext_function_object_php); xsltSetGenericErrorFunc(NULL, php_libxml_error_handler); - REGISTER_LONG_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXSLT_DOTTED_VERSION", LIBXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #if HAVE_XSL_EXSLT - REGISTER_LONG_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBEXSLT_DOTTED_VERSION", LIBEXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index af01da1513..93abf8d379 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -160,7 +160,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS if (!xpath_params) { xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_P(value) TSRMLS_CC); } else { - xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); + xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); } if (xpath_expr) { params[i++] = estrndup(string_key->val, string_key->len); @@ -346,7 +346,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t nodep = dom_object_get_node(obj); valuePush(ctxt, xmlXPathNewNodeSet(nodep)); } else if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) { - valuePush(ctxt, xmlXPathNewBoolean(Z_LVAL(retval))); + valuePush(ctxt, xmlXPathNewBoolean(Z_IVAL(retval))); } else if (Z_TYPE(retval) == IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string"); valuePush(ctxt, xmlXPathNewString("")); @@ -432,8 +432,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) ZVAL_STRING(&member, "cloneDocument"); cloneDocu = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(cloneDocu) != IS_NULL) { - convert_to_long(cloneDocu); - clone_docu = Z_LVAL_P(cloneDocu); + convert_to_int(cloneDocu); + clone_docu = Z_IVAL_P(cloneDocu); } zval_ptr_dtor(&member); if (clone_docu == 0) { @@ -531,8 +531,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl ZVAL_STRING(&member, "doXInclude"); doXInclude = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(doXInclude) != IS_NULL) { - convert_to_long(doXInclude); - ctxt->xinclude = Z_LVAL_P(doXInclude); + convert_to_int(doXInclude); + ctxt->xinclude = Z_IVAL_P(doXInclude); } zval_ptr_dtor(&member); @@ -710,7 +710,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) xmlFreeDoc(newdocp); } - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} end xsl_xsltprocessor_transform_to_uri */ @@ -863,7 +863,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); - ZVAL_LONG(&new_string ,1); + ZVAL_INT(&new_string ,1); zend_hash_update(intern->registered_phpfunctions, Z_STR_P(entry), &new_string); } ZEND_HASH_FOREACH_END(); @@ -871,7 +871,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XSL_P(id); - ZVAL_LONG(&new_string,1); + ZVAL_INT(&new_string,1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; @@ -925,7 +925,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) intern->securityPrefs = securityPrefs; /* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */ intern->securityPrefsSet = 1; - RETURN_LONG(oldSecurityPrefs); + RETURN_INT(oldSecurityPrefs); } /* }}} end xsl_xsltprocessor_set_security_prefs */ @@ -938,7 +938,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "") == SUCCESS) { intern = Z_XSL_P(id); - RETURN_LONG(intern->securityPrefs); + RETURN_INT(intern->securityPrefs); } else { WRONG_PARAM_COUNT; } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 633644e4e9..2fb20a5df3 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -90,7 +90,7 @@ static int le_zip_entry; /* }}} */ # define add_ascii_assoc_string add_assoc_string -# define add_ascii_assoc_long add_assoc_long +# define add_ascii_assoc_long add_assoc_int /* Flatten a path by making a relative path (to .)*/ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ @@ -316,13 +316,13 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, char **re zval *option; if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) { long opt; - if (Z_TYPE_P(option) != IS_LONG) { + if (Z_TYPE_P(option) != IS_INT) { zval tmp; ZVAL_DUP(&tmp, option); - convert_to_long(&tmp); - opt = Z_LVAL(tmp); + convert_to_int(&tmp); + opt = Z_IVAL(tmp); } else { - opt = Z_LVAL_P(option); + opt = Z_IVAL_P(option); } *remove_all_path = opt; } @@ -334,17 +334,17 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, char **re return -1; } - if (Z_STRLEN_P(option) < 1) { + if (Z_STRSIZE_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as remove_path option"); return -1; } - if (Z_STRLEN_P(option) >= MAXPATHLEN) { + if (Z_STRSIZE_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "remove_path string is too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRLEN_P(option)); + MAXPATHLEN - 1, Z_STRSIZE_P(option)); return -1; } - *remove_path_len = Z_STRLEN_P(option); + *remove_path_len = Z_STRSIZE_P(option); *remove_path = Z_STRVAL_P(option); } @@ -354,26 +354,26 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, char **re return -1; } - if (Z_STRLEN_P(option) < 1) { + if (Z_STRSIZE_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as the add_path option"); return -1; } - if (Z_STRLEN_P(option) >= MAXPATHLEN) { + if (Z_STRSIZE_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRLEN_P(option)); + MAXPATHLEN - 1, Z_STRSIZE_P(option)); return -1; } - *add_path_len = Z_STRLEN_P(option); + *add_path_len = Z_STRSIZE_P(option); *add_path = Z_STRVAL_P(option); } return 1; } /* }}} */ -/* {{{ REGISTER_ZIP_CLASS_CONST_LONG */ -#define REGISTER_ZIP_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +/* {{{ REGISTER_ZIP_CLASS_CONST_INT */ +#define REGISTER_ZIP_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* }}} */ /* {{{ ZIP_FROM_OBJECT */ @@ -818,8 +818,8 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, case IS_FALSE: ZVAL_BOOL(rv, (long)retint); break; - case IS_LONG: - ZVAL_LONG(rv, (long)retint); + case IS_INT: + ZVAL_INT(rv, (long)retint); break; default: ZVAL_NULL(rv); @@ -1124,7 +1124,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) rsrc_int->za = zip_open(resolved_path, 0, &err); if (rsrc_int->za == NULL) { efree(rsrc_int); - RETURN_LONG((long)err); + RETURN_INT((long)err); } rsrc_int->index_current = 0; @@ -1296,10 +1296,10 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ RETURN_STRING((char *)zr_rsrc->sb.name); break; case 1: - RETURN_LONG((long) (zr_rsrc->sb.comp_size)); + RETURN_INT((long) (zr_rsrc->sb.comp_size)); break; case 2: - RETURN_LONG((long) (zr_rsrc->sb.size)); + RETURN_INT((long) (zr_rsrc->sb.size)); break; case 3: switch (zr_rsrc->sb.comp_method) { @@ -1333,7 +1333,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ default: RETURN_FALSE; } - RETURN_LONG((long) (zr_rsrc->sb.comp_method)); + RETURN_INT((long) (zr_rsrc->sb.comp_method)); break; } @@ -1423,7 +1423,7 @@ static ZIPARCHIVE_METHOD(open) intern = zip_open(resolved_path, flags, &err); if (!intern || err) { efree(resolved_path); - RETURN_LONG((long)err); + RETURN_INT((long)err); } ze_obj->filename = resolved_path; ze_obj->filename_len = strlen(resolved_path); @@ -1632,15 +1632,15 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(return_value), i)) != NULL) { if (remove_all_path) { - basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0 TSRMLS_CC); + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), NULL, 0 TSRMLS_CC); file_stripped = basename->val; file_stripped_len = basename->len; } else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) { file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1; - file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1; + file_stripped_len = Z_STRSIZE_P(zval_file) - remove_path_len - 1; } else { file_stripped = Z_STRVAL_P(zval_file); - file_stripped_len = Z_STRLEN_P(zval_file); + file_stripped_len = Z_STRSIZE_P(zval_file); } if (add_path) { @@ -1656,13 +1656,13 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* entry_name_len = strlen(entry_name); } else { entry_name = Z_STRVAL_P(zval_file); - entry_name_len = Z_STRLEN_P(zval_file); + entry_name_len = Z_STRSIZE_P(zval_file); } if (basename) { STR_RELEASE(basename); basename = NULL; } - if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), + if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), entry_name, entry_name_len, 0, 0 TSRMLS_CC) < 0) { zval_dtor(return_value); RETURN_FALSE; @@ -1871,7 +1871,7 @@ static ZIPARCHIVE_METHOD(locateName) idx = (long)zip_name_locate(intern, (const char *)name->val, flags); if (idx >= 0) { - RETURN_LONG(idx); + RETURN_INT(idx); } else { RETURN_FALSE; } @@ -2129,9 +2129,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) RETURN_FALSE; } zval_ptr_dtor(z_opsys); - ZVAL_LONG(z_opsys, opsys); + ZVAL_INT(z_opsys, opsys); zval_ptr_dtor(z_attr); - ZVAL_LONG(z_attr, attr); + ZVAL_INT(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2164,9 +2164,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) RETURN_FALSE; } zval_dtor(z_opsys); - ZVAL_LONG(z_opsys, opsys); + ZVAL_INT(z_opsys, opsys); zval_dtor(z_attr); - ZVAL_LONG(z_attr, attr); + ZVAL_INT(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2518,7 +2518,7 @@ static ZIPARCHIVE_METHOD(extractTo) if (zval_files && (Z_TYPE_P(zval_files) != IS_NULL)) { switch (Z_TYPE_P(zval_files)) { case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRSIZE_P(zval_files) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2530,10 +2530,10 @@ static ZIPARCHIVE_METHOD(extractTo) for (i = 0; i < nelems; i++) { if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) { switch (Z_TYPE_P(zval_file)) { - case IS_LONG: + case IS_INT: break; case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2541,7 +2541,7 @@ static ZIPARCHIVE_METHOD(extractTo) } } break; - case IS_LONG: + case IS_INT: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -2897,88 +2897,88 @@ static PHP_MINIT_FUNCTION(zip) zip_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1); - php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_INT TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_INT TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_INT TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "filename", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "comment", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC); - REGISTER_ZIP_CLASS_CONST_LONG("CREATE", ZIP_CREATE); - REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL); - REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS); - REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE); - - REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE); - REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR); - REGISTER_ZIP_CLASS_CONST_LONG("FL_COMPRESSED", ZIP_FL_COMPRESSED); - REGISTER_ZIP_CLASS_CONST_LONG("FL_UNCHANGED", ZIP_FL_UNCHANGED); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFAULT", ZIP_CM_DEFAULT); - REGISTER_ZIP_CLASS_CONST_LONG("CM_STORE", ZIP_CM_STORE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_SHRINK", ZIP_CM_SHRINK); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_1", ZIP_CM_REDUCE_1); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_2", ZIP_CM_REDUCE_2); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_3", ZIP_CM_REDUCE_3); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_4", ZIP_CM_REDUCE_4); - REGISTER_ZIP_CLASS_CONST_LONG("CM_IMPLODE", ZIP_CM_IMPLODE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE", ZIP_CM_DEFLATE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE64", ZIP_CM_DEFLATE64); - REGISTER_ZIP_CLASS_CONST_LONG("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_BZIP2", ZIP_CM_BZIP2); - REGISTER_ZIP_CLASS_CONST_LONG("CM_LZMA", ZIP_CM_LZMA); - REGISTER_ZIP_CLASS_CONST_LONG("CM_TERSE", ZIP_CM_TERSE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_LZ77", ZIP_CM_LZ77); - REGISTER_ZIP_CLASS_CONST_LONG("CM_WAVPACK", ZIP_CM_WAVPACK); - REGISTER_ZIP_CLASS_CONST_LONG("CM_PPMD", ZIP_CM_PPMD); + REGISTER_ZIP_CLASS_CONST_INT("CREATE", ZIP_CREATE); + REGISTER_ZIP_CLASS_CONST_INT("EXCL", ZIP_EXCL); + REGISTER_ZIP_CLASS_CONST_INT("CHECKCONS", ZIP_CHECKCONS); + REGISTER_ZIP_CLASS_CONST_INT("OVERWRITE", ZIP_OVERWRITE); + + REGISTER_ZIP_CLASS_CONST_INT("FL_NOCASE", ZIP_FL_NOCASE); + REGISTER_ZIP_CLASS_CONST_INT("FL_NODIR", ZIP_FL_NODIR); + REGISTER_ZIP_CLASS_CONST_INT("FL_COMPRESSED", ZIP_FL_COMPRESSED); + REGISTER_ZIP_CLASS_CONST_INT("FL_UNCHANGED", ZIP_FL_UNCHANGED); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFAULT", ZIP_CM_DEFAULT); + REGISTER_ZIP_CLASS_CONST_INT("CM_STORE", ZIP_CM_STORE); + REGISTER_ZIP_CLASS_CONST_INT("CM_SHRINK", ZIP_CM_SHRINK); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_1", ZIP_CM_REDUCE_1); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_2", ZIP_CM_REDUCE_2); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_3", ZIP_CM_REDUCE_3); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_4", ZIP_CM_REDUCE_4); + REGISTER_ZIP_CLASS_CONST_INT("CM_IMPLODE", ZIP_CM_IMPLODE); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE", ZIP_CM_DEFLATE); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE64", ZIP_CM_DEFLATE64); + REGISTER_ZIP_CLASS_CONST_INT("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); + REGISTER_ZIP_CLASS_CONST_INT("CM_BZIP2", ZIP_CM_BZIP2); + REGISTER_ZIP_CLASS_CONST_INT("CM_LZMA", ZIP_CM_LZMA); + REGISTER_ZIP_CLASS_CONST_INT("CM_TERSE", ZIP_CM_TERSE); + REGISTER_ZIP_CLASS_CONST_INT("CM_LZ77", ZIP_CM_LZ77); + REGISTER_ZIP_CLASS_CONST_INT("CM_WAVPACK", ZIP_CM_WAVPACK); + REGISTER_ZIP_CLASS_CONST_INT("CM_PPMD", ZIP_CM_PPMD); /* Error code */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_OK", ZIP_ER_OK); /* N No error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_READ", ZIP_ER_READ); /* S Read error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CRC", ZIP_ER_CRC); /* N CRC error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ + REGISTER_ZIP_CLASS_CONST_INT("ER_OK", ZIP_ER_OK); /* N No error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ + REGISTER_ZIP_CLASS_CONST_INT("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_READ", ZIP_ER_READ); /* S Read error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CRC", ZIP_ER_CRC); /* N CRC error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ + REGISTER_ZIP_CLASS_CONST_INT("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ + REGISTER_ZIP_CLASS_CONST_INT("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ + REGISTER_ZIP_CLASS_CONST_INT("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ + REGISTER_ZIP_CLASS_CONST_INT("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ #ifdef ZIP_OPSYS_DEFAULT - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DOS", ZIP_OPSYS_DOS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_UNIX", ZIP_OPSYS_UNIX); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_2", ZIP_OPSYS_OS_2); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_CPM", ZIP_OPSYS_CPM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MVS", ZIP_OPSYS_MVS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VSE", ZIP_OPSYS_VSE); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VFAT", ZIP_OPSYS_VFAT); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_BEOS", ZIP_OPSYS_BEOS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_400", ZIP_OPSYS_OS_400); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_X", ZIP_OPSYS_OS_X); - - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DOS", ZIP_OPSYS_DOS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_UNIX", ZIP_OPSYS_UNIX); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_2", ZIP_OPSYS_OS_2); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_CPM", ZIP_OPSYS_CPM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MVS", ZIP_OPSYS_MVS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VSE", ZIP_OPSYS_VSE); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VFAT", ZIP_OPSYS_VFAT); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_BEOS", ZIP_OPSYS_BEOS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_400", ZIP_OPSYS_OS_400); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_X", ZIP_OPSYS_OS_X); + + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); #endif /* ifdef ZIP_OPSYS_DEFAULT */ php_register_url_stream_wrapper("zip", &php_stream_zip_wrapper TSRMLS_CC); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index c38d6eca2c..cf6a2c5cb7 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -623,7 +623,7 @@ static PHP_FUNCTION(readgzfile) } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -937,12 +937,12 @@ static PHP_MINIT_FUNCTION(zlib) php_output_handler_conflict_register(ZEND_STRL("ob_gzhandler"), php_zlib_output_conflict_check TSRMLS_CC); php_output_handler_conflict_register(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), php_zlib_output_conflict_check TSRMLS_CC); - REGISTER_LONG_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); REGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c index 0b91edfb02..cd68268ad9 100644 --- a/ext/zlib/zlib_filter.c +++ b/ext/zlib/zlib_filter.c @@ -333,11 +333,11 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f /* log-2 base of history window (9 - 15) */ ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); - if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 32) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp)); + convert_to_int(&tmp); + if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 32) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp)); } else { - windowBits = Z_LVAL(tmp); + windowBits = Z_IVAL(tmp); } } } @@ -364,25 +364,25 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f case IS_OBJECT: if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "memory", sizeof("memory") -1))) { ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); /* Memory Level (1 - 9) */ - if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > MAX_MEM_LEVEL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > MAX_MEM_LEVEL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_IVAL(tmp)); } else { - memLevel = Z_LVAL(tmp); + memLevel = Z_IVAL(tmp); } } if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "window", sizeof("window") - 1))) { ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); /* log-2 base of history window (9 - 15) */ - if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 16) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 16) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp)); } else { - windowBits = Z_LVAL(tmp); + windowBits = Z_IVAL(tmp); } } @@ -395,17 +395,17 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f break; case IS_STRING: case IS_DOUBLE: - case IS_LONG: + case IS_INT: ZVAL_COPY_VALUE(&tmp, filterparams); factory_setlevel: zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */ - if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < -1 || Z_IVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_IVAL(tmp)); } else { - level = Z_LVAL(tmp); + level = Z_IVAL(tmp); } break; default: |