encodeUrlQuery takes into account the port (#493)

In order to take into account the port in the URLs (related to PR #148).

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
Richard 2022-08-12 09:44:18 +02:00 committed by GitHub
parent ff83da807a
commit 5a04f6e0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1887,7 +1887,8 @@ class TCPDF_STATIC {
if (isset($urlData['query']) && $urlData['query']) {
$urlQueryData = array();
parse_str(urldecode($urlData['query']), $urlQueryData);
$updatedUrl = $urlData['scheme'] . '://' . $urlData['host'] . $urlData['path'] . '?' . http_build_query($urlQueryData);
$port = isset($urlData['port']) ? ':'.$urlData['port'] : '';
$updatedUrl = $urlData['scheme'].'://'.$urlData['host'].$port.$urlData['path'].'?'.http_build_query($urlQueryData);
} else {
$updatedUrl = $url;
}