php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61116 HTML functions use encoding, not charset
Submitted: 2012-02-16 23:54 UTC Modified: 2015-04-19 03:46 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: vrana@php.net Assigned: stas (profile)
Status: Closed Package: Strings related
PHP Version: trunk-SVN-2012-02-16 (SVN) OS: Irrelevant
Private report: No CVE-ID: None
 [2012-02-16 23:54 UTC] vrana@php.net
Description:
------------
HTML functions use encoding, not charset.

E.g. ISO-8859-1 is both character set and encoding but UTF-8 is encoding of Unicode character set.

There's also missing arg_info in get_html_translation_table().

I've already fixed Manual.


Test script:
---------------
Reflection::export(new ReflectionFunction('htmlspecialchars'));
Reflection::export(new ReflectionFunction('get_html_translation_table'));


Expected result:
----------------
Function [ <internal:standard> function htmlspecialchars ] {

  - Parameters [4] {
    Parameter #0 [ <required> $string ]
    Parameter #1 [ <optional> $quote_style ]
    Parameter #2 [ <optional> $encoding ]
    Parameter #3 [ <optional> $double_encode ]
  }
}

Function [ <internal:standard> function get_html_translation_table ] {

  - Parameters [2] {
    Parameter #0 [ <optional> $table ]
    Parameter #1 [ <optional> $quote_style ]
    Parameter #2 [ <optional> $encoding ]
  }
}



Actual result:
--------------
Function [ <internal:standard> function htmlspecialchars ] {

  - Parameters [4] {
    Parameter #0 [ <required> $string ]
    Parameter #1 [ <optional> $quote_style ]
    Parameter #2 [ <optional> $charset ]
    Parameter #3 [ <optional> $double_encode ]
  }
}

Function [ <internal:standard> function get_html_translation_table ] {

  - Parameters [2] {
    Parameter #0 [ <optional> $table ]
    Parameter #1 [ <optional> $quote_style ]
  }
}



Patches

php-src (last revision 2012-02-16 23:54 UTC by vrana@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-16 23:54 UTC] vrana@php.net
The following patch has been added/updated:

Patch Name: php-src
Revision:   1329436461
URL:        https://bugs.php.net/patch-display.php?bug=61116&patch=php-src&revision=1329436461
 [2015-04-19 03:46 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2015-04-19 03:46 UTC] stas@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 19:03:12 2021 UTC