php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46345 String to integer conversion
Submitted: 2008-10-20 11:44 UTC Modified: 2008-10-20 11:48 UTC
From: paul dot guhl at mayflower dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.6 OS: any
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: paul dot guhl at mayflower dot de
New email:
PHP Version: OS:

 

 [2008-10-20 11:44 UTC] paul dot guhl at mayflower dot de
Description:
------------
Error occurs while implicit string to integer conversion, which should be performed by the prefix incermention. The ++ operator takes the input string as such and... "increments" the last character of the string. Error faced with PHP 5.2.0, 5.2.3 and 5.2.6. The test case was inspired by the Zend Certification Book :)

Reproduce code:
---------------
$a = 'Test';
echo ++$a;

Expected result:
----------------
1

Actual result:
--------------
Tesu

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-20 11:48 UTC] derick@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

Sorry, this is expected (and documented at http://no.php.net/manual/en/language.operators.increment.php)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC