From a990ce69b1d5b80629765326b61939800ffe7930 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Mon, 13 Dec 2010 09:52:05 +0000 Subject: [PATCH] Fixed bug #53493 (xmlrpc_decode should not be sensitive to leading whitespace) --- NEWS | 4 ++++ ext/xmlrpc/tests/bug53493.phpt | 15 +++++++++++++++ ext/xmlrpc/xmlrpc-epi-php.c | 6 +++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 ext/xmlrpc/tests/bug53493.phpt diff --git a/NEWS b/NEWS index 25b2702bf3..d911872eab 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,10 @@ - Streams: . Implemented FR #26158 (open arbitrary file descriptor with fopen). (Gustavo) +- XMLRPC-EPI: + . Fixed bug #53493 (xmlrpc_decode should not be sensitive to leading + whitespace). (Kalle) + 09 Dec 2010, PHP 5.3.4 - Upgraded bundled Sqlite3 to version 3.7.3. (Ilia) - Upgraded bundled PCRE to version 8.10. (Ilia) diff --git a/ext/xmlrpc/tests/bug53493.phpt b/ext/xmlrpc/tests/bug53493.phpt new file mode 100644 index 0000000000..29309241f8 --- /dev/null +++ b/ext/xmlrpc/tests/bug53493.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #53493 (xmlrpc_decode should not be sensitive to leading whitespace) +--FILE-- +' . + 'Hello World' . + ''; + +var_dump(xmlrpc_decode($req)); +echo "Done\n"; +?> +--EXPECT-- +string(11) "Hello World" +Done diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 823b8eb3a2..8c0ec6c86f 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -67,6 +67,7 @@ #include "php.h" #include "ext/standard/info.h" +#include "ext/standard/php_string.h" #include "ext/date/php_date.h" #include "php_ini.h" #include "php_xmlrpc.h" @@ -844,7 +845,10 @@ PHP_FUNCTION(xmlrpc_decode) } if (return_value_used) { - zval* retval = decode_request_worker(arg1, arg1_len, arg2_len ? arg2 : NULL, NULL); + zval* retval; + char *trimmed = php_trim(arg1, arg1_len, NULL, 0, NULL, 1 TSRMLS_CC); + + retval = decode_request_worker(trimmed, strlen(trimmed), arg2_len ? arg2 : NULL, NULL); if (retval) { *return_value = *retval; FREE_ZVAL(retval); -- 2.40.0