php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61363 Wrong defaults in htmlspecialchars() manual
Submitted: 2012-03-12 20:30 UTC Modified: 2012-03-12 21:34 UTC
From: tokul at users dot sourceforge dot net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.4.0 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tokul at users dot sourceforge dot net
New email:
PHP Version: OS:

 

 [2012-03-12 20:30 UTC] tokul at users dot sourceforge dot net
Description:
------------
You have typo in htmlspecialchars() manual (online version for 2012-03-12 date). ENT_COMPAT is not the same as ENT_HTML401. Function can't have two different values as default.

ENT_COMPAT is int(2). ENT_HTML401 is int(0)


Sorry, if it is already fixed in source repo. I can see only online version and I can't find htmlspecialchars related report on this problem.

Test script:
---------------
<?php
var_dump(ENT_COMPAT);
var_dump(ENT_HTML401);
var_dump(htmlspecialchars('"'));

Expected result:
----------------
int(2)
int(0)
string(6) "&quot;"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-12 21:34 UTC] cataphract@php.net
The documentation is correct. $x | 0 == $x for any integer $x. While the ENT_HTML401 constant could be omitted from the default value, it helps to convey that the default document type is HTML 4.01.
 [2012-03-12 21:34 UTC] cataphract@php.net
-Status: Open +Status: Not a bug
 [2012-03-13 17:08 UTC] tokul at users dot sourceforge dot net
> it helps to convey that ....

And it has nothing to do with htmlspecialchars function. Function sanitizes strings. It does not do anything related to doctype. Stop inventing new syntaxes for writing default values in documentation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC