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
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-20 20:04 UTC] bjori@php.net
Already fixed in CVS
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Feb 21 16:01:27 2020 UTC