php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51294 09 is no longer a valid value for chr() function
Submitted: 2010-03-14 04:55 UTC Modified: 2010-03-14 07:30 UTC
From: jnelson11 at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.3.2 OS: centos 5.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jnelson11 at gmail dot com
New email:
PHP Version: OS:

 

 [2010-03-14 04:55 UTC] jnelson11 at gmail dot com
Description:
------------
you can no longer pass 09 int ascii value to chr() function to get a "\t" return value.

I was previously running version 5.2.6 of php on my server a upgraded to version 5.3.2

A few of my providers send ascii with preceeding zero.

Please let me know if 09 is no longer supported as a value that can be passed to chr().

Test script:
---------------
// 5.3.2 returns 0
// 5.2.6 return "\t"
ord(chr(09));

// 5.3.2 returns "\t"
// 5.2.6 return "\t"
ord(chr(9));

Expected result:
----------------
expected result is that both 09 and 9 should return "\t"

Actual result:
--------------
actual result is 09 returns null

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-14 07:30 UTC] pierrick@php.net
-Status: Open +Status: Bogus
 [2010-03-14 07:30 UTC] pierrick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

When a number is preceded by a 0 it mean that you're using an octal notation. So when you wrote 09 it was converted to 0 since 9 is not a valid octal.

If you want to print "\t" you can use chr(011)

011 = 9 

http://php.net/manual/en/language.types.integer.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 14:01:30 2024 UTC