php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44099 PHP should treat NULL values like SQL does
Submitted: 2008-02-11 15:45 UTC Modified: 2008-02-11 21:19 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: zy at adels dot zp dot ua Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.5 OS: All
Private report: No CVE-ID: None
 [2008-02-11 15:45 UTC] zy at adels dot zp dot ua
Description:
------------
Currently NULL values when used as arguments of math and comparision operations are simply converted to zero. So there is no difference between using NULL, false, 0 - this is a useless redundancy while important functionality is missing - to tread NULL values as SQL treats them.

For example:
NULL * $anything should be NULL, instead of 0
NULL + $anything should be NULL, instead of $anything
NULL == NULL should be false, while NULL === NULL should be true

If PHP has NULL value it should be used properly.

Expected result:
----------------
see above


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-11 21:19 UTC] johannes@php.net
Sorry, that would be a major change of the language desing which can't be done.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 06:01:34 2025 UTC