diff options
| author | Sean Finney <seanius@debian.org> | 2009-06-24 22:49:04 +0200 |
|---|---|---|
| committer | Sean Finney <seanius@debian.org> | 2009-06-24 22:49:04 +0200 |
| commit | 84f4ca9b07fe5b73d840258f4aa7c1eb534c4253 (patch) | |
| tree | 9829bd578af8a4a8b42b04277f9067e00dc5ad90 /ext/xmlrpc | |
| parent | 6821b67124604da690c5e9276d5370d679c63ac8 (diff) | |
| download | php-84f4ca9b07fe5b73d840258f4aa7c1eb534c4253.tar.gz | |
Imported Upstream version 5.3.0~RC4upstream/5.3.0_RC4upstream/5.3.0.RC4
Diffstat (limited to 'ext/xmlrpc')
| -rw-r--r-- | ext/xmlrpc/config.m4 | 24 | ||||
| -rw-r--r-- | ext/xmlrpc/tests/bug44996.phpt | 49 | ||||
| -rw-r--r-- | ext/xmlrpc/tests/bug47818.phpt | 39 | ||||
| -rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 11 |
4 files changed, 108 insertions, 15 deletions
diff --git a/ext/xmlrpc/config.m4 b/ext/xmlrpc/config.m4 index 4df321926..e7b4c34b8 100644 --- a/ext/xmlrpc/config.m4 +++ b/ext/xmlrpc/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.25.2.3 2005/11/29 18:26:02 tony2001 Exp $ +dnl $Id: config.m4,v 1.25.2.3.4.1 2009/04/27 17:49:32 scottmac Exp $ dnl sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4) @@ -61,17 +61,21 @@ if test "$PHP_XMLRPC" != "no"; then fi fi - if test "$PHP_ICONV_DIR" != "no"; then - PHP_ICONV=$PHP_ICONV_DIR - fi + dnl if iconv is shared or missing then we should build iconv ourselves + if test "$PHP_ICONV_SHARED" = "yes" || test "$PHP_ICONV" = "no"; then + + if test "$PHP_ICONV_DIR" != "no"; then + PHP_ICONV=$PHP_ICONV_DIR + fi - if test -z "$PHP_ICONV" || test "$PHP_ICONV" = "no"; then - PHP_ICONV=yes - fi + if test -z "$PHP_ICONV" || test "$PHP_ICONV" = "no"; then + PHP_ICONV=yes + fi - PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [ - AC_MSG_ERROR([iconv not found, in order to build xmlrpc you need the iconv library]) - ]) + PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [ + AC_MSG_ERROR([iconv not found, in order to build xmlrpc you need the iconv library]) + ]) + fi fi if test "$PHP_XMLRPC" = "yes"; then diff --git a/ext/xmlrpc/tests/bug44996.phpt b/ext/xmlrpc/tests/bug44996.phpt new file mode 100644 index 000000000..dc1bc5d4f --- /dev/null +++ b/ext/xmlrpc/tests/bug44996.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #44996 (xmlrpc_decode() ignores time zone on iso8601.datetime) +--FILE-- +<?php + +function DecodeDatetime($datetime) { + print "\nISO 8601 datetime $datetime\n"; + $obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>"); + print_r($obj); +} + +DecodeDatetime("20010909T01:46:40Z"); +DecodeDatetime("20010909T00:46:40-01"); +DecodeDatetime("2001-09-09T08:46:40+07:00"); +DecodeDatetime("2001-09-08T21:46:40-0400"); + +?> +--EXPECT-- +ISO 8601 datetime 20010909T01:46:40Z +stdClass Object +( + [scalar] => 20010909T01:46:40Z + [xmlrpc_type] => datetime + [timestamp] => 1000000000 +) + +ISO 8601 datetime 20010909T00:46:40-01 +stdClass Object +( + [scalar] => 20010909T00:46:40-01 + [xmlrpc_type] => datetime + [timestamp] => 1000000000 +) + +ISO 8601 datetime 2001-09-09T08:46:40+07:00 +stdClass Object +( + [scalar] => 2001-09-09T08:46:40+07:00 + [xmlrpc_type] => datetime + [timestamp] => 1000000000 +) + +ISO 8601 datetime 2001-09-08T21:46:40-0400 +stdClass Object +( + [scalar] => 2001-09-08T21:46:40-0400 + [xmlrpc_type] => datetime + [timestamp] => 1000000000 +) diff --git a/ext/xmlrpc/tests/bug47818.phpt b/ext/xmlrpc/tests/bug47818.phpt new file mode 100644 index 000000000..57e109030 --- /dev/null +++ b/ext/xmlrpc/tests/bug47818.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #47818 (Segfault due to bound callback param) +--FILE-- +<?php + +class MyXmlRpc { + private $s; + private $method; + + function impl($method_name, $params, $user_data){ + $this->method = $method_name; + print "Inside impl(): {$this->method}\n"; + return array_sum($params); + } + + function __construct() { + $this->s = xmlrpc_server_create(); + xmlrpc_server_register_method($this->s, 'add', array($this, 'impl')); + } + + function call($req) { + return xmlrpc_server_call_method($this->s, $req, null); + } + + function getMethod() {return $this->method;} + +} + +$x = new MyXmlRpc; +$resp = $x->call(xmlrpc_encode_request('add', array(1, 2, 3))); + +$method = $x->getMethod(); + +print "Global scope: $method\n"; + +?> +--EXPECTF-- +Inside impl(): add +Global scope: add diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 1cd296fb1..b45e27401 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -51,7 +51,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.6.2.19 2009/03/19 00:18:48 iliaa Exp $ */ +/* $Id: xmlrpc-epi-php.c,v 1.39.2.5.2.6.2.23 2009/05/22 12:49:40 felipe Exp $ */ /********************************************************************** * BUGS: * @@ -67,6 +67,7 @@ #include "php.h" #include "ext/standard/info.h" +#include "ext/date/php_date.h" #include "php_ini.h" #include "php_xmlrpc.h" #include "xmlrpc.h" @@ -1157,8 +1158,8 @@ PHP_FUNCTION(xmlrpc_server_call_method) } /* cleanup after ourselves. what a sty! */ - zval_dtor(data.xmlrpc_method); - FREE_ZVAL(data.xmlrpc_method); + zval_ptr_dtor(&data.xmlrpc_method); + zval_dtor(data.return_data); FREE_ZVAL(data.return_data); @@ -1344,8 +1345,8 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ if (newtype == xmlrpc_datetime) { XMLRPC_VALUE v = XMLRPC_CreateValueDateTime_ISO8601(NULL, value->value.str.val); if (v) { - time_t timestamp = XMLRPC_GetValueDateTime(v); - if (timestamp) { + time_t timestamp = (time_t) php_parse_date((char *)XMLRPC_GetValueDateTime_ISO8601(v), NULL); + if (timestamp != -1) { zval* ztimestamp; MAKE_STD_ZVAL(ztimestamp); |
