note 129726 added to function.parse-url
| From: | simohammed.sd@gmail.com | Date: | Fri, 30 Aug 2024 11:16:37 +0000 |
| Subject: | note 129726 added to function.parse-url | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221504@lists.php.net to get a copy of this message | ||
Please consider these tips and cases:
1. Handling Fragment Identifiers:
parse_url() handles fragment identifiers (#section), but the fragment is not sent to the server and
is used client-side only. Be cautious when relying on fragment data, as it might not be available in
server-side processing.
2. URL Encoding and Decoding Issues:
parse_url() does not decode URL-encoded characters in the path. Ensure that encoding and decoding
are handled correctly if special characters are involved.
For example:
$url = 'https://www.primeogroup.com/es/servicios-de-configuraci%C3%B3n-instalaci%C3%B3n-y-an%C3%A1lisis-de-google-analytics/';
// /es/servicios-de-configuraci%C3%B3n-instalaci%C3%B3n-y-an%C3%A1lisis-de-google-analytics/
$path = parse_url($url, PHP_URL_PATH);
// /es/servicios-de-configuración-instalación-y-análisis-de-google-analytics/
$decoded_path = urldecode($path);
3. Unusual Port Numbers:
parse_url() does not handle ports outside the valid range (1-65535) correctly.
parse_url will return: bool(false)
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 105.66.128.233)
----
Manual Page -- https://php.net/manual/en/function.parse-url.php
Edit -- https://main.php.net/note/edit/129726
Del: integrated -- https://main.php.net/note/delete/129726/integrated
Del: useless -- https://main.php.net/note/delete/129726/useless
Del: bad code -- https://main.php.net/note/delete/129726/bad+code
Del: spam -- https://main.php.net/note/delete/129726/spam
Del: non-english -- https://main.php.net/note/delete/129726/non-english
Del: in docs -- https://main.php.net/note/delete/129726/in+docs
Del: other reasons-- https://main.php.net/note/delete/129726
Reject -- https://main.php.net/note/reject/129726
Search -- https://main.php.net/manage/user-notes.php