php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46734 New flag to turn off / notify implicit type conversions
Submitted: 2008-12-03 10:40 UTC Modified: 2018-05-05 19:44 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: emarco at uol dot com dot br Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.2.6 OS: Any
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
32 - 11 = ?
Subscribe to this entry?

 
 [2008-12-03 10:40 UTC] emarco at uol dot com dot br
Description:
------------
That would be nice to be able to turn off any kind of type conversions in PHP. Since I started coding in PHP, I noticed many bugs in my code are due to unexpected type conversions in PHP, things like the string '0' (zero) being considered equal to the boolean false.

If we could turn off this kind of behaviour, or make PHP generate an alert/warning every time it finds itself comparing data of different types, that would be a powerful debugging tool for all of us. 

Thanks!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-12 20:29 UTC] klaussantana at gmail dot com
This would resolve your problems:

http://www.php.net/manual/en/language.operators.comparison.php

Use the IDENTICAL (===) and NOT IDENTICAL (!==) comparsion operators...
 [2018-05-05 19:44 UTC] requinix@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2018-05-05 19:44 UTC] requinix@php.net
Old request is old.

Use strict comparisons.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 06:01:31 2024 UTC