php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79110 php_raw_url_encode encodes only _-.~ chars (under any EBCDIC-aware OS)
Submitted: 2020-01-13 14:51 UTC Modified: 2020-11-13 15:55 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: a at ustimen dot co Assigned:
Status: Open Package: *URL Functions
PHP Version: Irrelevant OS: Any EBCDIC-aware
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-01-13 14:51 UTC] a at ustimen dot co
Description:
------------
https://github.com/php/php-src/blob/8ee04946f0d80ad6c77e707e36f53939e3932c7d/ext/standard/url.c#L586

Bug is 21 years old.

- if (!isalnum(c) && strchr("_-.~", c) != NULL) {
+ if (!isalnum(c) && strchr("_-.~", c) == NULL) {



Test script:
---------------
# Compile PHP under not CHARSET_EBCDIC
# Run php -r 'var_dump(rawurlencode("<tag-here />"));'
Command line code:1:
string(20) "%3Ctag-here%20%2F%3E"

# Compile PHP under CHARSET_EBCDIC
# Run php -r 'var_dump(rawurlencode("<tag-here />"));'
# It ALSO should output:
Command line code:1:
string(20) "%3Ctag-here%20%2F%3E"

# But I propose it will output:
Command line code:1:
string(14) "<tag%2dhere />"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-13 15:55 UTC] cmb@php.net
It seems to me the bug is more than 50 years old. ;)  Anyway, as
of PHP 8.0.0, EBCDIC is no longer supported:
<https://github.com/php/php-src/blob/f5be0e5110ff816d2ce168c154cb3575d08e3cad/UPGRADING#L1136>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 08:01:23 2020 UTC