Hi,
My name is Henrique do N. Angelo and I'm currently working on the
implementation of Unicode into PHP 6 as a Google Summer of Code 2008
project, mentored by Scott MacVicar. Scott has been helping me for the past
few weeks and, so far, I've got a couple patches done.
Following Philip's advice, I'm sending here some of the patches I've written
so far and soon I will be requesting a cvs account.
If you want to contact me directly, feel free to send me an email or talk to
me at #php.pecl at efnet, I'm hnangelo.
Cheers
Henrique
Index: ext/date/php_date.c
===================================================================
RCS file: /repository/php-src/ext/date/php_date.c,v
retrieving revision 1.187
diff -u -r1.187 php_date.c
--- ext/date/php_date.c 20 May 2008 12:07:13 -0000 1.187
+++ ext/date/php_date.c 31 May 2008 03:36:17 -0000
@@ -1214,7 +1214,7 @@
}
/* }}} */
-/* {{{ proto string date(string format [, long timestamp])
+/* {{{ proto string date(string format [, long timestamp]) U
Format a local date/time */
PHP_FUNCTION(date)
{
@@ -1222,7 +1222,7 @@
}
/* }}} */
-/* {{{ proto string gmdate(string format [, long timestamp])
+/* {{{ proto string gmdate(string format [, long timestamp]) U
Format a GMT date/time */
PHP_FUNCTION(gmdate)
{
@@ -1230,7 +1230,7 @@
}
/* }}} */
-/* {{{ proto int idate(string format [, int timestamp])
+/* {{{ proto int idate(string format [, int timestamp]) U
Format a local time/date as integer */
PHP_FUNCTION(idate)
{
@@ -1292,7 +1292,7 @@
/* }}} */
-/* {{{ proto int strtotime(string time [, int now ])
+/* {{{ proto int strtotime(string time [, int now ]) U
Convert string representation of date and time to a timestamp */
PHP_FUNCTION(strtotime)
{
@@ -1453,7 +1453,7 @@
}
/* }}} */
-/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day
[, int year]]]]]])
+/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day
[, int year]]]]]]) U
Get UNIX timestamp for a date */
PHP_FUNCTION(mktime)
{
@@ -1461,7 +1461,7 @@
}
/* }}} */
-/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int
day [, int year]]]]]])
+/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int
day [, int year]]]]]]) U
Get UNIX timestamp for a GMT date */
PHP_FUNCTION(gmmktime)
{
@@ -1470,7 +1470,7 @@
/* }}} */
-/* {{{ proto bool checkdate(int month, int day, int year)
+/* {{{ proto bool checkdate(int month, int day, int year) U
Returns true(1) if it is a valid date in gregorian calendar */
PHP_FUNCTION(checkdate)
{
@@ -1578,7 +1578,7 @@
}
/* }}} */
-/* {{{ proto string strftime(string format [, int timestamp])
+/* {{{ proto string strftime(string format [, int timestamp]) U
Format a local time/date according to locale settings */
PHP_FUNCTION(strftime)
{
@@ -1586,7 +1586,7 @@
}
/* }}} */
-/* {{{ proto string gmstrftime(string format [, int timestamp])
+/* {{{ proto string gmstrftime(string format [, int timestamp]) U
Format a GMT/UCT time/date according to locale settings */
PHP_FUNCTION(gmstrftime)
{
@@ -1595,7 +1595,7 @@
/* }}} */
#endif
-/* {{{ proto int time(void)
+/* {{{ proto int time(void) U
Return current UNIX timestamp */
PHP_FUNCTION(time)
{
@@ -1603,7 +1603,7 @@
}
/* }}} */
-/* {{{ proto array localtime([int timestamp [, bool associative_array]])
+/* {{{ proto array localtime([int timestamp [, bool associative_array]]) U
Returns the results of the C system call localtime as an associative array
if the associative_array argument is set to 1 other wise it is a regular array
*/
PHP_FUNCTION(localtime)
{
@@ -1650,7 +1650,7 @@
}
/* }}} */
-/* {{{ proto array getdate([int timestamp])
+/* {{{ proto array getdate([int timestamp]) U
Get date/time information */
PHP_FUNCTION(getdate)
{
@@ -1678,8 +1678,8 @@
add_ascii_assoc_long(return_value, "mon", ts->m);
add_ascii_assoc_long(return_value, "year", ts->y);
add_ascii_assoc_long(return_value, "yday", timelib_day_of_year(ts->y,
ts->m, ts->d));
- add_ascii_assoc_string(return_value, "weekday",
php_date_full_day_name(ts->y, ts->m, ts->d), 1);
- add_ascii_assoc_string(return_value, "month", mon_full_names[ts->m -
1], 1);
+ add_ascii_assoc_ascii_string(return_value, "weekday",
php_date_full_day_name(ts->y, ts->m, ts->d), 1);
+ add_ascii_assoc_ascii_string(return_value, "month",
mon_full_names[ts->m - 1], 1);
add_index_long(return_value, 0, timestamp);
timelib_time_dtor(ts);
@@ -2028,7 +2028,7 @@
MAKE_STD_ZVAL(zv);
switch (dateobj->time->zone_type) {
case TIMELIB_ZONETYPE_ID:
- ZVAL_STRING(zv, dateobj->time->tz_info->name,
1);
+ ZVAL_ASCII_STRING(zv,
dateobj->time->tz_info->name, 1);
break;
case TIMELIB_ZONETYPE_OFFSET: {
char *tmpstr = emalloc(sizeof("UTC+05:00"));
@@ -2039,11 +2039,11 @@
abs(utc_offset / 60),
abs((utc_offset % 60)));
- ZVAL_STRING(zv, tmpstr, 0);
+ ZVAL_ASCII_STRING(zv, tmpstr, 0);
}
break;
case TIMELIB_ZONETYPE_ABBR:
- ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
+ ZVAL_ASCII_STRING(zv, dateobj->time->tz_abbr,
1);
break;
}
zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
@@ -2356,7 +2356,7 @@
return 1;
}
-/* {{{ proto DateTime date_create([string time[, DateTimeZone object]])
+/* {{{ proto DateTime date_create([string time[, DateTimeZone object]]) U
Returns new DateTime object
*/
PHP_FUNCTION(date_create)
@@ -2376,7 +2376,7 @@
}
/* }}} */
-/* {{{ proto DateTime date_create_from_format(string format, string time[,
DateTimeZone object])
+/* {{{ proto DateTime date_create_from_format(string format, string time[,
DateTimeZone object])
Returns new DateTime object formatted according to the specified format
*/
PHP_FUNCTION(date_create_from_format)
@@ -2504,7 +2504,7 @@
MAKE_STD_ZVAL(element);
array_init(element);
for (i = 0; i < error->warning_count; i++) {
- add_index_string(element, error->warning_messages[i].position,
error->warning_messages[i].message, 1);
+ add_index_ascii_string(element,
error->warning_messages[i].position, error->warning_messages[i].message, 1);
}
add_ascii_assoc_zval(z, "warnings", element);
@@ -2512,12 +2512,12 @@
MAKE_STD_ZVAL(element);
array_init(element);
for (i = 0; i < error->error_count; i++) {
- add_index_string(element, error->error_messages[i].position,
error->error_messages[i].message, 1);
+ add_index_ascii_string(element,
error->error_messages[i].position, error->error_messages[i].message, 1);
}
add_ascii_assoc_zval(z, "errors", element);
}
-/* {{{ proto array date_get_last_errorse()
+/* {{{ proto array date_get_last_errorse() U
Returns the warnings and errors found while parsing a date/time string.
*/
PHP_FUNCTION(date_get_last_errors)
@@ -2606,7 +2606,7 @@
timelib_time_dtor(parsed_time);
}
-/* {{{ proto array date_parse(string date)
+/* {{{ proto array date_parse(string date) U
Returns associative array with detailed info about given date
*/
PHP_FUNCTION(date_parse)
@@ -2625,7 +2625,7 @@
}
/* }}} */
-/* {{{ proto array date_parse(string date)
+/* {{{ proto array date_parse_from_format(string format, string date) U
Returns associative array with detailed info about given date
*/
PHP_FUNCTION(date_parse_from_format)
@@ -2644,7 +2644,7 @@
}
/* }}} */
-/* {{{ proto string date_format(DateTime object, string format)
+/* {{{ proto string date_format(DateTime object, string format) U
Returns date formatted according to given format
*/
PHP_FUNCTION(date_format)
@@ -2668,7 +2668,7 @@
}
/* }}} */
-/* {{{ proto string date_format_locale(DateTime object, string format)
+/* {{{ proto string date_format_locale(DateTime object, string format) U
*/
PHP_FUNCTION(date_format_locale)
{
@@ -2691,7 +2691,7 @@
}
/* }}} */
-/* {{{ proto void date_modify(DateTime object, string modify)
+/* {{{ proto void date_modify(DateTime object, string modify) U
Alters the timestamp.
*/
PHP_FUNCTION(date_modify)
@@ -2726,7 +2726,7 @@
}
/* }}} */
-/* {{{ proto void date_add(DateTime object, DateInterval interval)
+/* {{{ proto void date_add(DateTime object, DateInterval interval) U
Adds an interval to the current date in object.
*/
PHP_FUNCTION(date_add)
@@ -2764,7 +2764,7 @@
}
/* }}} */
-/* {{{ proto void date_sub(DateTime object, DateInterval interval)
+/* {{{ proto void date_sub(DateTime object, DateInterval interval) U
Subtracts an interval to the current date in object.
*/
PHP_FUNCTION(date_sub)
@@ -2802,7 +2802,7 @@
}
/* }}} */
-/* {{{ proto DateTimeZone date_timezone_get(DateTime object)
+/* {{{ proto DateTimeZone date_timezone_get(DateTime object) U
Return new DateTimeZone object relative to give DateTime
*/
PHP_FUNCTION(date_timezone_get)
@@ -2867,7 +2867,7 @@
}
/* }}} */
-/* {{{ proto long date_offset_get(DateTime object)
+/* {{{ proto long date_offset_get(DateTime object) U
Returns the DST offset.
*/
PHP_FUNCTION(date_offset_get)
@@ -2902,7 +2902,7 @@
}
/* }}} */
-/* {{{ proto void date_time_set(DateTime object, long hour, long minute[, long
second])
+/* {{{ proto void date_time_set(DateTime object, long hour, long minute[, long
second]) U
Sets the time.
*/
PHP_FUNCTION(date_time_set)
@@ -2923,7 +2923,7 @@
}
/* }}} */
-/* {{{ proto void date_date_set(DateTime object, long year, long month, long
day)
+/* {{{ proto void date_date_set(DateTime object, long year, long month, long
day) U
Sets the date.
*/
PHP_FUNCTION(date_date_set)
@@ -2944,7 +2944,7 @@
}
/* }}} */
-/* {{{ proto void date_isodate_set(DateTime object, long year, long week[,
long day])
+/* {{{ proto void date_isodate_set(DateTime object, long year, long week[,
long day]) U
Sets the ISO date.
*/
PHP_FUNCTION(date_isodate_set)
@@ -2968,7 +2968,7 @@
}
/* }}} */
-/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp)
+/* {{{ proto void date_timestamp_set(DateTime object, long unixTimestamp) U
Sets the date and time based on an Unix timestamp.
*/
PHP_FUNCTION(date_timestamp_set)
@@ -2987,7 +2987,7 @@
}
/* }}} */
-/* {{{ proto long date_timestamp_get(DateTime object)
+/* {{{ proto long date_timestamp_get(DateTime object) U
Gets the Unix timestamp.
*/
PHP_FUNCTION(date_timestamp_get)
@@ -3013,7 +3013,7 @@
}
/* }}} */
-/* {{{ proto DateInterval date_diff(DateTime object [, bool absolute])
+/* {{{ proto DateInterval date_diff(DateTime object [, bool absolute]) U
Returns the difference between two DateTime objects.
*/
PHP_FUNCTION(date_diff)
@@ -3063,7 +3063,7 @@
}
}
-/* {{{ proto DateTimeZone timezone_open(string timezone)
+/* {{{ proto DateTimeZone timezone_open(string timezone) U
Returns new DateTimeZone object
*/
PHP_FUNCTION(timezone_open)
@@ -3111,7 +3111,7 @@
}
/* }}} */
-/* {{{ proto string timezone_name_get(DateTimeZone object)
+/* {{{ proto string timezone_name_get(DateTimeZone object) U
Returns the name of the timezone.
*/
PHP_FUNCTION(timezone_name_get)
@@ -3138,7 +3138,7 @@
abs(utc_offset / 60),
abs((utc_offset % 60)));
- RETURN_ASCII_STRING(tmpstr, 0);
+ RETURN_ASCII_STRING(tmpstr, ZSTR_AUTOFREE);
}
break;
case TIMELIB_ZONETYPE_ABBR:
@@ -3148,7 +3148,7 @@
}
/* }}} */
-/* {{{ proto string timezone_name_from_abbr(string abbr[, long gmtOffset[,
long isdst]])
+/* {{{ proto string timezone_name_from_abbr(string abbr[, long gmtOffset[,
long isdst]]) U
Returns the timezone name from abbrevation
*/
PHP_FUNCTION(timezone_name_from_abbr)
@@ -3165,14 +3165,14 @@
tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
if (tzid) {
- RETURN_STRING(tzid, 1);
+ RETURN_ASCII_STRING(tzid, 1);
} else {
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTime object)
+/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTime object) U
Returns the timezone offset.
*/
PHP_FUNCTION(timezone_offset_get)
@@ -3206,7 +3206,7 @@
}
/* }}} */
-/* {{{ proto array timezone_transitions_get(DateTimeZone object [, long
timestamp_begin [, long timestamp_end ]])
+/* {{{ proto array timezone_transitions_get(DateTimeZone object [, long
timestamp_begin [, long timestamp_end ]]) U
Returns numerically indexed array containing associative array for all
transitions in the specified range for the timezone.
*/
PHP_FUNCTION(timezone_transitions_get)
@@ -3236,7 +3236,7 @@
} \
add_ascii_assoc_long(element, "offset",
tzobj->tzi.tz->type[0].offset); \
add_ascii_assoc_bool(element, "isdst",
tzobj->tzi.tz->type[0].isdst); \
- add_ascii_assoc_string(element, "abbr",
&tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \
+ add_ascii_assoc_ascii_string(element, "abbr",
&tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx], 1); \
add_next_index_zval(return_value, element);
#define add(i,ts) \
@@ -3250,7 +3250,7 @@
} \
add_ascii_assoc_long(element, "offset",
tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \
add_ascii_assoc_bool(element, "isdst",
tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \
- add_ascii_assoc_string(element, "abbr",
&tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx],
1); \
+ add_ascii_assoc_ascii_string(element, "abbr",
&tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx],
1); \
add_next_index_zval(return_value, element);
#define add_last() add(tzobj->tzi.tz->timecnt - 1, timestamp_begin)
@@ -3514,7 +3514,7 @@
}
/* }}} */
-/* {{{ proto string date_interval_format(DateInterval object)
+/* {{{ proto string date_interval_format(DateInterval object, string format) U
Formats the interval.
*/
PHP_FUNCTION(date_interval_format)
@@ -3530,7 +3530,7 @@
diobj = (php_interval_obj *) zend_object_store_get_object(object
TSRMLS_CC);
DATE_CHECK_INITIALIZED(diobj->initialized, DateInterval);
- RETURN_STRING(date_interval_format(format, format_len, diobj->diff), 0);
+ RETURN_ASCII_STRING(date_interval_format(format, format_len,
diobj->diff), ZSTR_AUTOFREE);
}
/* }}} */
@@ -3661,7 +3661,7 @@
return 0;
}
-/* {{{ proto array timezone_identifiers_list([long what])
+/* {{{ proto array timezone_identifiers_list([long what]) U
Returns numerically index array with all timezone identifiers.
*/
PHP_FUNCTION(timezone_identifiers_list)
@@ -3683,13 +3683,13 @@
for (i = 0; i < item_count; ++i) {
if (what == PHP_DATE_TIMEZONE_GROUP_ALL_W_BC ||
check_id_allowed(table[i].id, what)) {
- add_next_index_string(return_value, table[i].id, 1);
+ add_next_index_ascii_string(return_value, table[i].id,
1);
}
};
}
/* }}} */
-/* {{{ proto array timezone_abbreviations_list()
+/* {{{ proto array timezone_abbreviations_list() U
Returns associative array containing dst, offset and the timezone name
*/
PHP_FUNCTION(timezone_abbreviations_list)
@@ -3725,7 +3725,7 @@
}
/* }}} */
-/* {{{ proto bool date_default_timezone_set(string timezone_identifier)
+/* {{{ proto bool date_default_timezone_set(string timezone_identifier) U
Sets the default timezone used by all date/time functions in a script */
PHP_FUNCTION(date_default_timezone_set)
{
@@ -3748,7 +3748,7 @@
}
/* }}} */
-/* {{{ proto string date_default_timezone_get()
+/* {{{ proto string date_default_timezone_get() U
Gets the default timezone used by all date/time functions in a script */
PHP_FUNCTION(date_default_timezone_get)
{
@@ -3846,7 +3846,7 @@
}
/* }}} */
-/* {{{ proto mixed date_sunrise(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
+/* {{{ proto mixed date_sunrise(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]]) U
Returns time of sunrise for a given day and location */
PHP_FUNCTION(date_sunrise)
{
@@ -3854,7 +3854,7 @@
}
/* }}} */
-/* {{{ proto mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]])
+/* {{{ proto mixed date_sunset(mixed time [, int format [, float latitude [,
float longitude [, float zenith [, float gmt_offset]]]]]) U
Returns time of sunset for a given day and location */
PHP_FUNCTION(date_sunset)
{
@@ -3862,7 +3862,7 @@
}
/* }}} */
-/* {{{ proto array date_sun_info(long time, float latitude, float longitude)
+/* {{{ proto array date_sun_info(long time, float latitude, float longitude) U
Returns an array with information about sun set/rise and twilight begin/end
*/
PHP_FUNCTION(date_sun_info)
{
Index: ext/exif/exif.c
===================================================================
RCS file: /repository/php-src/ext/exif/exif.c,v
retrieving revision 1.201
diff -u -r1.201 exif.c
--- ext/exif/exif.c 12 Mar 2008 17:32:26 -0000 1.201
+++ ext/exif/exif.c 30 May 2008 22:44:04 -0000
@@ -1970,7 +1970,7 @@
/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding infos:
tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname(info_tag, buffer,
-12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length,
info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no
data>"):exif_get_tagformat(info_data->format));*/
#endif
if (info_data->length==0) {
- add_assoc_null(tmpi, name);
+ add_ascii_assoc_null(tmpi, name);
} else {
switch (info_data->format) {
default:
@@ -1983,9 +1983,9 @@
case TAG_FMT_SBYTE:
case TAG_FMT_UNDEFINED:
if (!info_value->s) {
- add_assoc_stringl(tmpi,
name, "", 0, 1);
+
add_ascii_assoc_ascii_stringl(tmpi, name, "", 0, 1);
} else {
- add_assoc_stringl(tmpi,
name, info_value->s, info_data->length, 1);
+
add_ascii_assoc_ascii_stringl(tmpi, name, info_value->s, info_data->length, 1);
}
break;
@@ -1994,9 +1994,9 @@
val = "";
}
if
(section_index==SECTION_COMMENT) {
- add_index_string(tmpi,
idx++, val, 1);
+
add_index_ascii_string(tmpi, idx++, val, 1);
} else {
- add_assoc_string(tmpi,
name, val, 1);
+
add_ascii_assoc_ascii_string(tmpi, name, val, 1);
}
break;
@@ -2032,7 +2032,7 @@
case
TAG_FMT_USHORT:
case
TAG_FMT_ULONG:
if
(l==1) {
-
add_assoc_long(tmpi, name, (int)info_value->u);
+
add_ascii_assoc_long(tmpi, name, (int)info_value->u);
} else {
add_index_long(array, ap, (int)info_value->u);
}
@@ -2041,9 +2041,9 @@
case
TAG_FMT_URATIONAL:
snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num,
info_value->ur.den);
if
(l==1) {
-
add_assoc_string(tmpi, name, buffer, 1);
+
add_ascii_assoc_ascii_string(tmpi, name, buffer, 1);
} else {
-
add_index_string(array, ap, buffer, 1);
+
add_index_ascii_string(array, ap, buffer, 1);
}
break;
@@ -2058,7 +2058,7 @@
case
TAG_FMT_SSHORT:
case
TAG_FMT_SLONG:
if
(l==1) {
-
add_assoc_long(tmpi, name, info_value->i);
+
add_ascii_assoc_long(tmpi, name, info_value->i);
} else {
add_index_long(array, ap, info_value->i);
}
@@ -2067,15 +2067,15 @@
case
TAG_FMT_SRATIONAL:
snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num,
info_value->sr.den);
if
(l==1) {
-
add_assoc_string(tmpi, name, buffer, 1);
+
add_ascii_assoc_ascii_string(tmpi, name, buffer, 1);
} else {
-
add_index_string(array, ap, buffer, 1);
+
add_index_ascii_string(array, ap, buffer, 1);
}
break;
case
TAG_FMT_SINGLE:
if
(l==1) {
-
add_assoc_double(tmpi, name, info_value->f);
+
add_ascii_assoc_double(tmpi, name, info_value->f);
} else {
add_index_double(array, ap, info_value->f);
}
@@ -2083,7 +2083,7 @@
case
TAG_FMT_DOUBLE:
if
(l==1) {
-
add_assoc_double(tmpi, name, info_value->d);
+
add_ascii_assoc_double(tmpi, name, info_value->d);
} else {
add_index_double(array, ap, info_value->d);
}
@@ -2092,14 +2092,14 @@
info_value =
&info_data->value.list[ap];
}
if (l>1) {
- add_assoc_zval(tmpi,
name, array);
+
add_ascii_assoc_zval(tmpi, name, array);
}
break;
}
}
}
if (sub_array) {
- add_assoc_zval(value,
exif_get_sectionname(section_index), tmpi);
+ add_ascii_assoc_zval(value,
exif_get_sectionname(section_index), tmpi);
}
}
}
@@ -2335,25 +2335,22 @@
#endif
/* }}} */
-/* {{{ proto string exif_tagname(index)
+/* {{{ proto string exif_tagname(long index) U
Get headername for index or false if not defined */
PHP_FUNCTION(exif_tagname)
{
- zval **p_num;
- int tag, ac = ZEND_NUM_ARGS();
+ long tag;
char *szTemp;
- if ((ac < 1 || ac > 1) || zend_get_parameters_ex(ac, &p_num) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
"l", &tag) == FAILURE) {
+ return;
}
- convert_to_long_ex(p_num);
- tag = Z_LVAL_PP(p_num);
szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC);
if (tag<0 || !szTemp || !szTemp[0]) {
RETURN_BOOL(FALSE);
} else {
- RETURN_STRING(szTemp, 1)
+ RETURN_ASCII_STRING(szTemp, 1)
}
}
/* }}} */
@@ -3893,22 +3890,24 @@
Reads header data from the JPEG/TIFF image filename and optionally reads
the internal thumbnails */
PHP_FUNCTION(exif_read_data)
{
- zval **p_name, **p_sections_needed, **p_sub_arrays, **p_read_thumbnail,
**p_read_all;
+ zval **p_name, **p_read_all;
int i, ac = ZEND_NUM_ARGS(), ret, sections_needed=0, sub_arrays=0,
read_thumbnail=0, read_all=0;
image_info_type ImageInfo;
- char tmp[64], *sections_str, *s;
+ char tmp[64], *sections_str=0, *s;
+ char *filename;
+ int filename_len, sections_str_len;
memset(&ImageInfo, 0, sizeof(ImageInfo));
- if ((ac < 1 || ac > 4) || zend_get_parameters_ex(ac, &p_name,
&p_sections_needed, &p_sub_arrays, &p_read_thumbnail, &p_read_all) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|sbb", &p_name,
§ions_str, §ions_str_len, &sub_arrays, &read_thumbnail) == FAILURE) {
+ return;
}
- convert_to_string_ex(p_name);
+ if (php_stream_path_param_encode(p_name, &filename, &filename_len,
REPORT_ERRORS, FG(default_context)) == FAILURE) {
+ return;
+ }
- if(ac >= 2) {
- convert_to_string_ex(p_sections_needed);
- spprintf(§ions_str, 0, ",%s,",
Z_STRVAL_PP(p_sections_needed));
+ if (sections_needed) {
/* sections_str DOES start with , and SPACES are NOT allowed in
names */
s = sections_str;
while(*++s) {
@@ -3933,14 +3932,7 @@
EFREE_IF(sections_str);
#endif
}
- if(ac >= 3) {
- convert_to_long_ex(p_sub_arrays);
- sub_arrays = Z_LVAL_PP(p_sub_arrays);
- }
- if(ac >= 4) {
- convert_to_long_ex(p_read_thumbnail);
- read_thumbnail = Z_LVAL_PP(p_read_thumbnail);
- }
+
if(ac >= 5) {
convert_to_long_ex(p_read_all);
read_all = Z_LVAL_PP(p_read_all);
@@ -3948,7 +3940,7 @@
/* parameters 3,4 will be working in later versions.... */
read_all = 0; /* just to make function work for 4.2 tree */
- ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), read_thumbnail,
read_all TSRMLS_CC);
+ ret = exif_read_file(&ImageInfo, filename, read_thumbnail, read_all
TSRMLS_CC);
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
@@ -4076,18 +4068,19 @@
exif_discard_imageinfo(&ImageInfo);
#ifdef EXIF_DEBUG
- php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE,
"done");
+ php_error_docref1(NULL TSRMLS_CC, filename, E_NOTICE, "done");
#endif
}
/* }}} */
-/* {{{ proto string exif_thumbnail(string filename [, &width, &height [,
&imagetype]])
+/* {{{ proto string exif_thumbnail(string filename [, &width, &height [,
&imagetype]]) U
Reads the embedded thumbnail */
PHP_FUNCTION(exif_thumbnail)
{
zval *p_width = 0, *p_height = 0, *p_imagetype = 0;
- char *p_name;
- int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
+ zval **p_name;
+ char *filename;
+ int filename_len, ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
memset(&ImageInfo, 0, sizeof(ImageInfo));
@@ -4096,11 +4089,15 @@
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name,
&p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) {
+ if (zend_parse_parameters(arg_c TSRMLS_CC, "Z|z/z/z/", &p_name,
&p_width, &p_height, &p_imagetype) == FAILURE) {
return;
}
- ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
+ if (php_stream_path_param_encode(p_name, &filename, &filename_len,
REPORT_ERRORS, FG(default_context)) == FAILURE) {
+ return;
+ }
+
+ ret = exif_read_file(&ImageInfo, filename, 1, 0 TSRMLS_CC);
if (ret==FALSE) {
exif_discard_imageinfo(&ImageInfo);
RETURN_FALSE;
@@ -4140,27 +4137,30 @@
exif_discard_imageinfo(&ImageInfo);
#ifdef EXIF_DEBUG
- php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "Done");
+ php_error_docref1(NULL TSRMLS_CC, filename, E_NOTICE, "Done");
#endif
}
/* }}} */
-/* {{{ proto int exif_imagetype(string imagefile)
+/* {{{ proto int exif_imagetype(string imagefile) U
Get the type of an image */
PHP_FUNCTION(exif_imagetype)
{
zval **arg1;
+ char *filename;
+ int filename_len;
php_stream * stream;
int itype = 0;
- if (ZEND_NUM_ARGS() != 1)
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &arg1) ==
FAILURE) {
+ return;
+ }
- if (zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
+ if (php_stream_path_param_encode(arg1, &filename, &filename_len,
REPORT_ERRORS, FG(default_context)) == FAILURE) {
+ return;
+ }
- convert_to_string_ex(arg1);
- stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb",
IGNORE_PATH|REPORT_ERRORS, NULL);
+ stream = php_stream_open_wrapper(filename, "rb",
IGNORE_PATH|REPORT_ERRORS, NULL);
if (stream == NULL) {
RETURN_FALSE;
Index: 008.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/008.phpt,v
retrieving revision 1.2
diff -u -r1.2 008.phpt
--- 008.phpt 27 May 2008 18:16:00 -0000 1.2
+++ 008.phpt 6 Jun 2008 22:24:12 -0000
@@ -34,9 +34,9 @@
[u"yday"]=>
int(177)
[u"weekday"]=>
- string(7) "Tuesday"
+ unicode(7) "Tuesday"
[u"month"]=>
- string(4) "June"
+ unicode(4) "June"
[0]=>
int(1151366400)
}
@@ -58,9 +58,9 @@
[u"yday"]=>
int(%d)
[u"weekday"]=>
- string(%d) "%s"
+ unicode(%d) "%s"
[u"month"]=>
- string(%d) "%s"
+ unicode(%d) "%s"
[0]=>
int(%d)
}
Index: 011.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/011.phpt,v
retrieving revision 1.1
diff -u -r1.1 011.phpt
--- 011.phpt 22 Dec 2006 13:07:26 -0000 1.1
+++ 011.phpt 6 Jun 2008 22:24:12 -0000
@@ -16,8 +16,8 @@
--EXPECTF--
Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s
on line 3
bool(false)
-string(13) "Europe/Berlin"
+unicode(13) "Europe/Berlin"
bool(false)
bool(false)
-string(12) "Europe/Paris"
+unicode(12) "Europe/Paris"
Done
Index: 013.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/013.phpt,v
retrieving revision 1.3
diff -u -r1.3 013.phpt
--- 013.phpt 27 May 2008 18:16:00 -0000 1.3
+++ 013.phpt 6 Jun 2008 22:24:12 -0000
@@ -26,7 +26,7 @@
[u"timezone_type"]=>
int(3)
[u"timezone"]=>
- string(3) "UTC"
+ unicode(3) "UTC"
}
unicode(19) "2006.12.12 00:00:00"
Index: 014.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/014.phpt,v
retrieving revision 1.3
diff -u -r1.3 014.phpt
--- 014.phpt 27 May 2008 18:16:00 -0000 1.3
+++ 014.phpt 6 Jun 2008 22:24:12 -0000
@@ -25,7 +25,7 @@
[u"timezone_type"]=>
int(3)
[u"timezone"]=>
- string(3) "UTC"
+ unicode(3) "UTC"
}
object(DateTimeZone)#%d (0) {
}
Index: bug41523-64bit.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug41523-64bit.phpt,v
retrieving revision 1.3
diff -u -r1.3 bug41523-64bit.phpt
--- bug41523-64bit.phpt 27 May 2008 18:16:00 -0000 1.3
+++ bug41523-64bit.phpt 6 Jun 2008 22:24:12 -0000
@@ -48,6 +48,6 @@
[u"timezone_type"]=>
int(3)
[u"timezone"]=>
- string(3) "UTC"
+ unicode(3) "UTC"
}
-0001-11-30T00:00:00+0000
Index: bug41523.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug41523.phpt,v
retrieving revision 1.5
diff -u -r1.5 bug41523.phpt
--- bug41523.phpt 27 May 2008 18:16:00 -0000 1.5
+++ bug41523.phpt 6 Jun 2008 22:24:12 -0000
@@ -48,6 +48,6 @@
[u"timezone_type"]=>
int(3)
[u"timezone"]=>
- string(3) "UTC"
+ unicode(3) "UTC"
}
-0001-11-30T00:00:00+0000
Index: bug43808.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug43808.phpt,v
retrieving revision 1.2
diff -u -r1.2 bug43808.phpt
--- bug43808.phpt 27 May 2008 18:16:00 -0000 1.2
+++ bug43808.phpt 6 Jun 2008 22:24:12 -0000
@@ -20,14 +20,14 @@
[u"warnings"]=>
array(1) {
[6]=>
- string(29) "Double timezone specification"
+ unicode(29) "Double timezone specification"
}
[u"error_count"]=>
int(1)
[u"errors"]=>
array(1) {
[0]=>
- string(47) "The timezone could not be found in the database"
+ unicode(47) "The timezone could not be found in the database"
}
}
array(4) {
@@ -36,13 +36,13 @@
[u"warnings"]=>
array(1) {
[6]=>
- string(29) "Double timezone specification"
+ unicode(29) "Double timezone specification"
}
[u"error_count"]=>
int(1)
[u"errors"]=>
array(1) {
[0]=>
- string(47) "The timezone could not be found in the database"
+ unicode(47) "The timezone could not be found in the database"
}
}
Index: date_parse_001.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/date_parse_001.phpt,v
retrieving revision 1.3
diff -u -r1.3 date_parse_001.phpt
--- date_parse_001.phpt 27 May 2008 18:16:00 -0000 1.3
+++ date_parse_001.phpt 6 Jun 2008 22:24:12 -0000
@@ -98,7 +98,7 @@
[u"errors"]=>
array(1) {
[7]=>
- string(20) "Unexpected character"
+ unicode(20) "Unexpected character"
}
[u"is_localtime"]=>
bool(true)
@@ -218,9 +218,9 @@
[u"errors"]=>
array(2) {
[0]=>
- string(20) "Unexpected character"
+ unicode(20) "Unexpected character"
[1]=>
- string(20) "Unexpected character"
+ unicode(20) "Unexpected character"
}
[u"is_localtime"]=>
bool(true)
@@ -256,7 +256,7 @@
[u"errors"]=>
array(1) {
[0]=>
- string(20) "Unexpected character"
+ unicode(20) "Unexpected character"
}
[u"is_localtime"]=>
bool(true)
@@ -292,7 +292,7 @@
[u"errors"]=>
array(1) {
[0]=>
- string(12) "Empty string"
+ unicode(12) "Empty string"
}
[u"is_localtime"]=>
bool(false)
Index: bug34704.phpt
===================================================================
RCS file: /repository/php-src/ext/exif/tests/bug34704.phpt,v
retrieving revision 1.5
diff -u -r1.5 bug34704.phpt
--- bug34704.phpt 2 Jun 2006 22:22:42 -0000 1.5
+++ bug34704.phpt 7 Jun 2008 02:31:14 -0000
@@ -13,51 +13,22 @@
===DONE===
--EXPECTF--
array(7) {
- ["FileName"]=>
- string(12) "bug34704.jpg"
- ["FileDateTime"]=>
- int(%d)
- ["FileSize"]=>
- int(9976)
- ["FileType"]=>
- int(2)
- ["MimeType"]=>
- string(10) "image/jpeg"
- ["SectionsFound"]=>
- string(4) "IFD0"
- ["COMPUTED"]=>
- array(5) {
- ["html"]=>
- string(24) "width="386" height="488""
- ["Height"]=>
- int(488)
- ["Width"]=>
- int(386)
- ["IsColor"]=>
- int(1)
- ["ByteOrderMotorola"]=>
- int(0)
- }
-}
-===DONE===
---UEXPECTF--
-array(7) {
[u"FileName"]=>
- string(12) "bug34704.jpg"
+ unicode(12) "bug34704.jpg"
[u"FileDateTime"]=>
- int(1128867104)
+ int(%d)
[u"FileSize"]=>
int(9976)
[u"FileType"]=>
int(2)
[u"MimeType"]=>
- string(10) "image/jpeg"
+ unicode(10) "image/jpeg"
[u"SectionsFound"]=>
- string(4) "IFD0"
+ unicode(4) "IFD0"
[u"COMPUTED"]=>
array(5) {
[u"html"]=>
- string(24) "width="386" height="488""
+ unicode(24) "width="386" height="488""
[u"Height"]=>
int(488)
[u"Width"]=>
Index: exif001.phpt
===================================================================
RCS file: /repository/php-src/ext/exif/tests/exif001.phpt,v
retrieving revision 1.6
diff -u -r1.6 exif001.phpt
--- exif001.phpt 27 May 2008 18:16:00 -0000 1.6
+++ exif001.phpt 7 Jun 2008 02:31:14 -0000
@@ -19,7 +19,7 @@
[u"FILE"]=>
array(6) {
[u"FileName"]=>
- string(9) "test2.jpg"
+ unicode(9) "test2.jpg"
[u"FileDateTime"]=>
int(%d)
[u"FileSize"]=>
@@ -27,14 +27,14 @@
[u"FileType"]=>
int(2)
[u"MimeType"]=>
- string(10) "image/jpeg"
+ unicode(10) "image/jpeg"
[u"SectionsFound"]=>
- string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
+ unicode(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
}
[u"COMPUTED"]=>
array(12) {
[u"html"]=>
- string(20) "width="1" height="1""
+ unicode(20) "width="1" height="1""
[u"Height"]=>
int(1)
[u"Width"]=>
@@ -44,26 +44,26 @@
[u"ByteOrderMotorola"]=>
int(1)
[u"UserComment"]=>
- string(16) "Exif test image."
+ unicode(16) "Exif test image."
[u"UserCommentEncoding"]=>
- string(5) "ASCII"
+ unicode(5) "ASCII"
[u"Copyright"]=>
- string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
+ unicode(41) "Photo (c) M.Boerger, Edited by M.Boerger."
[u"Copyright.Photographer"]=>
- string(19) "Photo (c) M.Boerger"
+ unicode(19) "Photo (c) M.Boerger"
[u"Copyright.Editor"]=>
- string(20) "Edited by M.Boerger."
+ unicode(20) "Edited by M.Boerger."
[u"Thumbnail.FileType"]=>
int(2)
[u"Thumbnail.MimeType"]=>
- string(10) "image/jpeg"
+ unicode(10) "image/jpeg"
}
[u"IFD0"]=>
array(2) {
[u"Copyright"]=>
- string(19) "Photo (c) M.Boerger"
+ unicode(19) "Photo (c) M.Boerger"
[u"UserComment"]=>
- string(5) "ASCII"
+ unicode(5) "ASCII"
}
[u"THUMBNAIL"]=>
array(2) {
@@ -75,10 +75,10 @@
[u"COMMENT"]=>
array(3) {
[0]=>
- string(11) "Comment #1."
+ unicode(11) "Comment #1."
[1]=>
- string(11) "Comment #2."
+ unicode(11) "Comment #2."
[2]=>
- string(13) "Comment #3end"
+ unicode(13) "Comment #3end"
}
}
Index: exif004.phpt
===================================================================
RCS file: /repository/php-src/ext/exif/tests/exif004.phpt,v
retrieving revision 1.5
diff -u -r1.5 exif004.phpt
--- exif004.phpt 4 Jan 2003 19:19:59 -0000 1.5
+++ exif004.phpt 7 Jun 2008 02:31:14 -0000
@@ -22,17 +22,17 @@
?>
--EXPECT--
array(5) {
- ["Subject"]=>
- string(10) "Subject..."
- ["Keywords"]=>
- string(11) "Keywords..."
- ["Author"]=>
- string(9) "Rui Carmo"
- ["Comments"]=>
- string(29) "Comments
+ [u"Subject"]=>
+ unicode(10) "Subject..."
+ [u"Keywords"]=>
+ unicode(11) "Keywords..."
+ [u"Author"]=>
+ unicode(9) "Rui Carmo"
+ [u"Comments"]=>
+ unicode(29) "Comments
Line2
Line3
Line4"
- ["Title"]=>
- string(8) "Title..."
+ [u"Title"]=>
+ unicode(8) "Title..."
}
Index: exif005.phpt
===================================================================
RCS file: /repository/php-src/ext/exif/tests/exif005.phpt,v
retrieving revision 1.8
diff -u -r1.8 exif005.phpt
--- exif005.phpt 27 May 2008 18:16:00 -0000 1.8
+++ exif005.phpt 7 Jun 2008 02:31:14 -0000
@@ -16,7 +16,7 @@
--EXPECT--
array(2) {
[u"ImageDescription"]=>
- string(11) "Ifd00000009"
+ unicode(11) "Ifd00000009"
[u"DateTime"]=>
- string(19) "2002:10:18 20:06:00"
+ unicode(19) "2002:10:18 20:06:00"
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php