php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18294 May be "Type Juggling" problems
Submitted: 2002-07-12 04:00 UTC Modified: 2002-07-22 16:05 UTC
From: sitnikov at infonet dot ee Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Linux
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: sitnikov at infonet dot ee
New email:
PHP Version: OS:

 

 [2002-07-12 04:00 UTC] sitnikov at infonet dot ee
<?
	$b = false;
	$s = '';

	for($j=0;$j<10;$j++)
	{
		var_dump($b);
		var_dump($s);
		echo "\n";

		$b++;
		$s++;
	}
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-13 18:26 UTC] derick@php.net
What is the bug here?

It shows this for me, which is perfectly normal:
bool(false)
string(0) ""

bool(false)
string(1) "1"

bool(false)
int(2)

bool(false)
int(3)

bool(false)
int(4)

bool(false)
int(5)

bool(false)
int(6)

bool(false)
int(7)

bool(false)
int(8)

bool(false)
int(9)
 [2002-07-14 02:13 UTC] sitnikov at infonet dot ee
Why not "Type Juggling" for boolean ?
 [2002-07-14 04:52 UTC] sander@php.net
IMO the bool-stuff works ok, but it's strange that it jumps from string to int.
 [2002-07-14 05:24 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

Jani, the type juggling for '' is actually correct, as the string value "1" gets converted to an int first before the increment operator is applied.
Andrew, I implemented type juggling for bools.

Derick
 [2002-07-21 08:49 UTC] sitnikov at infonet dot ee
I see, what you removed this changes from CVS ?
 [2002-07-22 12:00 UTC] sitnikov at infonet dot ee
It is possible to receive comments?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC