[php-src] Issue #14488: Null condition is behave different in if statements
| From: | mohammadMghi | Date: | Thu, 06 Jun 2024 12:14:13 +0000 |
| Subject: | [php-src] Issue #14488: Null condition is behave different in if statements | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247044@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14488
Author: mohammadMghi
### Description
The following code:
```
//Consider confirm_by_admin equal null
//The condition is not met
if($this->user->confirm_by_admin == null)
{
return Response()->json([
"Error" => "Your account not confirm by admin"
] , 401);
}
//The condition is met
if(is_null($this->user->confirm_by_admin))
{
return Response()->json([
"Error" => "Your account not confirm by admin"
] , 401);
}
```
Two snips above codes returns different results. If confirm_by_admin is null then first code snip
not get run. but second get runs and it's not meaningful.
### PHP Version
PHP 8.2.19
### Operating System
Ubuntu 20.04.5 LTS