php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3399 postfix increment operator (++) fails to cast string to integer
Submitted: 2000-02-03 22:44 UTC Modified: 2000-08-05 12:45 UTC
From: athompso at commerced dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 + 37 = ?
Subscribe to this entry?

 
 [2000-02-03 22:44 UTC] athompso at commerced dot com
Test case:

$i = '-1';
$i++;
echo "i = $i\ntype = " . gettype($i) . "\n";

Output:
    i=-2            (****questionable behaviour****)
    type=string            (****questionable behaviour****)


Reference Case:

$i = '-1';
$i--;
echo "i = $i\ntype = " . gettype($i) . "\n";

Output:
    i=-2
    type=integer

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-06 06:28 UTC] sas at cvs dot php dot net
Reclassifying
 [2000-08-05 05:50 UTC] hholzgra@php.net
this still occures with latest php 3 & 4
 [2000-08-05 12:45 UTC] stas@php.net
This is Perl-style "smart increment". It is intended to be so.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 09:01:31 2024 UTC