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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Sun Oct 27 16:01:27 2024 UTC