summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-09-27 11:27:58 +0200
committerOndřej Surý <ondrej@sury.org>2013-09-27 11:27:58 +0200
commit1fd24dd3e14010b82febd3e300599f8d8f9c592c (patch)
tree60d089e947831184a569c1db6c23e45e18d46723 /ext
parent9989e8bb3d7b37e3b3b351feece5ed4346174ccf (diff)
downloadphp-1fd24dd3e14010b82febd3e300599f8d8f9c592c.tar.gz
New upstream version 5.5.4+dfsgupstream/5.5.4+dfsg
Diffstat (limited to 'ext')
-rw-r--r--ext/bz2/bz2_filter.c2
-rw-r--r--ext/curl/interface.c16
-rw-r--r--ext/curl/php_curl.h2
-rw-r--r--ext/curl/tests/bug65458.phpt25
-rw-r--r--ext/date/lib/parse_date.c7
-rw-r--r--ext/date/lib/parse_date.re5
-rw-r--r--ext/date/php_date.c52
-rw-r--r--ext/date/tests/DateInterval_days_prop1.phpt10
-rw-r--r--ext/date/tests/DateTime_fix_createFromFormat.phpt29
-rw-r--r--ext/date/tests/bug64157.phpt14
-rw-r--r--ext/date/tests/bug65184.phpt2
-rw-r--r--ext/date/tests/bug65502.phpt12
-rw-r--r--ext/date/tests/bug65548.phpt34
-rw-r--r--ext/dom/php_dom.c4
-rw-r--r--ext/filter/logical_filters.c5
-rw-r--r--ext/filter/tests/018.phpt4
-rw-r--r--ext/filter/tests/bug64441.phpt11
-rw-r--r--ext/ftp/ftp.c5
-rw-r--r--ext/gd/libgd/gd_interpolation.c5
-rw-r--r--ext/imap/config.m44
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.cpp2
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.h2
-rw-r--r--ext/intl/calendar/calendar_methods.cpp1
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp3
-rw-r--r--ext/intl/intl_cppshims.h2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp4
-rw-r--r--ext/intl/resourcebundle/resourcebundle.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c2
-rw-r--r--ext/mysql/tests/bug55473.phpt8
-rw-r--r--ext/odbc/config.m439
-rw-r--r--ext/opcache/Optimizer/block_pass.c13
-rw-r--r--ext/opcache/Optimizer/pass1_5.c32
-rw-r--r--ext/opcache/Optimizer/zend_optimizer_internal.h3
-rw-r--r--ext/opcache/ZendAccelerator.c4
-rw-r--r--ext/opcache/tests/bug65510.phpt20
-rw-r--r--ext/opcache/tests/bug65665.phpt118
-rw-r--r--ext/opcache/tests/issue0128.phpt16
-rw-r--r--ext/openssl/openssl.c52
-rw-r--r--ext/openssl/tests/bug64802.pem37
-rw-r--r--ext/openssl/tests/bug64802.phpt56
-rw-r--r--ext/pdo/pdo_dbh.c2
-rw-r--r--ext/pdo/pdo_sql_parser.c47
-rw-r--r--ext/pdo/pdo_sql_parser.re4
-rw-r--r--ext/pdo/pdo_stmt.c4
-rw-r--r--ext/pdo/php_pdo_driver.h8
-rw-r--r--ext/pdo_mysql/tests/bug_39858.phpt2
-rw-r--r--ext/pdo_mysql/tests/bug_41997.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct.phpt11
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt4
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt4
-rw-r--r--ext/pdo_oci/oci_driver.c2
-rw-r--r--ext/pdo_oci/oci_statement.c6
-rw-r--r--ext/pdo_odbc/odbc_driver.c2
-rw-r--r--ext/pdo_odbc/odbc_stmt.c8
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c8
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
-rw-r--r--ext/pdo_pgsql/tests/bug64953.phpt71
-rw-r--r--ext/pgsql/pgsql.c46
-rw-r--r--ext/pgsql/tests/09notice.phpt5
-rw-r--r--ext/pgsql/tests/80_bug32223.phpt6
-rw-r--r--ext/pgsql/tests/80_bug32223b.phpt6
-rw-r--r--ext/session/mod_files.c4
-rw-r--r--ext/session/mod_mm.c4
-rw-r--r--ext/session/mod_user.c2
-rw-r--r--ext/session/session.c43
-rw-r--r--ext/session/tests/bug65475.phpt34
-rw-r--r--ext/session/tests/rfc1867.phpt1
-rw-r--r--ext/session/tests/rfc1867_cleanup.phpt1
-rw-r--r--ext/session/tests/rfc1867_disabled.phpt1
-rw-r--r--ext/session/tests/rfc1867_disabled_2.phpt1
-rw-r--r--ext/session/tests/rfc1867_inter.phpt1
-rw-r--r--ext/session/tests/rfc1867_no_name.phpt1
-rw-r--r--ext/session/tests/rfc1867_sid_cookie.phpt1
-rw-r--r--ext/session/tests/rfc1867_sid_get.phpt1
-rw-r--r--ext/session/tests/rfc1867_sid_get_2.phpt1
-rw-r--r--ext/session/tests/rfc1867_sid_only_cookie.phpt1
-rw-r--r--ext/session/tests/rfc1867_sid_post.phpt1
-rw-r--r--ext/session/tests/session_decode_basic_serialize.phpt274
-rw-r--r--ext/session/tests/session_encode_serialize.phpt24
-rw-r--r--ext/session/tests/session_id_basic.phpt2
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/tests/bug64782.phpt21
-rw-r--r--ext/standard/basic_functions.c4
-rw-r--r--ext/standard/config.m421
-rw-r--r--ext/standard/file.c34
-rw-r--r--ext/standard/filters.c4
-rw-r--r--ext/standard/info.c2
-rw-r--r--ext/standard/math.c2
-rw-r--r--ext/standard/password.c12
-rw-r--r--ext/standard/php_var.h1
-rw-r--r--ext/standard/tests/file/fputcsv_error.phpt2
-rwxr-xr-xext/standard/tests/file/fputcsv_variation15.phpt107
-rw-r--r--ext/standard/tests/file/glob_variation3.phpt19
-rw-r--r--ext/standard/tests/serialize/bug65481.phpt40
-rw-r--r--ext/standard/tests/streams/bug65483.phpt19
-rw-r--r--ext/standard/var_unserializer.c53
-rw-r--r--ext/standard/var_unserializer.re53
-rw-r--r--ext/xml/compat.c216
-rw-r--r--ext/xml/expat_compat.h5
-rw-r--r--ext/xml/xml.c8
-rw-r--r--ext/xmlrpc/tests/003.phpt109
-rw-r--r--ext/xmlrpc/tests/004.phpt19
-rw-r--r--ext/xmlrpc/tests/005.phpt47
-rw-r--r--ext/xmlrpc/tests/006.phpt29
-rw-r--r--ext/xmlrpc/tests/007.phpt29
110 files changed, 1811 insertions, 371 deletions
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index 5ed7921c1..335600232 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -215,7 +215,6 @@ static php_stream_filter_status_t php_bz2_compress_filter(
size_t consumed = 0;
int status;
php_stream_filter_status_t exit_status = PSFS_FEED_ME;
- bz_stream *streamp;
if (!thisfilter || !thisfilter->abstract) {
/* Should never happen */
@@ -223,7 +222,6 @@ static php_stream_filter_status_t php_bz2_compress_filter(
}
data = (php_bz2_filter_data *)(thisfilter->abstract);
- streamp = &(data->strm);
while (buckets_in->head) {
size_t bin = 0, desired;
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 4b6e5e27d..9fdb57cc4 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1717,9 +1717,9 @@ static void curl_free_post(void **post)
/* {{{ curl_free_slist
*/
-static void curl_free_slist(void **slist)
+static void curl_free_slist(void *slist)
{
- curl_slist_free_all((struct curl_slist *) *slist);
+ curl_slist_free_all(*((struct curl_slist **) slist));
}
/* }}} */
@@ -1790,9 +1790,11 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->read->stream = NULL;
zend_llist_init(&(*ch)->to_free->str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free->slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
zend_llist_init(&(*ch)->to_free->post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
(*ch)->safe_upload = 0; /* for now, for BC reason we allow unsafe API */
+
+ (*ch)->to_free->slist = emalloc(sizeof(HashTable));
+ zend_hash_init((*ch)->to_free->slist, 4, NULL, curl_free_slist, 0);
}
/* }}} */
@@ -2043,6 +2045,7 @@ PHP_FUNCTION(curl_copy_handle)
}
#endif
+ efree(dupch->to_free->slist);
efree(dupch->to_free);
dupch->to_free = ch->to_free;
@@ -2438,7 +2441,7 @@ string_copy:
ph = HASH_OF(*zvalue);
if (!ph) {
- char *name;
+ char *name = NULL;
switch (option) {
case CURLOPT_HTTPHEADER:
name = "CURLOPT_HTTPHEADER";
@@ -2488,7 +2491,7 @@ string_copy:
return 1;
}
}
- zend_llist_add_element(&ch->to_free->slist, &slist);
+ zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
error = curl_easy_setopt(ch->cp, option, slist);
@@ -3266,8 +3269,9 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
/* cURL destructors should be invoked only by last curl handle */
if (Z_REFCOUNT_P(ch->clone) <= 1) {
zend_llist_clean(&ch->to_free->str);
- zend_llist_clean(&ch->to_free->slist);
zend_llist_clean(&ch->to_free->post);
+ zend_hash_destroy(ch->to_free->slist);
+ efree(ch->to_free->slist);
efree(ch->to_free);
FREE_ZVAL(ch->clone);
} else {
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 9e98fe57c..c45ed80fc 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -168,7 +168,7 @@ struct _php_curl_send_headers {
struct _php_curl_free {
zend_llist str;
zend_llist post;
- zend_llist slist;
+ HashTable *slist;
};
typedef struct {
diff --git a/ext/curl/tests/bug65458.phpt b/ext/curl/tests/bug65458.phpt
new file mode 100644
index 000000000..99288f24b
--- /dev/null
+++ b/ext/curl/tests/bug65458.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #65458 (curl memory leak)
+--SKIPIF--
+<?php
+if (!extension_loaded('curl')) exit("skip curl extension not loaded");
+?>
+--FILE--
+<?php
+$ch = curl_init();
+$init = memory_get_usage();
+for ($i = 0; $i < 10000; $i++) {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
+}
+
+$preclose = memory_get_usage();
+curl_close($ch);
+
+// This is a slightly tricky heuristic, but basically, we want to ensure
+// $preclose - $init has a delta in the order of bytes, not megabytes. Given
+// the number of iterations in the loop, if we're wasting memory here, we
+// should have megs and megs of extra allocations.
+var_dump(($preclose - $init) < 10000);
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index d3f13f864..21a2db3a4 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Fri Apr 26 11:10:28 2013 */
+/* Generated by re2c 0.13.5 on Sun Aug 25 15:12:48 2013 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -615,7 +615,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
- while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
+ while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
+ **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
++*ptr;
}
end = *ptr;
@@ -24903,7 +24904,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
- add_pbf_error(s, "A two second minute could not be found", string, begin);
+ add_pbf_error(s, "A two digit second could not be found", string, begin);
} else {
s->time->s = sec;
}
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 014f6a09e..6d91d9ada 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -614,7 +614,8 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
- while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t') {
+ while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != ':' &&
+ **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
++*ptr;
}
end = *ptr;
@@ -2008,7 +2009,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
TIMELIB_CHECK_NUMBER;
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
if (sec == TIMELIB_UNSET || length != 2) {
- add_pbf_error(s, "A two second minute could not be found", string, begin);
+ add_pbf_error(s, "A two digit second could not be found", string, begin);
} else {
s->time->s = sec;
}
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index f0c9525e5..7d3d1d739 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -480,7 +480,7 @@ const zend_function_entry date_funcs_immutable[] = {
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
@@ -2142,27 +2142,21 @@ static zval* date_clone_immutable(zval *object TSRMLS_DC)
static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
{
- if (Z_TYPE_P(d1) == IS_OBJECT && Z_TYPE_P(d2) == IS_OBJECT &&
- instanceof_function(Z_OBJCE_P(d1), date_ce_date TSRMLS_CC) &&
- instanceof_function(Z_OBJCE_P(d2), date_ce_date TSRMLS_CC)) {
- php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
- php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
+ php_date_obj *o1 = zend_object_store_get_object(d1 TSRMLS_CC);
+ php_date_obj *o2 = zend_object_store_get_object(d2 TSRMLS_CC);
- if (!o1->time || !o2->time) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime object");
- return 1;
- }
- if (!o1->time->sse_uptodate) {
- timelib_update_ts(o1->time, o1->time->tz_info);
- }
- if (!o2->time->sse_uptodate) {
- timelib_update_ts(o2->time, o2->time->tz_info);
- }
-
- return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
+ if (!o1->time || !o2->time) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
+ return 1;
+ }
+ if (!o1->time->sse_uptodate) {
+ timelib_update_ts(o1->time, o1->time->tz_info);
+ }
+ if (!o2->time->sse_uptodate) {
+ timelib_update_ts(o2->time, o2->time->tz_info);
}
- return 1;
+ return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
}
static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
@@ -2198,13 +2192,13 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
/* first we add the date and time in ISO format */
MAKE_STD_ZVAL(zv);
ZVAL_STRING(zv, date_format("Y-m-d H:i:s", 12, dateobj->time, 1), 0);
- zend_hash_update(props, "date", 5, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "date", 5, &zv, sizeof(zv), NULL);
/* then we add the timezone name (or similar) */
if (dateobj->time->is_localtime) {
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, dateobj->time->zone_type);
- zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
MAKE_STD_ZVAL(zv);
switch (dateobj->time->zone_type) {
@@ -2227,7 +2221,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
ZVAL_STRING(zv, dateobj->time->tz_abbr, 1);
break;
}
- zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
}
return props;
@@ -2305,7 +2299,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, tzobj->type);
- zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
MAKE_STD_ZVAL(zv);
switch (tzobj->type) {
@@ -2327,7 +2321,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1);
break;
}
- zend_hash_update(props, "timezone", 9, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
return props;
}
@@ -2394,7 +2388,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
#define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \
MAKE_STD_ZVAL(zv); \
ZVAL_LONG(zv, (long)intervalobj->diff->f); \
- zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, n, strlen(n) + 1, &zv, sizeof(zv), NULL);
PHP_DATE_INTERVAL_ADD_PROPERTY("y", y);
PHP_DATE_INTERVAL_ADD_PROPERTY("m", m);
@@ -2411,7 +2405,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC)
} else {
MAKE_STD_ZVAL(zv);
ZVAL_FALSE(zv);
- zend_hash_update(props, "days", 5, &zv, sizeof(zval), NULL);
+ zend_hash_update(props, "days", 5, &zv, sizeof(zv), NULL);
}
PHP_DATE_INTERVAL_ADD_PROPERTY("special_type", special.type);
PHP_DATE_INTERVAL_ADD_PROPERTY("special_amount", special.amount);
@@ -4064,7 +4058,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze
ALLOC_INIT_ZVAL(retval);
Z_SET_REFCOUNT_P(retval, 0);
- ZVAL_LONG(retval, value);
+ if (value != -99999) {
+ ZVAL_LONG(retval, value);
+ } else {
+ ZVAL_FALSE(retval);
+ }
if (member == &tmp_member) {
zval_dtor(member);
diff --git a/ext/date/tests/DateInterval_days_prop1.phpt b/ext/date/tests/DateInterval_days_prop1.phpt
new file mode 100644
index 000000000..627b8f0b2
--- /dev/null
+++ b/ext/date/tests/DateInterval_days_prop1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Wrong var_dump(DateInterval->days) value
+--FILE--
+<?php
+
+$interval = new DateInterval('P2Y4DT6H8M');
+
+var_dump($interval->days);
+--EXPECT--
+bool(false)
diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt
new file mode 100644
index 000000000..abde29277
--- /dev/null
+++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test fix for DateTime when date have textual day with dot or other special char at end
+--FILE--
+<?php
+
+//Set the default time zone
+date_default_timezone_set('Europe/London');
+
+echo "*** Testing clone on DateTime objects ***\n";
+
+// Create a DateTime object..
+$orig = new DateTime('2012-11-29 17:00:00');
+
+// String to parse
+$string = "Thu., Nov. 29, 2012 5:00PM";
+
+// Create a DateTime object from format
+$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
+
+echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
+echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing clone on DateTime objects ***
+Format method: Thu., Nov. 29, 2012 5:00PM
+createFromFormat method: Thu., Nov. 29, 2012 5:00PM
+===DONE===
diff --git a/ext/date/tests/bug64157.phpt b/ext/date/tests/bug64157.phpt
new file mode 100644
index 000000000..fb7149543
--- /dev/null
+++ b/ext/date/tests/bug64157.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test for bug #64157: DateTime::createFromFormat() reports confusing error message
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+DateTime::createFromFormat('s', '0');
+$lastErrors = DateTime::getLastErrors();
+print_r($lastErrors['errors'][0]);
+?>
+--EXPECT--
+A two digit second could not be found
diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt
index adfd8d812..9bb68558a 100644
--- a/ext/date/tests/bug65184.phpt
+++ b/ext/date/tests/bug65184.phpt
@@ -6,6 +6,8 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
die("skip Test is valid for Windows");
}
?>
+--INI--
+date.timezone = UTC
--FILE--
<?php
setlocale(LC_ALL, 'Japanese_Japan.932');
diff --git a/ext/date/tests/bug65502.phpt b/ext/date/tests/bug65502.phpt
new file mode 100644
index 000000000..8819c1ff7
--- /dev/null
+++ b/ext/date/tests/bug65502.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test for bug #65502: DateTimeImmutable::createFromFormat returns DateTime
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+echo get_class(DateTimeImmutable::createFromFormat('j-M-Y', '12-Sep-2013'));
+?>
+--EXPECT--
+DateTimeImmutable
diff --git a/ext/date/tests/bug65548.phpt b/ext/date/tests/bug65548.phpt
new file mode 100644
index 000000000..53f2519f6
--- /dev/null
+++ b/ext/date/tests/bug65548.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test for bug #65548: Comparison for DateTimeImmutable doesn't work
+--CREDITS--
+Boro Sitnikovski <buritomath@yahoo.com>
+--INI--
+date.timezone = UTC
+--FILE--
+<?php
+$iToday = new DateTimeImmutable('today');
+$iTomorrow = new DateTimeImmutable('tomorrow');
+
+$mToday = new DateTime('today');
+$mTomorrow = new DateTime('tomorrow');
+
+var_dump($iToday < $iTomorrow);
+var_dump($iToday == $iTomorrow);
+var_dump($iToday > $iTomorrow);
+
+var_dump($iToday == $mToday);
+var_dump($iToday === $mToday);
+
+var_dump($iToday < $mTomorrow);
+var_dump($iToday == $mTomorrow);
+var_dump($iToday > $mTomorrow);
+?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 1e98567dc..db8ec83a4 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1089,7 +1089,11 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
void dom_objects_free_storage(void *object TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
+#if defined(__GNUC__) && __GNUC__ >= 3
+ int retcount __attribute__((unused)); /* keep compiler quiet */
+#else
int retcount;
+#endif
zend_object_std_dtor(&intern->std TSRMLS_CC);
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index b8df2183b..653cce23e 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -484,10 +484,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
}
s++;
}
-
- if (*(e - 1) == '.') {
- goto bad_url;
- }
}
if (
@@ -718,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
+ (ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
(ip[0] == 128 && ip[1] == 0) ||
(ip[0] == 191 && ip[1] == 255) ||
(ip[0] == 169 && ip[1] == 254) ||
diff --git a/ext/filter/tests/018.phpt b/ext/filter/tests/018.phpt
index af52b2e60..9c73fc3cf 100644
--- a/ext/filter/tests/018.phpt
+++ b/ext/filter/tests/018.phpt
@@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
@@ -40,6 +42,8 @@ bool(false)
string(12) "192.0.34.166"
bool(false)
string(9) "192.0.0.1"
+bool(false)
+bool(false)
string(12) "192.0.34.166"
bool(false)
string(15) "255.255.255.255"
diff --git a/ext/filter/tests/bug64441.phpt b/ext/filter/tests/bug64441.phpt
new file mode 100644
index 000000000..149079ec0
--- /dev/null
+++ b/ext/filter/tests/bug64441.phpt
@@ -0,0 +1,11 @@
+--TEST--
+bug 64441, FILTER_VALIDATE_URL will invalidate a hostname that ended by dot
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+var_dump(filter_var('http://example.com./', FILTER_VALIDATE_URL));
+var_dump(filter_var('http://example.com/', FILTER_VALIDATE_URL));
+--EXPECT--
+string(20) "http://example.com./"
+string(19) "http://example.com/"
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 0d6704f9d..2c5bc5d7e 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -790,7 +790,6 @@ int
ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC)
{
databuf_t *data = NULL;
- int lastch;
size_t rcvd;
char arg[11];
@@ -828,7 +827,6 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
goto bail;
}
- lastch = 0;
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
if (rcvd == -1) {
goto bail;
@@ -1187,12 +1185,9 @@ ftp_readline(ftpbuf_t *ftp)
int
ftp_getresp(ftpbuf_t *ftp)
{
- char *buf;
-
if (ftp == NULL) {
return 0;
}
- buf = ftp->inbuf;
ftp->resp = 0;
while (1) {
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index e3247a78c..3643535f2 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1065,6 +1065,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
if (tmp_im == NULL) {
return NULL;
}
+ gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
dst = gdImageCreateTrueColor(new_width, new_height);
@@ -1072,6 +1073,7 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
gdFree(tmp_im);
return NULL;
}
+ gdImageSetInterpolationMethod(dst, src->interpolation_id);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
gdFree(tmp_im);
@@ -1086,8 +1088,9 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
if (tmp_im == NULL) {
return NULL;
}
- _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
+ gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
+ _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
gdFree(tmp_im);
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4
index 3efc24590..d7deae102 100644
--- a/ext/imap/config.m4
+++ b/ext/imap/config.m4
@@ -198,9 +198,9 @@ if test "$PHP_IMAP" != "no"; then
AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.)
fi
- if test -r "$IMAP_DIR/c-client/c-client.a"; then
+ if test ! -r "$IMAP_DIR/c-client/libc-client.a" && -r "$IMAP_DIR/c-client/c-client.a" ; then
ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
- elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
+ elif test ! -r "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" && -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then
ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1
fi
diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h
index 716207241..a955f3a8e 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.h
+++ b/ext/intl/breakiterator/breakiterator_iterators.h
@@ -39,4 +39,4 @@ U_CFUNC zend_object_iterator *_breakiterator_get_iterator(
zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D);
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h
index a479ac92e..bc9ce8010 100644
--- a/ext/intl/breakiterator/breakiterator_methods.h
+++ b/ext/intl/breakiterator/breakiterator_methods.h
@@ -61,4 +61,4 @@ PHP_FUNCTION(breakiter_get_error_code);
PHP_FUNCTION(breakiter_get_error_message);
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h
index 988b91c20..933347b85 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.h
+++ b/ext/intl/breakiterator/codepointiterator_internal.h
@@ -95,4 +95,4 @@ namespace PHP {
};
}
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp
index ae7e526ea..a833cf185 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.cpp
+++ b/ext/intl/breakiterator/codepointiterator_methods.cpp
@@ -41,4 +41,4 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
BREAKITER_METHOD_FETCH_OBJECT;
RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint());
-} \ No newline at end of file
+}
diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h
index d34e5b61e..ad3b710fc 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.h
+++ b/ext/intl/breakiterator/codepointiterator_methods.h
@@ -21,4 +21,4 @@
PHP_FUNCTION(cpbi_get_last_code_point);
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
index edea4ea2a..861ca4253 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
@@ -29,4 +29,4 @@ PHP_FUNCTION(rbbi_get_rule_status_vec);
PHP_FUNCTION(rbbi_get_binary_rules);
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index db10502a1..ae7d0093f 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -184,7 +184,6 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
U_CFUNC PHP_FUNCTION(intlcal_get_now)
{
- UErrorCode status = U_ZERO_ERROR;
intl_error_reset(NULL TSRMLS_CC);
if (zend_parse_parameters_none() == FAILURE) {
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index 3c05253de..08b894964 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -38,7 +38,6 @@ static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
{
- zval *object = getThis();
zval **tz_object = NULL;
zval **args_a[6] = {0},
***args = &args_a[0];
@@ -84,7 +83,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
}
// instantion of ICU object
- GregorianCalendar *gcal;
+ GregorianCalendar *gcal = NULL;
if (variant <= 2) {
// From timezone and locale (0 to 2 arguments)
diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h
index 2fb70edfd..e58ec3bd4 100644
--- a/ext/intl/intl_cppshims.h
+++ b/ext/intl/intl_cppshims.h
@@ -31,4 +31,4 @@
#define _MSC_STDINT_H_ 1
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 9ee1cdcfb..c4456d54f 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -487,7 +487,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
}
case Formattable::kLong:
{
- int32_t tInt32;
+ int32_t tInt32 = 0;
retry_klong:
if (Z_TYPE_PP(elem) == IS_DOUBLE) {
if (Z_DVAL_PP(elem) > (double)INT32_MAX ||
@@ -517,7 +517,7 @@ retry_klong:
}
case Formattable::kInt64:
{
- int64_t tInt64;
+ int64_t tInt64 = 0;
retry_kint64:
if (Z_TYPE_PP(elem) == IS_DOUBLE) {
if (Z_DVAL_PP(elem) > (double)U_INT64_MAX ||
diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c
index 6d39dfb7e..f5475faf1 100644
--- a/ext/intl/resourcebundle/resourcebundle.c
+++ b/ext/intl/resourcebundle/resourcebundle.c
@@ -41,7 +41,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so
case URES_STRING:
ufield = ures_getString( source->child, &ilen, &INTL_DATA_ERROR_CODE(source) );
INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve string value");
- INTL_METHOD_RETVAL_UTF8(source, ufield, ilen, 0);
+ INTL_METHOD_RETVAL_UTF8(source, (UChar *)ufield, ilen, 0);
break;
case URES_BINARY:
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 9c369bdec..dc1212431 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -163,7 +163,6 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
{
int32_t meindex = 0;
char * mekey = NULL;
- long mekeylen;
zend_bool is_numeric = 0;
char *pbuf;
ResourceBundle_object *rb;
@@ -177,7 +176,6 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
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);
- mekeylen = Z_STRLEN_P(offset);
rb->child = ures_getByKey(rb->me, mekey, rb->child, &INTL_DATA_ERROR_CODE(rb) );
} else {
intl_errors_set(INTL_DATA_ERROR_P(rb), U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/mysql/tests/bug55473.phpt b/ext/mysql/tests/bug55473.phpt
index 1cc2dc928..98fd0091d 100644
--- a/ext/mysql/tests/bug55473.phpt
+++ b/ext/mysql/tests/bug55473.phpt
@@ -69,18 +69,26 @@ mysql.allow_persistent=1
?>
--EXPECTF--
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
+
+Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 0
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[005] Setting openened files...
+
+Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 1
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[007] Opened files as expected
+
+Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 2
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
[007] Opened files as expected
+
+Warning: mysql_ping(): MySQL server has gone away in %s on line %d
[003] reconnect 3
Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
index 14ec97bf3..eaed212cd 100644
--- a/ext/odbc/config.m4
+++ b/ext/odbc/config.m4
@@ -359,7 +359,7 @@ PHP_ARG_WITH(custom-odbc,,
ODBC_LIBS=$CUSTOM_ODBC_LIBS
ODBC_TYPE=custom-odbc
AC_DEFINE(HAVE_CODBC,1,[ ])
- AC_MSG_RESULT([$ext_ouput])
+ AC_MSG_RESULT([$ext_output])
fi
fi
@@ -369,18 +369,33 @@ PHP_ARG_WITH(iodbc,,
if test "$PHP_IODBC" != "no"; then
AC_MSG_CHECKING(for iODBC support)
- if test "$PHP_IODBC" = "yes"; then
- PHP_IODBC=/usr/local
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
+ PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+ ODBC_TYPE=iodbc
+ ODBC_INCLUDE=`$PKG_CONFIG --cflags-only-I libiodbc`
+ ODBC_LFLAGS=`$PKG_CONFIG --libs-only-L libiodbc`
+ ODBC_LIBS=`$PKG_CONFIG --libs-only-l libiodbc`
+ PHP_EVAL_INCLINE($ODBC_INCLUDE)
+ AC_DEFINE(HAVE_IODBC,1,[ ])
+ AC_DEFINE(HAVE_ODBC2,1,[ ])
+ AC_MSG_RESULT([$ext_output])
+ else
+ if test "$PHP_IODBC" = "yes"; then
+ PHP_IODBC=/usr/local
+ fi
+ PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
+ PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
+ ODBC_TYPE=iodbc
+ ODBC_INCLUDE=-I$PHP_IODBC/include
+ ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
+ ODBC_LIBS=-liodbc
+ AC_DEFINE(HAVE_IODBC,1,[ ])
+ AC_DEFINE(HAVE_ODBC2,1,[ ])
+ AC_MSG_RESULT([$ext_output])
fi
- PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
- PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
- ODBC_TYPE=iodbc
- ODBC_INCLUDE=-I$PHP_IODBC/include
- ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
- ODBC_LIBS=-liodbc
- AC_DEFINE(HAVE_IODBC,1,[ ])
- AC_DEFINE(HAVE_ODBC2,1,[ ])
- AC_MSG_RESULT([$ext_output])
fi
fi
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 7f874e7a4..1c34cffbf 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -562,7 +562,6 @@ static void strip_nop(zend_code_block *block)
{
zend_op *opline = block->start_opline;
zend_op *end, *new_end;
- int new_len = 0;
/* remove leading NOPs */
while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) {
@@ -1284,11 +1283,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array)
/* adjust exception jump targets */
if (op_array->last_try_catch) {
- int i;
- for (i = 0; i< op_array->last_try_catch; i++) {
- op_array->try_catch_array[i].try_op = cfg->try[i]->start_opline - new_opcodes;
- op_array->try_catch_array[i].catch_op = cfg->catch[i]->start_opline - new_opcodes;
+ int i, j;
+ for (i = 0, j = 0; i< op_array->last_try_catch; i++) {
+ if (cfg->try[i]->access) {
+ op_array->try_catch_array[j].try_op = cfg->try[i]->start_opline - new_opcodes;
+ op_array->try_catch_array[j].catch_op = cfg->catch[i]->start_opline - new_opcodes;
+ j++;
+ }
}
+ op_array->last_try_catch = j;
efree(cfg->try);
efree(cfg->catch);
}
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 46406c383..795b95417 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -408,6 +408,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
int var = opline->result.var;
int level = 0;
zend_op *op = opline + 1;
+ zend_op *use = NULL;
while (op < end) {
if (op->opcode == ZEND_BEGIN_SILENCE) {
@@ -420,21 +421,36 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
}
}
if (op->op1_type == IS_VAR && op->op1.var == var) {
- op->op1_type = IS_CV;
- op->op1.var = zend_optimizer_lookup_cv(op_array,
+ if (use) {
+ /* used more than once */
+ use = NULL;
+ break;
+ }
+ use = op;
+ } else if (op->op2_type == IS_VAR && op->op2.var == var) {
+ if (use) {
+ /* used more than once */
+ use = NULL;
+ break;
+ }
+ use = op;
+ }
+ op++;
+ }
+ if (use) {
+ if (use->op1_type == IS_VAR && use->op1.var == var) {
+ use->op1_type = IS_CV;
+ use->op1.var = zend_optimizer_lookup_cv(op_array,
Z_STRVAL(ZEND_OP1_LITERAL(opline)),
Z_STRLEN(ZEND_OP1_LITERAL(opline)));
MAKE_NOP(opline);
- break;
- } else if (op->op2_type == IS_VAR && op->op2.var == var) {
- op->op2_type = IS_CV;
- op->op2.var = zend_optimizer_lookup_cv(op_array,
+ } else if (use->op2_type == IS_VAR && use->op2.var == var) {
+ use->op2_type = IS_CV;
+ use->op2.var = zend_optimizer_lookup_cv(op_array,
Z_STRVAL(ZEND_OP1_LITERAL(opline)),
Z_STRLEN(ZEND_OP1_LITERAL(opline)));
MAKE_NOP(opline);
- break;
}
- op++;
}
}
break;
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h
index a9bad01be..616bdf74f 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -27,6 +27,9 @@
#if ZEND_EXTENSION_API_NO > PHP_5_4_X_API_NO
# define VAR_NUM(v) ((zend_uint)(EX_TMP_VAR_NUM(0, 0) - EX_TMP_VAR(0, v)))
# define NUM_VAR(v) ((zend_uint)(zend_uintptr_t)EX_TMP_VAR_NUM(0, v))
+#elif ZEND_EXTENSION_API_NO > PHP_5_2_X_API_NO
+# define VAR_NUM(v) ((v)/ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)))
+# define NUM_VAR(v) ((v)*ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)))
#else
# define VAR_NUM(v) ((v)/(sizeof(temp_variable)))
# define NUM_VAR(v) ((v)*(sizeof(temp_variable)))
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index b5474c050..827f047cd 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1062,6 +1062,10 @@ int zend_accel_invalidate(const char *filename, int filename_len, zend_bool forc
realpath = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC);
#endif
+ if (!realpath) {
+ return FAILURE;
+ }
+
persistent_script = zend_accel_hash_find(&ZCSG(hash), realpath, strlen(realpath) + 1);
if (persistent_script && !persistent_script->corrupted) {
zend_file_handle file_handle;
diff --git a/ext/opcache/tests/bug65510.phpt b/ext/opcache/tests/bug65510.phpt
new file mode 100644
index 000000000..ba19d27d6
--- /dev/null
+++ b/ext/opcache/tests/bug65510.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var)
+--INI--
+allow_url_include=1
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function parseQuery() {
+ $m = array("l", "a", "r", "u", "e", "n", "c", "e");
+ foreach($m as $n) {
+ @list($a, $b) = $n;
+ }
+}
+parseQuery();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/bug65665.phpt b/ext/opcache/tests/bug65665.phpt
new file mode 100644
index 000000000..ac5c18dd8
--- /dev/null
+++ b/ext/opcache/tests/bug65665.phpt
@@ -0,0 +1,118 @@
+--TEST--
+Bug #65665 (Exception not properly caught when opcache enabled)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
+
+ }
+ catch (Exception $e)
+ {
+
+ }
+
+ break;
+
+ case 1:
+ try
+ {
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "correct\n";
+ }
+
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
+}
+
+function foo1() {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
+
+ }
+ catch (Exception $e)
+ {
+dummy:
+ echo "ect\n";
+ }
+
+ break;
+
+ case 1:
+ try
+ {
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "corr";
+ goto dummy;
+ }
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
+}
+
+function foo2() {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
+dummy:
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "correct\n";
+ }
+
+ break;
+
+ case 1:
+ goto dummy;
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
+}
+foo();foo1();foo2();
+--EXPECT--
+correct
+correct
+correct
diff --git a/ext/opcache/tests/issue0128.phpt b/ext/opcache/tests/issue0128.phpt
new file mode 100644
index 000000000..637f675ac
--- /dev/null
+++ b/ext/opcache/tests/issue0128.phpt
@@ -0,0 +1,16 @@
+--TEST--
+ISSUE #128 (opcache_invalidate segmentation fault)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+var_dump(opcache_invalidate('1'));
+var_dump("okey");
+?>
+--EXPECT--
+bool(false)
+string(4) "okey"
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 98f38138d..4a9fcbc9e 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -574,8 +574,9 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname TSRMLS_DC) /* {{{ */
{
+ zval **data;
zval *subitem, *subentries;
- int i, j = -1, last = -1, obj_cnt = 0;
+ int i;
char *sname;
int nid;
X509_NAME_ENTRY * ne;
@@ -597,7 +598,6 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
ne = X509_NAME_get_entry(name, i);
obj = X509_NAME_ENTRY_get_object(ne);
nid = OBJ_obj2nid(obj);
- obj_cnt = 0;
if (shortname) {
sname = (char *) OBJ_nid2sn(nid);
@@ -605,39 +605,27 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
sname = (char *) OBJ_nid2ln(nid);
}
- MAKE_STD_ZVAL(subentries);
- array_init(subentries);
+ str = X509_NAME_ENTRY_get_data(ne);
+ if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
+ to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
+ } else {
+ to_add = ASN1_STRING_data(str);
+ to_add_len = ASN1_STRING_length(str);
+ }
- last = -1;
- for (;;) {
- j = X509_NAME_get_index_by_OBJ(name, obj, last);
- if (j < 0) {
- if (last != -1) break;
- } else {
- obj_cnt++;
- ne = X509_NAME_get_entry(name, j);
- str = X509_NAME_ENTRY_get_data(ne);
- if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) {
- to_add_len = ASN1_STRING_to_UTF8(&to_add, str);
- if (to_add_len != -1) {
- add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
- }
- } else {
- to_add = ASN1_STRING_data(str);
- to_add_len = ASN1_STRING_length(str);
+ if (to_add_len != -1) {
+ if (zend_hash_find(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, (void**)&data) == SUCCESS) {
+ if (Z_TYPE_PP(data) == IS_ARRAY) {
+ subentries = *data;
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
+ } else if (Z_TYPE_PP(data) == IS_STRING) {
+ MAKE_STD_ZVAL(subentries);
+ array_init(subentries);
+ add_next_index_stringl(subentries, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 1);
+ add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
+ zend_hash_update(Z_ARRVAL_P(subitem), sname, strlen(sname)+1, &subentries, sizeof(zval*), NULL);
}
- }
- last = j;
- }
- i = last;
-
- if (obj_cnt > 1) {
- add_assoc_zval_ex(subitem, sname, strlen(sname) + 1, subentries);
- } else {
- zval_dtor(subentries);
- FREE_ZVAL(subentries);
- if (obj_cnt && str && to_add_len > -1) {
+ } else {
add_assoc_stringl(subitem, sname, (char *)to_add, to_add_len, 1);
}
}
diff --git a/ext/openssl/tests/bug64802.pem b/ext/openssl/tests/bug64802.pem
new file mode 100644
index 000000000..187cda31d
--- /dev/null
+++ b/ext/openssl/tests/bug64802.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIGfzCCBWegAwIBAgIQSVCinGH6MkvjJZjRyjK9nTANBgkqhkiG9w0BAQUFADCB
+jjELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
+A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxNDAyBgNV
+BAMTK0NPTU9ETyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0Ew
+HhcNMTIwMjI5MDAwMDAwWhcNMTQwMjI4MjM1OTU5WjCCAW8xEjAQBgNVBAMTCXd3
+dy5yZC5pbzERMA8GA1UEAxMIcmRpby5jb20xDjAMBgNVBAMTBXJkLmlvMRUwEwYD
+VQQDEwxhcGkucmRpby5jb20xEjAQBgNVBAMTCWFwaS5yZC5pbzEQMA4GA1UEBRMH
+NDU4NjAwNzETMBEGCysGAQQBgjc8AgEDEwJVUzEZMBcGCysGAQQBgjc8AgECEwhE
+ZWxhd2FyZTEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24xCzAJBgNVBAYT
+AlVTMQ4wDAYDVQQREwU5NDEwMzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDVNhbiBG
+cmFuY2lzY28xFzAVBgNVBAkTDjE1NTAgQnJ5YW50IHN0MRMwEQYDVQQKEwpSZGlv
+LCBJbmMuMSMwIQYDVQQLExpDT01PRE8gRVYgTXVsdGktRG9tYWluIFNTTDEVMBMG
+A1UEAxMMd3d3LnJkaW8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
+AQEAt0AgYOe8EBJNVBAuSJFLKHRKZn0/ObCLBFG4xVH/5fb1rfYHBT1XSjjOqR3t
+iGC/A3esF8YC7TuHQcTLVephx0DtJv1ASxRg3zPM8ebBRsuul18N0W+sY1aNXpkd
+36quxvjg5UdBrAweuekJ7OTSZcCe2Ry/SKBeZSWWtkWsI4krCLv7JaKUwxw2h+Hn
+TAZSBLVxz/mixF0WYdepYwnq2Hm7XvvVEIQ7wxOQ9bA7iCevLojZOnb39BT2QII7
+cy8AB47RZdfYg7UwaO3bST2rauA4MKar7/Ozqc0aemNFpLatJfgv07cydiuj9fsd
+5aE/c8is8C9M9+7MmSMkcNEgGwIDAQABo4IB8zCCAe8wHwYDVR0jBBgwFoAUiERR
+/1AqaV4tiPQhutkM8s7L6nwwHQYDVR0OBBYEFCrYw8bfrYJ61NS2yYx6/CnhjzT4
+MA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUF
+BwMBBggrBgEFBQcDAjBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEFATArMCkGCCsG
+AQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8uY29tL0NQUzBTBgNVHR8ETDBK
+MEigRqBEhkJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9FeHRlbmRlZFZh
+bGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcmwwgYQGCCsGAQUFBwEBBHgwdjBOBggr
+BgEFBQcwAoZCaHR0cDovL2NydC5jb21vZG9jYS5jb20vQ09NT0RPRXh0ZW5kZWRW
+YWxpZGF0aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8v
+b2NzcC5jb21vZG9jYS5jb20wTAYDVR0RBEUwQ4IMd3d3LnJkaW8uY29tgglhcGku
+cmQuaW+CDGFwaS5yZGlvLmNvbYIFcmQuaW+CCHJkaW8uY29tggl3d3cucmQuaW8w
+DQYJKoZIhvcNAQEFBQADggEBAKFd4bPVFRyrlqIKPtrtMuqGqid6685ohxf0cv52
+sjdRYwLVTjnZOrmkDdNaF3R2A1ZlVMRN+67rK+qfY5sTeijFcudV3/i0PDtOFRwP
+6yYVD2uZmYkxfPiW309HPmDF+EzhxpVjWlTQEOwkfFLTmJmwl3Qu2Kffp8F1ENXW
+OTVNvj5VtMghvzu68PpzKl1VjlOR4Ej9NCwh1dUjNKEoTPzvpehXsIZ7jHSpX/T1
+wSSt9ckiechDdpgZXTzHgbxHNibK0Uhh+QhkBgYMj5F8qj5BlBhWAWqQa/VnEdmr
+Pfo7U+QmadoqQd7qt06hE2hG1nfZ0vPJDbWV3oVSwG2Yt7I=
+-----END CERTIFICATE-----
diff --git a/ext/openssl/tests/bug64802.phpt b/ext/openssl/tests/bug64802.phpt
new file mode 100644
index 000000000..9a5970149
--- /dev/null
+++ b/ext/openssl/tests/bug64802.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+$cert = file_get_contents(__DIR__.'/bug64802.pem');
+$r = openssl_x509_parse($cert,$use_short_names=true);
+sort($r['subject']);
+var_dump( $r['subject'] );
+?>
+--EXPECTF--
+array(11) {
+ [0]=>
+ string(14) "1550 Bryant st"
+ [1]=>
+ string(5) "94103"
+ [2]=>
+ string(7) "4586007"
+ [3]=>
+ string(2) "CA"
+ [4]=>
+ string(26) "COMODO EV Multi-Domain SSL"
+ [5]=>
+ string(20) "Private Organization"
+ [6]=>
+ string(10) "Rdio, Inc."
+ [7]=>
+ string(13) "San Francisco"
+ [8]=>
+ string(2) "US"
+ [9]=>
+ array(2) {
+ [0]=>
+ string(2) "US"
+ [1]=>
+ string(8) "Delaware"
+ }
+ [10]=>
+ array(6) {
+ [0]=>
+ string(9) "www.rd.io"
+ [1]=>
+ string(8) "rdio.com"
+ [2]=>
+ string(5) "rd.io"
+ [3]=>
+ string(12) "api.rdio.com"
+ [4]=>
+ string(9) "api.rd.io"
+ [5]=>
+ string(12) "www.rdio.com"
+ }
+}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index ee763571c..d5860b1a1 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -997,7 +997,7 @@ static PHP_METHOD(PDO, lastInsertId)
pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()" TSRMLS_CC);
RETURN_FALSE;
} else {
- Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, &Z_STRLEN_P(return_value) TSRMLS_CC);
+ Z_STRVAL_P(return_value) = dbh->methods->last_id(dbh, name, (unsigned int *)&Z_STRLEN_P(return_value) TSRMLS_CC);
if (!Z_STRVAL_P(return_value)) {
PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
index e85dc27f4..a0a2f90ab 100644
--- a/ext/pdo/pdo_sql_parser.c
+++ b/ext/pdo/pdo_sql_parser.c
@@ -74,14 +74,14 @@ yy2:
yy3:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if (yych >= 0x01) goto yy41;
+ if (yych >= 0x01) goto yy43;
yy4:
{ SKIP_ONE(PDO_PARSER_TEXT); }
yy5:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if (yych <= 0x00) goto yy4;
- goto yy36;
+ goto yy38;
yy6:
yych = *++YYCURSOR;
switch (yych) {
@@ -148,14 +148,12 @@ yy6:
case 'x':
case 'y':
case 'z': goto yy32;
- case ':':
- case '?': goto yy29;
+ case ':': goto yy35;
default: goto yy4;
}
yy7:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
- case ':':
case '?': goto yy29;
default: goto yy8;
}
@@ -277,7 +275,6 @@ yy29:
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
- case ':':
case '?': goto yy29;
default: goto yy31;
}
@@ -359,40 +356,48 @@ yy35:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy36:
switch (yych) {
- case 0x00: goto yy2;
- case '\'': goto yy38;
- case '\\': goto yy37;
- default: goto yy35;
+ case ':': goto yy35;
+ default: goto yy31;
}
yy37:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if (yych <= 0x00) goto yy2;
- goto yy35;
yy38:
+ switch (yych) {
+ case 0x00: goto yy2;
+ case '\'': goto yy40;
+ case '\\': goto yy39;
+ default: goto yy37;
+ }
+yy39:
++YYCURSOR;
- { RET(PDO_PARSER_TEXT); }
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ if (yych <= 0x00) goto yy2;
+ goto yy37;
yy40:
++YYCURSOR;
+ { RET(PDO_PARSER_TEXT); }
+yy42:
+ ++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
-yy41:
+yy43:
switch (yych) {
case 0x00: goto yy2;
- case '"': goto yy43;
- case '\\': goto yy42;
- default: goto yy40;
+ case '"': goto yy45;
+ case '\\': goto yy44;
+ default: goto yy42;
}
-yy42:
+yy44:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= 0x00) goto yy2;
- goto yy40;
-yy43:
+ goto yy42;
+yy45:
++YYCURSOR;
{ RET(PDO_PARSER_TEXT); }
}
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 80e3b4f95..1936a3734 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -50,14 +50,14 @@ static int scan(Scanner *s)
QUESTION = [?];
COMMENTS = ("/*"([^*]+|[*]+[^/*])*[*]*"*/"|"--"[^\r\n]*);
SPECIALS = [:?"'];
- MULTICHAR = [:?];
+ MULTICHAR = ([:]{2,}|[?]{2,});
ANYNOEOF = [\001-\377];
*/
/*!re2c
(["](([\\]ANYNOEOF)|ANYNOEOF\["\\])*["]) { RET(PDO_PARSER_TEXT); }
(['](([\\]ANYNOEOF)|ANYNOEOF\['\\])*[']) { RET(PDO_PARSER_TEXT); }
- MULTICHAR{2,} { RET(PDO_PARSER_TEXT); }
+ MULTICHAR { RET(PDO_PARSER_TEXT); }
BINDCHR { RET(PDO_PARSER_BIND); }
QUESTION { RET(PDO_PARSER_BIND_POS); }
SPECIALS { SKIP_ONE(PDO_PARSER_TEXT); }
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 1b0db91c3..04e71823b 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1146,7 +1146,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value,
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, Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : "", Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL TSRMLS_CC) == FAILURE) {
+ } else if (ce->unserialize(&return_value, ce, (unsigned char *)(Z_TYPE_P(val) == IS_STRING ? Z_STRVAL_P(val) : ""), Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(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);
@@ -1876,7 +1876,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip)
{
long mode = PDO_FETCH_BOTH;
- int flags, argc = ZEND_NUM_ARGS() - skip;
+ int flags = 0, argc = ZEND_NUM_ARGS() - skip;
zval ***args;
zend_class_entry **cep;
int retval;
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index c757dbf1e..ede2d6fb7 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -72,11 +72,11 @@ enum pdo_param_type {
/* get_col ptr should point to a zval*
and the driver is responsible for adding correct type information to get_column_meta()
*/
- PDO_PARAM_ZVAL
-};
+ PDO_PARAM_ZVAL,
-/* magic flag to denote a parameter as being input/output */
-#define PDO_PARAM_INPUT_OUTPUT 0x80000000
+ /* magic flag to denote a parameter as being input/output */
+ PDO_PARAM_INPUT_OUTPUT = 0x80000000
+};
#define PDO_PARAM_FLAGS 0xFFFF0000
diff --git a/ext/pdo_mysql/tests/bug_39858.phpt b/ext/pdo_mysql/tests/bug_39858.phpt
index 47457180a..cb9cafd9f 100644
--- a/ext/pdo_mysql/tests/bug_39858.phpt
+++ b/ext/pdo_mysql/tests/bug_39858.phpt
@@ -18,6 +18,8 @@ if ($version < 50000)
die(sprintf("skip Need MySQL Server 5.0.0+, found %d.%02d.%02d (%d)\n",
$matches[0], $matches[1], $matches[2], $version));
?>
+--XFAIL--
+nextRowset() problem with stored proc & emulation mode & mysqlnd
--FILE--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt
index 38d55a019..56cbe4b08 100644
--- a/ext/pdo_mysql/tests/bug_41997.phpt
+++ b/ext/pdo_mysql/tests/bug_41997.phpt
@@ -1,5 +1,7 @@
--TEST--
PDO MySQL Bug #41997 (stored procedure call returning single rowset blocks future queries)
+--XFAIL--
+nextRowset() problem with stored proc & emulation mode & mysqlnd
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
index c3f12df7a..0cabfe6aa 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
@@ -49,7 +49,8 @@ MySQLPDOTest::skip();
// should fail
$dsn = 'mysql:';
- print tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+ // don't print the message since it can be different
+ tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
$dsn = PDO_MYSQL_TEST_DSN;
$user = PDO_MYSQL_TEST_USER;
@@ -57,14 +58,15 @@ MySQLPDOTest::skip();
// should work...
$db = new PDO($dsn, $user, $pass);
+ // Reaction on host not specified differs for different configs, so no printing
$dsn = 'mysql:invalid=foo';
- print tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+ tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
$dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000);
- print tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+ tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
$dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue';
- print tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+ tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
if (PDO_MYSQL_TEST_HOST) {
$host = PDO_MYSQL_TEST_HOST;
@@ -295,6 +297,5 @@ MySQLPDOTest::skip();
[006] invalid data source name, [n/a] n/a
[007] could not find driver, [n/a] n/a
[009] SQLSTATE[%s] [1045] Access denied for user 'dont%s'@'%s' (using password: YES), [n/a] n/a
-[010] SQLSTATE[%s] [1045] Access denied for user 'dont%s'@'%s' (using password: YES), [n/a] n/a
[017] DSN=%s, SQLSTATE[%s] [%d] %s
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
index eb0fff13e..5990ab812 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
@@ -64,7 +64,7 @@ MySQLPDOTest::skip();
$tmp = $stmt->fetch(PDO::FETCH_ASSOC);
$con1 = $tmp['_con1'];
- $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
$stmt = $db2->query('SELECT CONNECTION_ID() as _con2');
$tmp = $stmt->fetch(PDO::FETCH_ASSOC);
$con2 = $tmp['_con2'];
@@ -94,4 +94,4 @@ MySQLPDOTest::skip();
print "done!";
?>
--EXPECTF--
-done! \ No newline at end of file
+done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
index 799624543..9165e7055 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
@@ -1,5 +1,7 @@
--TEST--
MySQL PDOStatement->nextRowSet()
+--XFAIL--
+nextRowset() problem with stored proc & emulation mode & mysqlnd
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
@@ -310,4 +312,4 @@ array(3) {
}
}
bool(false)
-done! \ No newline at end of file
+done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
index c34f4a9d3..e58d4a657 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
@@ -1,5 +1,7 @@
--TEST--
MySQL Prepared Statements and different column counts
+--XFAIL--
+nextRowset() problem with stored proc & emulation mode & mysqlnd
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
@@ -120,4 +122,4 @@ if ($version < 50000)
print "done!";
?>
--EXPECTF--
-done! \ No newline at end of file
+done!
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 5497bebc6..fcdefa94b 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -537,7 +537,9 @@ static int pdo_oci_check_liveness(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
{
pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
sb4 error_code = 0;
+#if (!((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))))
char version[256];
+#endif
/* TODO move attached check to PDO level */
if (H->attached == 0) {
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index dcb955780..6a74efa7b 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -270,6 +270,12 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
P = (pdo_oci_bound_param*)param->driver_data;
switch (event_type) {
+ case PDO_PARAM_EVT_FETCH_PRE:
+ case PDO_PARAM_EVT_FETCH_POST:
+ case PDO_PARAM_EVT_NORMALIZE:
+ /* Do nothing */
+ break;
+
case PDO_PARAM_EVT_FREE:
P = param->driver_data;
if (P) {
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 33163688e..f7f3ef34e 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -263,7 +263,7 @@ out:
static int odbc_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type param_type TSRMLS_DC)
{
- pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
+ /* pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; */
/* TODO: figure it out */
return 0;
}
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 6ee2fcd6b..0e3fd3cbb 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -286,6 +286,12 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
if (param->is_param) {
switch (event_type) {
+ case PDO_PARAM_EVT_FETCH_PRE:
+ case PDO_PARAM_EVT_FETCH_POST:
+ case PDO_PARAM_EVT_NORMALIZE:
+ /* Do nothing */
+ break;
+
case PDO_PARAM_EVT_FREE:
P = param->driver_data;
if (P) {
@@ -543,7 +549,6 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
{
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
struct pdo_column_data *col = &stmt->columns[colno];
- zend_bool dyn = FALSE;
RETCODE rc;
SWORD colnamelen;
SDWORD colsize, displaysize;
@@ -614,7 +619,6 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l
/* if it is a column containing "long" data, perform late binding now */
if (C->is_long) {
- unsigned long alloced = 4096;
unsigned long used = 0;
char *buf;
RETCODE rc;
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 252bfff25..50136430a 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -315,9 +315,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for trailing 0 */
#ifdef HAVE_PQESCAPE_BYTEA_CONN
- escaped = PQescapeByteaConn(H->server, unquoted, unquotedlen, &tmp_len);
+ escaped = PQescapeByteaConn(H->server, (unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len);
#else
- escaped = PQescapeBytea(unquoted, unquotedlen, &tmp_len);
+ escaped = PQescapeBytea((unsigned char *)unquoted, (size_t)unquotedlen, &tmp_len);
#endif
*quotedlen = (int)tmp_len + 1;
*quoted = emalloc(*quotedlen + 1);
@@ -331,9 +331,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquote
*quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
#ifndef HAVE_PQESCAPE_CONN
- *quotedlen = PQescapeString(*quoted + 1, unquoted, unquotedlen);
+ *quotedlen = PQescapeString(*quoted + 1, unquoted, (size_t)unquotedlen);
#else
- *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, unquotedlen, NULL);
+ *quotedlen = PQescapeStringConn(H->server, *quoted + 1, unquoted, (size_t)unquotedlen, NULL);
#endif
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index 3ef89196d..792ad2707 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -536,7 +536,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned
*len = 0;
return 0;
} else {
- char *tmp_ptr = PQunescapeBytea(*ptr, &tmp_len);
+ char *tmp_ptr = (char *)PQunescapeBytea((unsigned char *)*ptr, &tmp_len);
if (!tmp_ptr) {
/* PQunescapeBytea returned an error */
*len = 0;
diff --git a/ext/pdo_pgsql/tests/bug64953.phpt b/ext/pdo_pgsql/tests/bug64953.phpt
new file mode 100644
index 000000000..6e72bcab6
--- /dev/null
+++ b/ext/pdo_pgsql/tests/bug64953.phpt
@@ -0,0 +1,71 @@
+--TEST--
+PDO PgSQL Bug #64953 (Postgres prepared statement positional parameter casting)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
+
+echo "Taken from the bug report:\n";
+
+$st = $pdo->prepare('SELECT ?::char as i');
+$st->bindValue(1, '1');
+$st->execute();
+var_dump($st->fetch()); // return false
+
+
+$st = $pdo->prepare('SELECT (?)::char as i');
+$st->bindValue(1, '1');
+$st->execute();
+var_dump($st->fetch()); // return array(1) { ["i"]=> string(1) "1" }
+
+echo "Something more nasty:\n";
+
+$st = $pdo->prepare("SELECT :int::int as i");
+$st->execute(array(":int" => 123));
+var_dump($st->fetch());
+
+$st = $pdo->prepare("SELECT '''?'''::text as \":text\"");
+$st->execute();
+var_dump($st->fetch());
+
+?>
+Done
+--EXPECT--
+Test
+Taken from the bug report:
+array(2) {
+ ["i"]=>
+ string(1) "1"
+ [0]=>
+ string(1) "1"
+}
+array(2) {
+ ["i"]=>
+ string(1) "1"
+ [0]=>
+ string(1) "1"
+}
+Something more nasty:
+array(2) {
+ ["i"]=>
+ string(3) "123"
+ [0]=>
+ string(3) "123"
+}
+array(2) {
+ [":text"]=>
+ string(3) "'?'"
+ [0]=>
+ string(3) "'?'"
+}
+Done
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index f0e1780a7..35eb09e58 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -63,6 +63,7 @@
#define PGSQL_MAX_LENGTH_OF_LONG 30
#define PGSQL_MAX_LENGTH_OF_DOUBLE 60
+#if LONG_MAX < UINT_MAX
#define PGSQL_RETURN_OID(oid) do { \
if (oid > LONG_MAX) { \
smart_str s = {0}; \
@@ -72,7 +73,9 @@
} \
RETURN_LONG((long)oid); \
} while(0)
-
+#else
+#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid))
+#endif
#if HAVE_PQSETNONBLOCKING
#define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag)
@@ -4152,7 +4155,7 @@ PHP_FUNCTION(pg_escape_bytea)
#ifdef HAVE_PQESCAPE_BYTEA_CONN
if (pgsql_link != NULL || id != -1) {
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- to = (char *)PQescapeByteaConn(pgsql, from, (size_t)from_len, &to_len);
+ to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, (size_t)from_len, &to_len);
} else
#endif
to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len);
@@ -4347,7 +4350,7 @@ static char* php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le
#endif
static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_literal) {
- char *from = NULL, *to = NULL, *tmp = NULL;
+ char *from = NULL, *to = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
int from_len;
@@ -4380,17 +4383,22 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
RETURN_FALSE;
}
#ifdef HAVE_PQESCAPELITERAL
- if (escape_literal) {
- tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
- } else {
- tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
- }
- if (!tmp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape");
- RETURN_FALSE;
+ /* Use a block with a local var to avoid unused variable warnings */
+ {
+ char *tmp;
+
+ if (escape_literal) {
+ tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
+ } else {
+ tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
+ }
+ if (!tmp) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape");
+ RETURN_FALSE;
+ }
+ to = estrdup(tmp);
+ PQfreemem(tmp);
}
- to = estrdup(tmp);
- PQfreemem(tmp);
#else
to = php_pgsql_PQescapeInternal(pgsql, from, (size_t)from_len, escape_literal);
if (!to) {
@@ -5121,7 +5129,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
#else
new_len = PQescapeString(escaped, tmp_name2, strlen(tmp_name2));
#endif
- smart_str_appends(&querystr, escaped);
+ if (new_len) {
+ smart_str_appends(&querystr, escaped);
+ }
efree(escaped);
smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '");
@@ -5131,7 +5141,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
#else
new_len = PQescapeString(escaped, tmp_name, strlen(tmp_name));
#endif
- smart_str_appends(&querystr, escaped);
+ if (new_len) {
+ smart_str_appends(&querystr, escaped);
+ }
efree(escaped);
smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;");
@@ -5924,9 +5936,9 @@ 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, Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
+ tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
#else
- tmp = PQescapeBytea(Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len);
+ tmp = PQescapeBytea(Z_STRVAL_PP(val), (unsigned char *)Z_STRLEN_PP(val), &to_len);
#endif
Z_TYPE_P(new_val) = IS_STRING;
Z_STRLEN_P(new_val) = to_len-1; /* PQescapeBytea's to_len includes additional '\0' */
diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt
index 67ef262fc..db671016e 100644
--- a/ext/pgsql/tests/09notice.phpt
+++ b/ext/pgsql/tests/09notice.phpt
@@ -20,6 +20,9 @@ $db = pg_connect($conn_str);
_set_lc_messages();
+$res = pg_query($db, 'SET client_min_messages TO NOTICE;');
+var_dump($res);
+
pg_query($db, "BEGIN;");
pg_query($db, "BEGIN;");
@@ -33,6 +36,8 @@ echo "pg_last_notice() is Ok\n";
?>
--EXPECTF--
+resource(%d) of type (pgsql result)
+
Notice: pg_query(): %s already a transaction in progress in %s on line %d
%s already a transaction in progress
pg_last_notice() is Ok
diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt
index cad5fb3a1..b9bbbf86e 100644
--- a/ext/pgsql/tests/80_bug32223.phpt
+++ b/ext/pgsql/tests/80_bug32223.phpt
@@ -37,8 +37,10 @@ begin
end;
' LANGUAGE plpgsql;");
-
+$res = pg_query($dbh, 'SET client_min_messages TO NOTICE;');
+var_dump($res);
$res = pg_query($dbh, 'SELECT test_notice()');
+var_dump($res);
$row = pg_fetch_row($res, 0);
var_dump($row);
pg_free_result($res);
@@ -52,6 +54,8 @@ pg_close($dbh);
?>
===DONE===
--EXPECTF--
+resource(%d) of type (pgsql result)
+resource(%d) of type (pgsql result)
array(1) {
[0]=>
string(1) "f"
diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt
index e79685c43..418ccfc9a 100644
--- a/ext/pgsql/tests/80_bug32223b.phpt
+++ b/ext/pgsql/tests/80_bug32223b.phpt
@@ -37,10 +37,13 @@ begin
end;
' LANGUAGE plpgsql;");
+$res = pg_query(dbh, 'SET client_min_messages TO NOTICE;');
+var_dump($res);
+
function tester() {
$res = pg_query(dbh, 'SELECT test_notice()');
$row = pg_fetch_row($res, 0);
- var_dump($row);
+ var_dump($row);
pg_free_result($res);
if ($row[0] == 'f')
{
@@ -54,6 +57,7 @@ pg_close(dbh);
?>
===DONE===
--EXPECTF--
+resource(%d) of type (pgsql result)
array(1) {
[0]=>
string(1) "f"
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index e5733b44f..004d9d463 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -338,13 +338,13 @@ PS_READ_FUNC(files)
if (!PS(id)) {
return FAILURE;
}
- php_session_reset_id(TSRMLS_C);
if (PS(use_cookies)) {
PS(send_cookie) = 1;
}
+ php_session_reset_id(TSRMLS_C);
}
- ps_files_open(data, key TSRMLS_CC);
+ ps_files_open(data, PS(id) TSRMLS_CC);
if (data->fd < 0) {
return FAILURE;
}
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 69c0da7bd..3d37b981b 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -367,13 +367,13 @@ PS_READ_FUNC(mm)
if (!PS(id)) {
return FAILURE;
}
- php_session_reset_id(TSRMLS_C);
if (PS(use_cookies)) {
PS(send_cookie) = 1;
}
+ php_session_reset_id(TSRMLS_C);
}
- sd = ps_sd_lookup(data, key, 0);
+ sd = ps_sd_lookup(data, PS(id), 0);
if (sd) {
*vallen = sd->datalen;
*val = emalloc(sd->datalen + 1);
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 82fd419fc..1b606b9a3 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -188,7 +188,7 @@ PS_CREATE_SID_FUNC(user)
/* maintain backwards compatibility */
if (PSF(create_sid) != NULL) {
char *id = NULL;
- STDVARS;
+ zval *retval = NULL;
retval = ps_call_handler(PSF(create_sid), 0, NULL TSRMLS_CC);
diff --git a/ext/session/session.c b/ext/session/session.c
index 7c6672de5..7bb658462 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -827,6 +827,44 @@ PHP_INI_END()
/* ***************
* Serializers *
*************** */
+PS_SERIALIZER_ENCODE_FUNC(php_serialize) /* {{{ */
+{
+ smart_str buf = {0};
+ php_serialize_data_t var_hash;
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &PS(http_session_vars), &var_hash TSRMLS_CC);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+ if (newlen) {
+ *newlen = buf.len;
+ }
+ smart_str_0(&buf);
+ *newstr = buf.c;
+ return SUCCESS;
+}
+/* }}} */
+
+PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */
+{
+ const char *endptr = val + vallen;
+ zval *session_vars;
+ php_unserialize_data_t var_hash;
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ ALLOC_INIT_ZVAL(session_vars);
+ php_var_unserialize(&session_vars, &val, endptr, &var_hash TSRMLS_CC);
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ if (PS(http_session_vars)) {
+ zval_ptr_dtor(&PS(http_session_vars));
+ }
+ if (Z_TYPE_P(session_vars) == IS_NULL) {
+ array_init(session_vars);
+ }
+ PS(http_session_vars) = session_vars;
+ ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), PS(http_session_vars), 2, 1);
+ return SUCCESS;
+}
+/* }}} */
#define PS_BIN_NR_OF_BITS 8
#define PS_BIN_UNDEF (1<<(PS_BIN_NR_OF_BITS-1))
@@ -1008,10 +1046,11 @@ break_outer_loop:
}
/* }}} */
-#define MAX_SERIALIZERS 10
-#define PREDEFINED_SERIALIZERS 2
+#define MAX_SERIALIZERS 32
+#define PREDEFINED_SERIALIZERS 3
static ps_serializer ps_serializers[MAX_SERIALIZERS + 1] = {
+ PS_SERIALIZER_ENTRY(php_serialize),
PS_SERIALIZER_ENTRY(php),
PS_SERIALIZER_ENTRY(php_binary)
};
diff --git a/ext/session/tests/bug65475.phpt b/ext/session/tests/bug65475.phpt
new file mode 100644
index 000000000..7dc546387
--- /dev/null
+++ b/ext/session/tests/bug65475.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #65475: Session ID is not initialized when session.usr_strict_mode=1
+--INI--
+session.save_handler=files
+session.name=PHPSESSID
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+ob_start();
+
+echo "Testing file module".PHP_EOL;
+session_start();
+$_SESSION['foo'] = 1234;
+$_SESSION['cnt'] = 1;
+$session_id = session_id();
+session_write_close();
+
+session_start();
+var_dump($session_id === session_id());
+$_SESSION['cnt']++;
+session_write_close();
+
+session_start();
+var_dump($session_id === session_id());
+var_dump($_SESSION['cnt']); // Should be int(2)
+session_write_close();
+
+--EXPECTF--
+Testing file module
+bool(true)
+bool(true)
+int(2)
+
diff --git a/ext/session/tests/rfc1867.phpt b/ext/session/tests/rfc1867.phpt
index dc44e8b44..6b14bcb4e 100644
--- a/ext/session/tests/rfc1867.phpt
+++ b/ext/session/tests/rfc1867.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_cleanup.phpt b/ext/session/tests/rfc1867_cleanup.phpt
index f70b395d2..f84385bad 100644
--- a/ext/session/tests/rfc1867_cleanup.phpt
+++ b/ext/session/tests/rfc1867_cleanup.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_disabled.phpt b/ext/session/tests/rfc1867_disabled.phpt
index 449005579..550ee3a7a 100644
--- a/ext/session/tests/rfc1867_disabled.phpt
+++ b/ext/session/tests/rfc1867_disabled.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=0
diff --git a/ext/session/tests/rfc1867_disabled_2.phpt b/ext/session/tests/rfc1867_disabled_2.phpt
index e878f4619..83e97eeed 100644
--- a/ext/session/tests/rfc1867_disabled_2.phpt
+++ b/ext/session/tests/rfc1867_disabled_2.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_inter.phpt b/ext/session/tests/rfc1867_inter.phpt
index 768637105..4d9b26223 100644
--- a/ext/session/tests/rfc1867_inter.phpt
+++ b/ext/session/tests/rfc1867_inter.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_no_name.phpt b/ext/session/tests/rfc1867_no_name.phpt
index c1dda8156..d68a61d92 100644
--- a/ext/session/tests/rfc1867_no_name.phpt
+++ b/ext/session/tests/rfc1867_no_name.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_cookie.phpt b/ext/session/tests/rfc1867_sid_cookie.phpt
index 735a5ac20..286479933 100644
--- a/ext/session/tests/rfc1867_sid_cookie.phpt
+++ b/ext/session/tests/rfc1867_sid_cookie.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_get.phpt b/ext/session/tests/rfc1867_sid_get.phpt
index cc5a793e7..e3a48a1c1 100644
--- a/ext/session/tests/rfc1867_sid_get.phpt
+++ b/ext/session/tests/rfc1867_sid_get.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_get_2.phpt b/ext/session/tests/rfc1867_sid_get_2.phpt
index 1d22e5930..e21ca4ca2 100644
--- a/ext/session/tests/rfc1867_sid_get_2.phpt
+++ b/ext/session/tests/rfc1867_sid_get_2.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=0
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_only_cookie.phpt b/ext/session/tests/rfc1867_sid_only_cookie.phpt
index 9a0105668..41f6761fb 100644
--- a/ext/session/tests/rfc1867_sid_only_cookie.phpt
+++ b/ext/session/tests/rfc1867_sid_only_cookie.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=1
session.upload_progress.enabled=1
diff --git a/ext/session/tests/rfc1867_sid_post.phpt b/ext/session/tests/rfc1867_sid_post.phpt
index 7c1eb2de5..107957f8d 100644
--- a/ext/session/tests/rfc1867_sid_post.phpt
+++ b/ext/session/tests/rfc1867_sid_post.phpt
@@ -7,6 +7,7 @@ comment=debug builds show some additional E_NOTICE errors
upload_max_filesize=1024
session.save_path=
session.name=PHPSESSID
+session.use_strict_mode=0
session.use_cookies=1
session.use_only_cookies=0
session.upload_progress.enabled=1
diff --git a/ext/session/tests/session_decode_basic_serialize.phpt b/ext/session/tests/session_decode_basic_serialize.phpt
new file mode 100644
index 000000000..dd88438e1
--- /dev/null
+++ b/ext/session/tests/session_decode_basic_serialize.phpt
@@ -0,0 +1,274 @@
+--TEST--
+Test session_decode() function : basic functionality
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+
+ob_start();
+
+/*
+ * Prototype : string session_decode(void)
+ * Description : Decodes session data from a string
+ * Source code : ext/session/session.c
+ */
+
+echo "*** Testing session_decode() : basic functionality ***\n";
+
+// Get an unset variable
+$unset_var = 10;
+unset($unset_var);
+
+class classA
+{
+ public function __toString() {
+ return "Hello World!";
+ }
+}
+
+$heredoc = <<<EOT
+Hello World!
+EOT;
+
+$fp = fopen(__FILE__, "r");
+
+// Unexpected values to be passed as arguments
+$inputs = array(
+
+ // Integer data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // Float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // Null data
+/*10*/ NULL,
+ null,
+
+ // Boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // Empty strings
+/*16*/ "",
+ '',
+
+ // Invalid string data
+/*18*/ "Nothing",
+ 'Nothing',
+ $heredoc,
+
+ // Object data
+/*21*/ new classA(),
+
+ // Undefined data
+/*22*/ @$undefined_var,
+
+ // Unset data
+/*23*/ @$unset_var,
+
+ // Resource variable
+/*24*/ $fp
+);
+
+ini_set('session.serialize_handler', 'php_serialize');
+var_dump(session_start());
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ $_SESSION["data"] = $input;
+ $encoded = session_encode();
+ var_dump(session_decode($encoded));
+ var_dump($_SESSION);
+ $iterator++;
+};
+
+var_dump(session_destroy());
+fclose($fp);
+echo "Done";
+ob_end_flush();
+?>
+--EXPECTF--
+*** Testing session_decode() : basic functionality ***
+bool(true)
+
+-- Iteration 1 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(0)
+}
+
+-- Iteration 2 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(1)
+}
+
+-- Iteration 3 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(12345)
+}
+
+-- Iteration 4 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(-2345)
+}
+
+-- Iteration 5 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(10.5)
+}
+
+-- Iteration 6 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(-10.5)
+}
+
+-- Iteration 7 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(123456789000)
+}
+
+-- Iteration 8 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(1.23456789E-9)
+}
+
+-- Iteration 9 --
+bool(true)
+array(1) {
+ ["data"]=>
+ float(0.5)
+}
+
+-- Iteration 10 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 11 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 12 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(true)
+}
+
+-- Iteration 13 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(false)
+}
+
+-- Iteration 14 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(true)
+}
+
+-- Iteration 15 --
+bool(true)
+array(1) {
+ ["data"]=>
+ bool(false)
+}
+
+-- Iteration 16 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(0) ""
+}
+
+-- Iteration 17 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(0) ""
+}
+
+-- Iteration 18 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(7) "Nothing"
+}
+
+-- Iteration 19 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(7) "Nothing"
+}
+
+-- Iteration 20 --
+bool(true)
+array(1) {
+ ["data"]=>
+ string(12) "Hello World!"
+}
+
+-- Iteration 21 --
+bool(true)
+array(1) {
+ ["data"]=>
+ object(classA)#2 (0) {
+ }
+}
+
+-- Iteration 22 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 23 --
+bool(true)
+array(1) {
+ ["data"]=>
+ NULL
+}
+
+-- Iteration 24 --
+bool(true)
+array(1) {
+ ["data"]=>
+ int(0)
+}
+bool(true)
+Done
+
diff --git a/ext/session/tests/session_encode_serialize.phpt b/ext/session/tests/session_encode_serialize.phpt
new file mode 100644
index 000000000..41c79c3e5
--- /dev/null
+++ b/ext/session/tests/session_encode_serialize.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test session_encode() function : Numeric key raise error. bug65359
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+ob_start();
+
+ini_set('session.serialize_handler', 'php_serialize');
+var_dump(session_start());
+$_SESSION[-3] = 'foo';
+$_SESSION[3] = 'bar';
+$_SESSION['var'] = 123;
+var_dump(session_encode());
+session_write_close();
+
+// Should finish without errors
+echo 'Done'.PHP_EOL;
+?>
+--EXPECTF--
+bool(true)
+string(51) "a:3:{i:-3;s:3:"foo";i:3;s:3:"bar";s:3:"var";i:123;}"
+Done
+
diff --git a/ext/session/tests/session_id_basic.phpt b/ext/session/tests/session_id_basic.phpt
index 5cb13c25e..852d2f957 100644
--- a/ext/session/tests/session_id_basic.phpt
+++ b/ext/session/tests/session_id_basic.phpt
@@ -20,6 +20,8 @@ var_dump(session_id("test"));
var_dump(session_id());
var_dump(session_id("1234567890"));
var_dump(session_id());
+// Turn off strice mode, since it does not allow uninitialized session ID
+ini_set('session.use_strict_mode',false);
var_dump(session_start());
var_dump(session_id());
var_dump(session_destroy());
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 1a417d0f5..3dc7b7925 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -2290,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct)
intern->u.file.open_mode = NULL;
intern->u.file.open_mode_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr!",
&intern->file_name, &intern->file_name_len,
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
&use_include_path, &intern->u.file.zcontext) == FAILURE) {
diff --git a/ext/spl/tests/bug64782.phpt b/ext/spl/tests/bug64782.phpt
new file mode 100644
index 000000000..ac5d08d7d
--- /dev/null
+++ b/ext/spl/tests/bug64782.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #64782: SplFileObject constructor make $context optional / give it a default value
+--FILE--
+<?php
+
+var_dump(new SplFileObject(__FILE__, "r", false, null));
+
+?>
+--EXPECTF--
+object(SplFileObject)#1 (%d) {
+ ["pathName":"SplFileInfo":private]=>
+ string(%d) "%s/bug64782.php"
+ ["fileName":"SplFileInfo":private]=>
+ string(12) "bug64782.php"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "r"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9c91404ef..eca7d9036 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1789,8 +1789,8 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_number_format, 0, 0, 1)
ZEND_ARG_INFO(0, number)
ZEND_ARG_INFO(0, num_decimal_places)
- ZEND_ARG_INFO(0, dec_seperator)
- ZEND_ARG_INFO(0, thousands_seperator)
+ ZEND_ARG_INFO(0, dec_separator)
+ ZEND_ARG_INFO(0, thousands_separator)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_fmod, 0)
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 2af2209f2..3d00d88dd 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -182,12 +182,12 @@ AC_TRY_RUN([
main() {
#if HAVE_CRYPT
- char salt[30], answer[80];
-
- salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]='$'; salt[4]='b'; salt[5]='a'; salt[6]='r'; salt[7]='\0';
+ char salt[21], answer[21+86];
+
+ strcpy(salt,"\$6\$rasmuslerdorf\$");
strcpy(answer, salt);
- strcpy(&answer[29],"$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.");
- exit (strcmp((char *)crypt("foo",salt),answer));
+ strcat(answer, "EeHCRjm0bljalWuALHSTs1NB9ipEiLEXLhYeXdOpx22gmlmVejnVXFhd84cEKbYxCo.XuUTrW.RLraeEnsvWs/");
+ exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
#else
exit(0);
#endif
@@ -211,12 +211,13 @@ AC_TRY_RUN([
main() {
#if HAVE_CRYPT
- char salt[30], answer[80];
- salt[0]='$'; salt[1]='5'; salt[2]='$'; salt[3]='$'; salt[4]='s'; salt[5]='a'; salt[6]='l'; salt[7]='t'; salt[8]='s'; salt[9]='t'; salt[10]='r'; salt[11]='i'; salt[12]='n'; salt[13]='g'; salt[14]='\0';
- strcat(salt,"");
+ char salt[21], answer[21+43];
+
+ strcpy(salt,"\$5\$rasmuslerdorf\$");
strcpy(answer, salt);
- strcpy(&answer[29], "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5");
- exit (strcmp((char *)crypt("foo",salt),answer));
+ strcat(answer, "cFAm2puLCujQ9t.0CxiFIIvFi4JyQx5UncCt/xRIX23");
+ exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
+
#else
exit(0);
#endif
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 106f5c100..ad6bdad34 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -818,7 +818,7 @@ PHP_FUNCTION(tempnam)
if (p_len > 64) {
p[63] = '\0';
}
-
+
RETVAL_FALSE;
if ((fd = php_open_temporary_fd_ex(dir, p, &opened_path, 1 TSRMLS_CC)) >= 0) {
@@ -1380,13 +1380,13 @@ PHP_FUNCTION(umask)
{
long arg1 = 0;
int oldumask;
-
+
oldumask = umask(077);
if (BG(umask) == -1) {
BG(umask) = oldumask;
}
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) {
RETURN_FALSE;
}
@@ -1799,22 +1799,23 @@ quit_loop:
#define FPUTCSV_FLD_CHK(c) memchr(Z_STRVAL(field), c, Z_STRLEN(field))
-/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure]])
+/* {{{ proto int fputcsv(resource fp, array fields [, string delimiter [, string enclosure [, string escape_char]]])
Format line as CSV and write to file pointer */
PHP_FUNCTION(fputcsv)
{
- char delimiter = ','; /* allow this to be set as parameter */
- char enclosure = '"'; /* allow this to be set as parameter */
- const char escape_char = '\\';
+ char delimiter = ','; /* allow this to be set as parameter */
+ char enclosure = '"'; /* allow this to be set as parameter */
+ char escape_char = '\\'; /* allow this to be set as parameter */
php_stream *stream;
zval *fp = NULL, *fields = NULL;
int ret;
- char *delimiter_str = NULL, *enclosure_str = NULL;
- int delimiter_str_len = 0, enclosure_str_len = 0;
+ char *delimiter_str = NULL, *enclosure_str = NULL, *escape_str = NULL;
+ int delimiter_str_len = 0, enclosure_str_len = 0, escape_str_len = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|sss",
&fp, &fields, &delimiter_str, &delimiter_str_len,
- &enclosure_str, &enclosure_str_len) == FAILURE) {
+ &enclosure_str, &enclosure_str_len,
+ &escape_str, &escape_str_len) == FAILURE) {
return;
}
@@ -1842,6 +1843,17 @@ PHP_FUNCTION(fputcsv)
enclosure = *enclosure_str;
}
+ if (escape_str != NULL) {
+ if (escape_str_len < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "escape must be a character");
+ RETURN_FALSE;
+ } else if (escape_str_len > 1) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "escape must be a single character");
+ }
+ /* use first character from string */
+ escape_char = *escape_str;
+ }
+
PHP_STREAM_TO_ZVAL(stream, &fp);
ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC);
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 0a5903963..15dae1bee 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -951,7 +951,9 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
*(pd++) = qp_digits[(c & 0x0f)];
ocnt -= 3;
line_ccnt -= 3;
- trail_ws--;
+ if (trail_ws > 0) {
+ trail_ws--;
+ }
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
}
}
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 32ef94e59..48e0e85cc 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -287,7 +287,7 @@ void php_info_print_style(TSRMLS_D)
PHPAPI char *php_info_html_esc(char *string TSRMLS_DC)
{
size_t new_len;
- return php_escape_html_entities(string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
+ return php_escape_html_entities((unsigned char *) string, strlen(string), &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
}
/* }}} */
diff --git a/ext/standard/math.c b/ext/standard/math.c
index be2d65526..f6b3d5406 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1226,7 +1226,7 @@ PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point,
}
/* }}} */
-/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])
+/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_separator, string thousands_separator]])
Formats a number with grouped thousands */
PHP_FUNCTION(number_format)
{
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 212799100..ca852038a 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -66,20 +66,20 @@ static php_password_algo php_password_determine_algo(const char *hash, const siz
return PHP_PASSWORD_UNKNOWN;
}
-static zend_bool php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */
+static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */
{
size_t i = 0;
for (i = 0; i < len; i++) {
if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) {
- return 0;
+ return FAILURE;
}
}
- return 1;
+ return SUCCESS;
}
/* }}} */
-static zend_bool php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
+static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
{
size_t pos = 0;
size_t ret_len = 0;
@@ -108,7 +108,7 @@ static zend_bool php_password_salt_to64(const char *str, const size_t str_len, c
}
/* }}} */
-static zend_bool php_password_make_salt(size_t length, char *ret TSRMLS_DC) /* {{{ */
+static int php_password_make_salt(size_t length, char *ret TSRMLS_DC) /* {{{ */
{
int buffer_valid = 0;
size_t i, raw_length;
@@ -395,7 +395,7 @@ PHP_FUNCTION(password_hash)
efree(buffer);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Provided salt is too short: %lu expecting %lu", (unsigned long) buffer_len, (unsigned long) required_salt_len);
RETURN_NULL();
- } else if (0 == php_password_salt_is_alphabet(buffer, buffer_len)) {
+ } else if (php_password_salt_is_alphabet(buffer, buffer_len) == FAILURE) {
salt = safe_emalloc(required_salt_len, 1, 1);
if (php_password_salt_to64(buffer, buffer_len, required_salt_len, salt) == FAILURE) {
efree(hash_format);
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 35343b3d5..afc5f178e 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -115,6 +115,7 @@ do { \
PHPAPI void var_replace(php_unserialize_data_t *var_hash, zval *ozval, zval **nzval);
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hash, zval **val);
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval);
PHPAPI void var_destroy(php_unserialize_data_t *var_hash);
#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash, ozval, nzval) \
diff --git a/ext/standard/tests/file/fputcsv_error.phpt b/ext/standard/tests/file/fputcsv_error.phpt
index 9403cf446..ebffd4542 100644
--- a/ext/standard/tests/file/fputcsv_error.phpt
+++ b/ext/standard/tests/file/fputcsv_error.phpt
@@ -48,7 +48,7 @@ Warning: fputcsv() expects at least 2 parameters, 0 given in %s on line %d
NULL
-- Testing fputcsv() with more than expected number of arguments --
-Warning: fputcsv() expects at most 4 parameters, 5 given in %s on line %d
+Warning: fputcsv() expects parameter 5 to be string, resource given in %s on line %d
NULL
-- Testing fputcsv() with invalid arguments --
-- Iteration 1 --
diff --git a/ext/standard/tests/file/fputcsv_variation15.phpt b/ext/standard/tests/file/fputcsv_variation15.phpt
new file mode 100755
index 000000000..dc4a9e2db
--- /dev/null
+++ b/ext/standard/tests/file/fputcsv_variation15.phpt
@@ -0,0 +1,107 @@
+--TEST--
+various fputcsv() functionality tests
+--CREDITS--
+Lee Leathers <leeleathers@gmail.com>
+--FILE--
+<?php
+
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"/"bbb,ccc',
+ 17 => 'aaa"/"a","bbb"',
+ 18 => '"/"","aaa"',
+ 19 => '"/""",aaa',
+);
+
+$file = dirname(__FILE__) . 'fgetcsv.csv';
+@unlink($file);
+
+$fp = fopen($file, "w");
+foreach ($list as $v) {
+ fputcsv($fp, explode(',', $v), ',', '"', '/');
+}
+fclose($fp);
+
+$res = file($file);
+foreach($res as &$val)
+{
+ $val = substr($val, 0, -1);
+}
+echo '$list = ';var_export($res);echo ";\n";
+
+$fp = fopen($file, "r");
+$res = array();
+while($l=fgetcsv($fp, 0, ',', '"', '/'))
+{
+ $res[] = join(',',$l);
+}
+fclose($fp);
+
+echo '$list = ';var_export($res);echo ";\n";
+
+@unlink($file);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"""bbb"""',
+ 2 => '"""aaa""","""bbb"""',
+ 3 => 'aaa,bbb',
+ 4 => '"""aaa""",bbb',
+ 5 => '"""aaa"""," ""bbb"""',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"""aaa"""',
+ 9 => '"""""",""""""',
+ 10 => '"""""""""""""",',
+ 11 => '"""""""""""",aaa',
+ 12 => 'aaa,"bbb "',
+ 13 => 'aaa,"""bbb """',
+ 14 => '"aaa""aaa""","""bbb""bbb"',
+ 15 => '"aaa""aaa""""""",bbb',
+ 16 => 'aaa,"""/"bbb",ccc',
+ 17 => '"aaa""/"a""","""bbb"""',
+ 18 => '"""/"""","""aaa"""',
+ 19 => '"""/"""""",aaa',
+);
+$list = array (
+ 0 => 'aaa,bbb',
+ 1 => 'aaa,"bbb"',
+ 2 => '"aaa","bbb"',
+ 3 => 'aaa,bbb',
+ 4 => '"aaa",bbb',
+ 5 => '"aaa", "bbb"',
+ 6 => ',',
+ 7 => 'aaa,',
+ 8 => ',"aaa"',
+ 9 => '"",""',
+ 10 => '"""""",',
+ 11 => '""""",aaa',
+ 12 => 'aaa,bbb ',
+ 13 => 'aaa,"bbb "',
+ 14 => 'aaa"aaa","bbb"bbb',
+ 15 => 'aaa"aaa""",bbb',
+ 16 => 'aaa,"/"bbb,ccc',
+ 17 => 'aaa"/"a","bbb"',
+ 18 => '"/"","aaa"',
+ 19 => '"/""",aaa',
+);
+===DONE===
diff --git a/ext/standard/tests/file/glob_variation3.phpt b/ext/standard/tests/file/glob_variation3.phpt
new file mode 100644
index 000000000..9e1e28baf
--- /dev/null
+++ b/ext/standard/tests/file/glob_variation3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test glob() function: ensure no platform difference
+--FILE--
+<?php
+$path = dirname(__FILE__);
+
+ini_set('open_basedir', NULL);
+var_dump(glob("$path/*.none"));
+
+ini_set('open_basedir', $path);
+var_dump(glob("$path/*.none"));
+
+?>
+==DONE==
+--EXPECT--
+array(0) {
+}
+bool(false)
+==DONE==
diff --git a/ext/standard/tests/serialize/bug65481.phpt b/ext/standard/tests/serialize/bug65481.phpt
new file mode 100644
index 000000000..65634f63b
--- /dev/null
+++ b/ext/standard/tests/serialize/bug65481.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #65481 (shutdown segfault due to serialize)
+--FILE--
+<?php
+echo "Test\n";
+
+class A {
+ public $e = array();
+}
+
+class Token implements \Serializable {
+ public function serialize()
+ {
+ $c = new A;
+
+ for ($i = 0; $i < 4; $i++)
+ {
+ $e = new A;
+ $c->e[] = $e;
+ $e->e = $c->e;
+ }
+
+ return serialize(array(serialize($c)));
+ }
+
+ public function unserialize($str)
+ {
+ $r = unserialize($str);
+ $r = unserialize($r[0]);
+ }
+}
+
+$token = new Token;
+$token = serialize($token);
+
+?>
+Done
+--EXPECT--
+Test
+Done
diff --git a/ext/standard/tests/streams/bug65483.phpt b/ext/standard/tests/streams/bug65483.phpt
new file mode 100644
index 000000000..d214bbbbc
--- /dev/null
+++ b/ext/standard/tests/streams/bug65483.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #65483: quoted-printable encode stream filter incorrectly encoding spaces
+--FILE--
+<?php
+
+$data = 'a b=c d';
+
+$fd = fopen('php://temp', 'w+');
+fwrite($fd, $data);
+rewind($fd);
+
+$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ);
+var_dump(stream_get_contents($fd, -1, 0));
+
+fclose($fd);
+
+?>
+--EXPECT--
+string(9) "a b=3Dc d"
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 2e8b6f62b..2d2f92094 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -25,6 +25,7 @@
/* {{{ reference-handling for unserializer: var_* */
#define VAR_ENTRIES_MAX 1024
+#define VAR_ENTRIES_DBG 0
typedef struct {
zval *data[VAR_ENTRIES_MAX];
@@ -35,7 +36,7 @@ typedef struct {
static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -59,7 +60,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last_dtor;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -81,11 +82,35 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
var_hash->data[var_hash->used_slots++] = *rval;
}
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
+{
+ var_entries *var_hash = (*var_hashx)->last_dtor;
+#if VAR_ENTRIES_DBG
+ fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
+#endif
+
+ if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
+ var_hash = emalloc(sizeof(var_entries));
+ var_hash->used_slots = 0;
+ var_hash->next = 0;
+
+ if (!(*var_hashx)->first_dtor) {
+ (*var_hashx)->first_dtor = var_hash;
+ } else {
+ ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash;
+ }
+
+ (*var_hashx)->last_dtor = var_hash;
+ }
+
+ var_hash->data[var_hash->used_slots++] = *rval;
+}
+
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
{
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
#endif
@@ -103,7 +128,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
{
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
#endif
@@ -126,7 +151,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
void *next;
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
#endif
@@ -617,9 +642,9 @@ yy20:
do {
/* Try to find class directly */
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
return 0;
@@ -627,7 +652,7 @@ yy20:
ce = *pce;
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
@@ -647,9 +672,9 @@ yy20:
args[0] = &arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
zval_ptr_dtor(&user_func);
@@ -663,7 +688,7 @@ yy20:
zval_ptr_dtor(&arg_func_name);
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -691,7 +716,9 @@ yy20:
*p = YYCURSOR;
if (custom_object) {
- int ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
+ int ret;
+
+ ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
php_store_class_name(*rval, class_name, len2);
@@ -1151,7 +1178,7 @@ yy91:
if (*rval == *rval_ref) return 0;
if (*rval != NULL) {
- zval_ptr_dtor(rval);
+ var_push_dtor_no_addref(var_hash, rval);
}
*rval = *rval_ref;
Z_ADDREF_PP(rval);
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 4d99cbfd7..76c501e1b 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -24,6 +24,7 @@
/* {{{ reference-handling for unserializer: var_* */
#define VAR_ENTRIES_MAX 1024
+#define VAR_ENTRIES_DBG 0
typedef struct {
zval *data[VAR_ENTRIES_MAX];
@@ -34,7 +35,7 @@ typedef struct {
static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -58,7 +59,7 @@ static inline void var_push(php_unserialize_data_t *var_hashx, zval **rval)
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash = (*var_hashx)->last_dtor;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval));
#endif
@@ -80,11 +81,35 @@ PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval)
var_hash->data[var_hash->used_slots++] = *rval;
}
+PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval)
+{
+ var_entries *var_hash = (*var_hashx)->last_dtor;
+#if VAR_ENTRIES_DBG
+ fprintf(stderr, "var_push_dtor_no_addref(%ld): %d (%d)\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_PP(rval));
+#endif
+
+ if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) {
+ var_hash = emalloc(sizeof(var_entries));
+ var_hash->used_slots = 0;
+ var_hash->next = 0;
+
+ if (!(*var_hashx)->first_dtor) {
+ (*var_hashx)->first_dtor = var_hash;
+ } else {
+ ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash;
+ }
+
+ (*var_hashx)->last_dtor = var_hash;
+ }
+
+ var_hash->data[var_hash->used_slots++] = *rval;
+}
+
PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval)
{
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval));
#endif
@@ -102,7 +127,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **n
static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store)
{
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_access(%ld): %ld\n", var_hash?var_hash->used_slots:-1L, id);
#endif
@@ -125,7 +150,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
void *next;
long i;
var_entries *var_hash = (*var_hashx)->first;
-#if 0
+#if VAR_ENTRIES_DBG
fprintf(stderr, "var_destroy(%ld)\n", var_hash?var_hash->used_slots:-1L);
#endif
@@ -472,7 +497,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
if (*rval == *rval_ref) return 0;
if (*rval != NULL) {
- zval_ptr_dtor(rval);
+ var_push_dtor_no_addref(var_hash, rval);
}
*rval = *rval_ref;
Z_ADDREF_PP(rval);
@@ -683,9 +708,9 @@ object ":" uiv ":" ["] {
do {
/* Try to find class directly */
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (zend_lookup_class(class_name, len2, &pce TSRMLS_CC) == SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
return 0;
@@ -693,7 +718,7 @@ object ":" uiv ":" ["] {
ce = *pce;
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
@@ -713,9 +738,9 @@ object ":" uiv ":" ["] {
args[0] = &arg_func_name;
MAKE_STD_ZVAL(arg_func_name);
ZVAL_STRING(arg_func_name, class_name, 1);
- BG(serialize_lock) = 1;
+ BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, user_func, &retval_ptr, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (EG(exception)) {
efree(class_name);
zval_ptr_dtor(&user_func);
@@ -729,7 +754,7 @@ object ":" uiv ":" ["] {
zval_ptr_dtor(&arg_func_name);
break;
}
- BG(serialize_lock) = 0;
+ BG(serialize_lock)--;
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -757,7 +782,9 @@ object ":" uiv ":" ["] {
*p = YYCURSOR;
if (custom_object) {
- int ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
+ int ret;
+
+ ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
php_store_class_name(*rval, class_name, len2);
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index fbebb635e..a4c66d259 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -39,7 +39,7 @@ _qualify_namespace(XML_Parser parser, const xmlChar *name, const xmlChar *URI, x
if (URI) {
/* Use libxml functions otherwise its memory deallocation is screwed up */
*qualified = xmlStrdup(URI);
- *qualified = xmlStrncat(*qualified, parser->_ns_seperator, 1);
+ *qualified = xmlStrncat(*qualified, parser->_ns_separator, 1);
*qualified = xmlStrncat(*qualified, name, xmlStrlen(name));
} else {
*qualified = xmlStrdup(name);
@@ -469,7 +469,7 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *m
parser = (XML_Parser) emalloc(sizeof(struct _XML_Parser));
memset(parser, 0, sizeof(struct _XML_Parser));
parser->use_namespace = 0;
- parser->_ns_seperator = NULL;
+ parser->_ns_separator = NULL;
parser->parser = xmlCreatePushParserCtxt((xmlSAXHandlerPtr) &php_xml_compat_handlers, (void *) parser, NULL, 0, NULL);
if (parser->parser == NULL) {
@@ -491,7 +491,7 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *m
if (sep != NULL) {
parser->use_namespace = 1;
parser->parser->sax2 = 1;
- parser->_ns_seperator = xmlStrdup(sep);
+ parser->_ns_separator = xmlStrdup(sep);
} else {
/* Reset flag as XML_SAX2_MAGIC is needed for xmlCreatePushParserCtxt
so must be set in the handlers */
@@ -619,109 +619,109 @@ XML_GetErrorCode(XML_Parser parser)
}
static const XML_Char *const error_mapping[] = {
- "No error",
- "No memory",
- "Invalid document start",
- "Empty document",
- "Not well-formed (invalid token)",
- "Invalid document end",
- "Invalid hexadecimal character reference",
- "Invalid decimal character reference",
- "Invalid character reference",
- "Invalid character",
- "XML_ERR_CHARREF_AT_EOF",
- "XML_ERR_CHARREF_IN_PROLOG",
- "XML_ERR_CHARREF_IN_EPILOG",
- "XML_ERR_CHARREF_IN_DTD",
- "XML_ERR_ENTITYREF_AT_EOF",
- "XML_ERR_ENTITYREF_IN_PROLOG",
- "XML_ERR_ENTITYREF_IN_EPILOG",
- "XML_ERR_ENTITYREF_IN_DTD",
- "PEReference at end of document",
- "PEReference in prolog",
- "PEReference in epilog",
- "PEReference: forbidden within markup decl in internal subset",
- "XML_ERR_ENTITYREF_NO_NAME",
- "EntityRef: expecting ';'",
- "PEReference: no name",
- "PEReference: expecting ';'",
- "Undeclared entity error",
- "Undeclared entity warning",
- "Unparsed Entity",
- "XML_ERR_ENTITY_IS_EXTERNAL",
- "XML_ERR_ENTITY_IS_PARAMETER",
- "Unknown encoding",
- "Unsupported encoding",
- "String not started expecting ' or \"",
- "String not closed expecting \" or '",
- "Namespace declaration error",
- "EntityValue: \" or ' expected",
- "EntityValue: \" or ' expected",
- "< in attribute",
- "Attribute not started",
- "Attribute not finished",
- "Attribute without value",
- "Attribute redefined",
- "SystemLiteral \" or ' expected",
- "SystemLiteral \" or ' expected",
- /* "XML_ERR_COMMENT_NOT_STARTED", <= eliminated on purpose */
- "Comment not finished",
- "Processing Instruction not started",
- "Processing Instruction not finished",
- "NOTATION: Name expected here",
- "'>' required to close NOTATION declaration",
- "'(' required to start ATTLIST enumeration",
- "'(' required to start ATTLIST enumeration",
- "MixedContentDecl : '|' or ')*' expected",
- "XML_ERR_MIXED_NOT_FINISHED",
- "ELEMENT in DTD not started",
- "ELEMENT in DTD not finished",
- "XML declaration not started",
- "XML declaration not finished",
- "XML_ERR_CONDSEC_NOT_STARTED",
- "XML conditional section not closed",
- "Content error in the external subset",
- "DOCTYPE not finished",
- "Sequence ']]>' not allowed in content",
- "CDATA not finished",
- "Reserved XML Name",
- "Space required",
- "XML_ERR_SEPARATOR_REQUIRED",
- "NmToken expected in ATTLIST enumeration",
- "XML_ERR_NAME_REQUIRED",
- "MixedContentDecl : '#PCDATA' expected",
- "SYSTEM or PUBLIC, the URI is missing",
- "PUBLIC, the Public Identifier is missing",
- "< required",
- "> required",
- "</ required",
- "= required",
- "Mismatched tag",
- "Tag not finished",
- "standalone accepts only 'yes' or 'no'",
- "Invalid XML encoding name",
- "Comment must not contain '--' (double-hyphen)",
- "Invalid encoding",
- "external parsed entities cannot be standalone",
- "XML conditional section '[' expected",
- "Entity value required",
- "chunk is not well balanced",
- "extra content at the end of well balanced chunk",
- "XML_ERR_ENTITY_CHAR_ERROR",
- "PEReferences forbidden in internal subset",
- "Detected an entity reference loop",
- "XML_ERR_ENTITY_BOUNDARY",
- "Invalid URI",
- "Fragment not allowed",
- "XML_WAR_CATALOG_PI",
- "XML_ERR_NO_DTD",
- "conditional section INCLUDE or IGNORE keyword expected", /* 95 */
- "Version in XML Declaration missing", /* 96 */
- "XML_WAR_UNKNOWN_VERSION", /* 97 */
- "XML_WAR_LANG_VALUE", /* 98 */
- "XML_WAR_NS_URI", /* 99 */
- "XML_WAR_NS_URI_RELATIVE", /* 100 */
- "Missing encoding in text declaration" /* 101 */
+ (const XML_Char *)"No error",
+ (const XML_Char *)"No memory",
+ (const XML_Char *)"Invalid document start",
+ (const XML_Char *)"Empty document",
+ (const XML_Char *)"Not well-formed (invalid token)",
+ (const XML_Char *)"Invalid document end",
+ (const XML_Char *)"Invalid hexadecimal character reference",
+ (const XML_Char *)"Invalid decimal character reference",
+ (const XML_Char *)"Invalid character reference",
+ (const XML_Char *)"Invalid character",
+ (const XML_Char *)"XML_ERR_CHARREF_AT_EOF",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_PROLOG",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_EPILOG",
+ (const XML_Char *)"XML_ERR_CHARREF_IN_DTD",
+ (const XML_Char *)"XML_ERR_ENTITYREF_AT_EOF",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_PROLOG",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_EPILOG",
+ (const XML_Char *)"XML_ERR_ENTITYREF_IN_DTD",
+ (const XML_Char *)"PEReference at end of document",
+ (const XML_Char *)"PEReference in prolog",
+ (const XML_Char *)"PEReference in epilog",
+ (const XML_Char *)"PEReference: forbidden within markup decl in internal subset",
+ (const XML_Char *)"XML_ERR_ENTITYREF_NO_NAME",
+ (const XML_Char *)"EntityRef: expecting ';'",
+ (const XML_Char *)"PEReference: no name",
+ (const XML_Char *)"PEReference: expecting ';'",
+ (const XML_Char *)"Undeclared entity error",
+ (const XML_Char *)"Undeclared entity warning",
+ (const XML_Char *)"Unparsed Entity",
+ (const XML_Char *)"XML_ERR_ENTITY_IS_EXTERNAL",
+ (const XML_Char *)"XML_ERR_ENTITY_IS_PARAMETER",
+ (const XML_Char *)"Unknown encoding",
+ (const XML_Char *)"Unsupported encoding",
+ (const XML_Char *)"String not started expecting ' or \"",
+ (const XML_Char *)"String not closed expecting \" or '",
+ (const XML_Char *)"Namespace declaration error",
+ (const XML_Char *)"EntityValue: \" or ' expected",
+ (const XML_Char *)"EntityValue: \" or ' expected",
+ (const XML_Char *)"< in attribute",
+ (const XML_Char *)"Attribute not started",
+ (const XML_Char *)"Attribute not finished",
+ (const XML_Char *)"Attribute without value",
+ (const XML_Char *)"Attribute redefined",
+ (const XML_Char *)"SystemLiteral \" or ' expected",
+ (const XML_Char *)"SystemLiteral \" or ' expected",
+ /* (const XML_Char *)"XML_ERR_COMMENT_NOT_STARTED", <= eliminated on purpose */
+ (const XML_Char *)"Comment not finished",
+ (const XML_Char *)"Processing Instruction not started",
+ (const XML_Char *)"Processing Instruction not finished",
+ (const XML_Char *)"NOTATION: Name expected here",
+ (const XML_Char *)"'>' required to close NOTATION declaration",
+ (const XML_Char *)"'(' required to start ATTLIST enumeration",
+ (const XML_Char *)"'(' required to start ATTLIST enumeration",
+ (const XML_Char *)"MixedContentDecl : '|' or ')*' expected",
+ (const XML_Char *)"XML_ERR_MIXED_NOT_FINISHED",
+ (const XML_Char *)"ELEMENT in DTD not started",
+ (const XML_Char *)"ELEMENT in DTD not finished",
+ (const XML_Char *)"XML declaration not started",
+ (const XML_Char *)"XML declaration not finished",
+ (const XML_Char *)"XML_ERR_CONDSEC_NOT_STARTED",
+ (const XML_Char *)"XML conditional section not closed",
+ (const XML_Char *)"Content error in the external subset",
+ (const XML_Char *)"DOCTYPE not finished",
+ (const XML_Char *)"Sequence ']]>' not allowed in content",
+ (const XML_Char *)"CDATA not finished",
+ (const XML_Char *)"Reserved XML Name",
+ (const XML_Char *)"Space required",
+ (const XML_Char *)"XML_ERR_SEPARATOR_REQUIRED",
+ (const XML_Char *)"NmToken expected in ATTLIST enumeration",
+ (const XML_Char *)"XML_ERR_NAME_REQUIRED",
+ (const XML_Char *)"MixedContentDecl : '#PCDATA' expected",
+ (const XML_Char *)"SYSTEM or PUBLIC, the URI is missing",
+ (const XML_Char *)"PUBLIC, the Public Identifier is missing",
+ (const XML_Char *)"< required",
+ (const XML_Char *)"> required",
+ (const XML_Char *)"</ required",
+ (const XML_Char *)"= required",
+ (const XML_Char *)"Mismatched tag",
+ (const XML_Char *)"Tag not finished",
+ (const XML_Char *)"standalone accepts only 'yes' or 'no'",
+ (const XML_Char *)"Invalid XML encoding name",
+ (const XML_Char *)"Comment must not contain '--' (double-hyphen)",
+ (const XML_Char *)"Invalid encoding",
+ (const XML_Char *)"external parsed entities cannot be standalone",
+ (const XML_Char *)"XML conditional section '[' expected",
+ (const XML_Char *)"Entity value required",
+ (const XML_Char *)"chunk is not well balanced",
+ (const XML_Char *)"extra content at the end of well balanced chunk",
+ (const XML_Char *)"XML_ERR_ENTITY_CHAR_ERROR",
+ (const XML_Char *)"PEReferences forbidden in internal subset",
+ (const XML_Char *)"Detected an entity reference loop",
+ (const XML_Char *)"XML_ERR_ENTITY_BOUNDARY",
+ (const XML_Char *)"Invalid URI",
+ (const XML_Char *)"Fragment not allowed",
+ (const XML_Char *)"XML_WAR_CATALOG_PI",
+ (const XML_Char *)"XML_ERR_NO_DTD",
+ (const XML_Char *)"conditional section INCLUDE or IGNORE keyword expected", /* 95 */
+ (const XML_Char *)"Version in XML Declaration missing", /* 96 */
+ (const XML_Char *)"XML_WAR_UNKNOWN_VERSION", /* 97 */
+ (const XML_Char *)"XML_WAR_LANG_VALUE", /* 98 */
+ (const XML_Char *)"XML_WAR_NS_URI", /* 99 */
+ (const XML_Char *)"XML_WAR_NS_URI_RELATIVE", /* 100 */
+ (const XML_Char *)"Missing encoding in text declaration" /* 101 */
};
PHPAPI const XML_Char *
@@ -770,8 +770,8 @@ PHPAPI void
XML_ParserFree(XML_Parser parser)
{
if (parser->use_namespace) {
- if (parser->_ns_seperator) {
- xmlFree(parser->_ns_seperator);
+ if (parser->_ns_separator) {
+ xmlFree(parser->_ns_separator);
}
}
if (parser->parser->myDoc) {
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index 424785f56..1c94e45fd 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -38,6 +38,9 @@
#include <libxml/tree.h>
#include <libxml/hash.h>
+/* For compatibility with the misspelled version. */
+#define _ns_seperator _ns_separator
+
typedef xmlChar XML_Char;
typedef void (*XML_StartElementHandler)(void *, const XML_Char *, const XML_Char **);
@@ -61,7 +64,7 @@ typedef struct _XML_Memory_Handling_Suite {
typedef struct _XML_Parser {
int use_namespace;
- xmlChar *_ns_seperator;
+ xmlChar *_ns_separator;
void *user;
xmlParserCtxtPtr parser;
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 334938ab2..1ef01c886 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -274,10 +274,10 @@ zend_module_entry xml_module_entry = {
* the encoding is currently done internally by expat/xmltok.
*/
xml_encoding xml_encodings[] = {
- { "ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
- { "US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
- { "UTF-8", NULL, NULL },
- { NULL, NULL, NULL }
+ { (XML_Char *)"ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
+ { (XML_Char *)"US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
+ { (XML_Char *)"UTF-8", NULL, NULL },
+ { (XML_Char *)NULL, NULL, NULL }
};
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
diff --git a/ext/xmlrpc/tests/003.phpt b/ext/xmlrpc/tests/003.phpt
new file mode 100644
index 000000000..3d6796dba
--- /dev/null
+++ b/ext/xmlrpc/tests/003.phpt
@@ -0,0 +1,109 @@
+--TEST--
+xmlrpc_encode() Simple test encode array
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+$params = array(
+ "one" => "red",
+ "two" => "blue",
+ "three" => "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+$params = array(
+ "red",
+ "blue",
+ "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+$params = array(
+ 0 => "red",
+ 1 => "blue",
+ 3 => "green"
+);
+
+$response = xmlrpc_encode($params);
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <struct>
+ <member>
+ <name>one</name>
+ <value>
+ <string>red</string>
+ </value>
+ </member>
+ <member>
+ <name>two</name>
+ <value>
+ <string>blue</string>
+ </value>
+ </member>
+ <member>
+ <name>three</name>
+ <value>
+ <string>green</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <array>
+ <data>
+ <value>
+ <string>red</string>
+ </value>
+ <value>
+ <string>blue</string>
+ </value>
+ <value>
+ <string>green</string>
+ </value>
+ </data>
+ </array>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <struct>
+ <member>
+ <name>0</name>
+ <value>
+ <string>red</string>
+ </value>
+ </member>
+ <member>
+ <name>1</name>
+ <value>
+ <string>blue</string>
+ </value>
+ </member>
+ <member>
+ <name>3</name>
+ <value>
+ <string>green</string>
+ </value>
+ </member>
+ </struct>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/004.phpt b/ext/xmlrpc/tests/004.phpt
new file mode 100644
index 000000000..04f3ef315
--- /dev/null
+++ b/ext/xmlrpc/tests/004.phpt
@@ -0,0 +1,19 @@
+--TEST--
+xmlrpc_encode() Simple test encode int
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+--FILE--
+<?php
+
+$response = xmlrpc_encode(1);
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <int>1</int>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/005.phpt b/ext/xmlrpc/tests/005.phpt
new file mode 100644
index 000000000..613dfde24
--- /dev/null
+++ b/ext/xmlrpc/tests/005.phpt
@@ -0,0 +1,47 @@
+--TEST--
+xmlrpc_encode() Simple test encode type double and String
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$response = xmlrpc_encode(3.24234);
+echo $response;
+
+$response = xmlrpc_encode(-3.24234);
+echo $response;
+
+$response = xmlrpc_encode('Is string');
+echo $response;
+
+--EXPECT--
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <double>3.24234</double>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <double>-3.24234</double>
+ </value>
+</param>
+</params>
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <string>Is string</string>
+ </value>
+</param>
+</params> \ No newline at end of file
diff --git a/ext/xmlrpc/tests/006.phpt b/ext/xmlrpc/tests/006.phpt
new file mode 100644
index 000000000..f33932d5a
--- /dev/null
+++ b/ext/xmlrpc/tests/006.phpt
@@ -0,0 +1,29 @@
+--TEST--
+xmlrpc_decode() Simple test decode type string
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <string>Is string</string>
+ </value>
+</param>
+</params>
+XML;
+
+$response = xmlrpc_decode($xml);
+echo $response;
+
+--EXPECT--
+Is string \ No newline at end of file
diff --git a/ext/xmlrpc/tests/007.phpt b/ext/xmlrpc/tests/007.phpt
new file mode 100644
index 000000000..84c15a7d8
--- /dev/null
+++ b/ext/xmlrpc/tests/007.phpt
@@ -0,0 +1,29 @@
+--TEST--
+xmlrpc_decode() Simple test decode type int
+
+--CREDITS--
+Michel Araujo <araujo_michel@yahoo.com.br>
+#PHPSP 2013-08-22
+
+--SKIPIF--
+<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
+
+--FILE--
+<?php
+
+$xml = <<<XML
+<?xml version="1.0" encoding="utf-8"?>
+<params>
+<param>
+ <value>
+ <int>1</int>
+ </value>
+</param>
+</params>
+XML;
+
+$response = xmlrpc_decode($xml);
+echo $response;
+
+--EXPECT--
+1 \ No newline at end of file