Commit 514218b0 authored by Andy Postnikov's avatar Andy Postnikov
Browse files

testing/php82: add patch for parse_url()

parent b13ff694
Pipeline #137681 passed with stage
in 51 minutes and 50 seconds
......@@ -27,7 +27,7 @@ pkgname=php82
_pkgreal=php
pkgver=8.2.0_rc2
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgrel=1
_apiver=20220829
_suffix=${pkgname#php}
# Is this package the default (latest) PHP version?
......@@ -111,6 +111,7 @@ source="https://downloads.php.net/~sergey/$_pkgreal-$_pkgver.tar.xz
atomic-lsapi.patch
fix-socket-tests.patch
phpinfo-avif.patch
fix-parseurl.patch
"
builddir="$srcdir/$_pkgreal-$_pkgver"
......@@ -647,4 +648,5 @@ d90e839cfae1cbb42c1dfb0fb73defa55154dbef69bc9a8206e561c2d0ceb43ca778e35dcfa32245
465b38c089d938a4a072b2eff3edaf928455bf873f5eeb65ff3bee9614f5f45c70f285abb50809c2e2d9d259395acae38bd649860ca3b8d65e43447082a51552 atomic-lsapi.patch
34aaa0dddbb5aefac283ecc1dc542e63789adb5e517bd329ca1dcc82df11b0f7c983e208a5d657419b219b31a4aa357468ce39dd984eb0be38a41919f174e27f fix-socket-tests.patch
8833c5c6f5225f5e85a9cd842274e4e6b2f55dc572a13bdb3066c624f82c9f39fa07cb2f8f242092ff814f61f0cb8abaa792b1f93c16ad341f1a8dec05a6ca2d phpinfo-avif.patch
e812f9069b3cec534b36a72cde30f9f328cb253321c23e848dc5c0d82ccf6a78bbe30b707b4d44a9d79a777646ebe46ead094268d6540555316a7b8c008ced3a fix-parseurl.patch
"
Patch-Source: https://github.com/php/php-src/commit/2108d6983f4343a25a6ba0ce758fe938e6c7c99f
From 2108d6983f4343a25a6ba0ce758fe938e6c7c99f Mon Sep 17 00:00:00 2001
From: Andy Postnikov <apostnikov@gmail.com>
Date: Sat, 17 Sep 2022 22:50:21 +0200
Subject: [PATCH] Revert "Fix parse_url(): can not recognize port without scheme"
This reverts commit 72d83709d9524945c93012f7bbb222e412df485a.
Closes GH-9569
---
.../tests/url/parse_url_basic_011.phpt | 30 +++++++++++++++----
ext/standard/url.c | 4 +--
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/ext/standard/tests/url/parse_url_basic_011.phpt b/ext/standard/tests/url/parse_url_basic_011.phpt
index 90e42d5b3f10..d03529959796 100644
--- a/ext/standard/tests/url/parse_url_basic_011.phpt
+++ b/ext/standard/tests/url/parse_url_basic_011.phpt
@@ -7,24 +7,42 @@ echo 'parse 127.0.0.1:9999?', PHP_EOL;
var_dump(parse_url('127.0.0.1:9999?'));
echo 'parse 127.0.0.1:9999#', PHP_EOL;
var_dump(parse_url('127.0.0.1:9999#'));
+echo 'parse internal:#feeding', PHP_EOL;
+var_dump(parse_url('internal:#feeding'));
+echo 'parse magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C', PHP_EOL;
+var_dump(parse_url('magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C'));
?>
--EXPECT--
*** Testing parse_url() :can not recognize port without scheme ***
parse 127.0.0.1:9999?
array(3) {
- ["host"]=>
+ ["scheme"]=>
string(9) "127.0.0.1"
- ["port"]=>
- int(9999)
+ ["path"]=>
+ string(4) "9999"
["query"]=>
string(0) ""
}
parse 127.0.0.1:9999#
array(3) {
- ["host"]=>
+ ["scheme"]=>
string(9) "127.0.0.1"
- ["port"]=>
- int(9999)
+ ["path"]=>
+ string(4) "9999"
["fragment"]=>
string(0) ""
}
+parse internal:#feeding
+array(2) {
+ ["scheme"]=>
+ string(8) "internal"
+ ["fragment"]=>
+ string(7) "feeding"
+}
+parse magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C
+array(2) {
+ ["scheme"]=>
+ string(6) "magnet"
+ ["query"]=>
+ string(44) "xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C"
+}
diff --git a/ext/standard/url.c b/ext/standard/url.c
index b268e9b0df27..e3d95768fb01 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -150,7 +150,7 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
p++;
}
- if ((p == ue || *p == '/' || *p == '?' || *p == '#') && (p - e) < 7) {
+ if ((p == ue || *p == '/') && (p - e) < 7) {
goto parse_port;
}
@@ -190,7 +190,7 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
pp++;
}
- if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/' || *pp == '?' || *pp == '#')) {
+ if (pp - p > 0 && pp - p < 6 && (pp == ue || *pp == '/')) {
zend_long port;
char *end;
memcpy(port_buf, p, (pp - p));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment