php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55668 Strings docs: explain that strings are binary safe
Submitted: 2011-09-11 13:34 UTC Modified: 2011-09-11 20:15 UTC
From: php at richardneill dot org Assigned: cataphract (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at richardneill dot org
New email:
PHP Version: OS:

 

 [2011-09-11 13:34 UTC] php at richardneill dot org
Description:
------------
I think there are a couple of omissions that could be added to the notes here:
 http://www.php.net/language.types.string

1. Clarify that, unlike C-strings, PHP-strings are properly binary safe, i.e. not internally null-terminated, and can include embedded \0.   One might otherwise wrongly expect that, for example strlen("hello\0world") would be 5.

2. The reference to PHP's strings not being natively Unicode is a bit confusing: a string is just a sequence of bytes, and doesn't, conceptually, even have a character set! UTF-8 is already transparently ASCII compatible as a byte-stream. It's just certain functions (strlen, strtolower etc) that can't cope. 
[May I suggest a reference to the UTF-8 FAQ: http://www.cl.cam.ac.uk/~mgk25/unicode.html )



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-11 15:01 UTC] cataphract@php.net
-Assigned To: +Assigned To: cataphract
 [2011-09-11 20:13 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=316504
Log: - Fixed doc bug #55668: trings docs: explain that strings are binary safe.
- Strings & encodings.
 [2011-09-11 20:15 UTC] cataphract@php.net
-Status: Assigned +Status: Closed
 [2011-09-11 20:15 UTC] cataphract@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 21:00:02 2026 UTC