php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38907 Somewhat misleading notice message with type conversions
Submitted: 2006-09-20 19:13 UTC Modified: 2006-09-20 20:04 UTC
From: smlerman at gmail dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 5.1.6 OS: Windows (presumably others)
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: smlerman at gmail dot com
New email:
PHP Version: OS:

 

 [2006-09-20 19:13 UTC] smlerman at gmail dot com
Description:
------------
If you try to compare an object to a string, the error message says that the object could not be converted to an int. It makes it a little more difficult to debug code when you're looking for a comparison involving an integer instead of a string. Nothing really major, but a would-be-nice kind of fix. 

Reproduce code:
---------------
<?php

class Foo{}

$obj = new Foo();

if ($obj == "blah"){
  echo "foo";
} else{
  echo "bar";
}

?>

Expected result:
----------------
Notice: Object of class Foo could not be converted to string in int_convert.php on line 7

Actual result:
--------------
Notice: Object of class Foo could not be converted to int in int_convert.php on line 7

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-20 20:04 UTC] bjori@php.net
Already fixed in CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 13:01:34 2025 UTC