Fixed issue #63
authorMichael Wallner <mike@php.net>
Tue, 4 Apr 2017 11:35:18 +0000 (13:35 +0200)
committerMichael Wallner <mike@php.net>
Mon, 3 Jul 2017 07:55:25 +0000 (09:55 +0200)
Use urldecode instead of raw_urldecode in http_params

src/php_http_params.c
tests/gh-issue63.phpt [new file with mode: 0644]

index 92cc558962af525355cfa0fc32672dd858e8e3a5..3ec71b1ddfd83f0d0b9465a26340dc6af903520c 100644 (file)
@@ -118,7 +118,7 @@ static inline void prepare_escaped(zval *zv)
 
 static inline void sanitize_urlencoded(zval *zv)
 {
-       Z_STRLEN_P(zv) = php_raw_url_decode(Z_STRVAL_P(zv), Z_STRLEN_P(zv));
+       Z_STRLEN_P(zv) = php_url_decode(Z_STRVAL_P(zv), Z_STRLEN_P(zv));
 }
 
 static inline void prepare_urlencoded(zval *zv)
diff --git a/tests/gh-issue63.phpt b/tests/gh-issue63.phpt
new file mode 100644 (file)
index 0000000..e03b32f
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+segfault with Client::setDebug and Client::dequeue()
+--SKIPIF--
+<?php
+include "skipif.inc";
+skip_client_test();
+skip_online_test();
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+use http\QueryString;
+use http\Url;
+
+$url = 'http://example.com/?param=has+spaces';
+$query = ['foo' => 'bar'];
+$parts['query'] = new QueryString($query);
+echo (new Url($url, null, Url::STDFLAGS))->mod($parts)->toString();
+
+?>
+
+===DONE===
+--EXPECTF--
+Test
+http://example.com/?param=has%20spaces&foo=bar
+===DONE===