php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20931 is_null ceases to function
Submitted: 2002-12-11 01:07 UTC Modified: 2002-12-11 01:10 UTC
From: gregaryh at juno dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.2.3 OS: debian linux
Private report: No CVE-ID: None
 [2002-12-11 01:07 UTC] gregaryh at juno dot com
I recently compiled php 4.2.3 on my debian system under apache 2.0. I then uploaded a site that was developed on another machine running apache 1.3 and php 4.2.1. While testing the site i noticed something seemed wrong. Upon further investigation i found that the is_null function, which was working perfectly on the other system, seemed to be malfunctioning.

for example:
if (is_null($somevar)){
   execute code A
}

code A would execute regardless of whether $somevar had a null value or not

if i do the following:
echo is_null($somevar) 
nothing was echoed to the screen, again regardless of the value of $somevar

if i did the following however with $somevar set to null:
if($somevar == null){
   execute code A
   if(is_null($somevar)){
      execute code b
   }
}

code A will execute but code B will not. 

the value of somevar is assigned by an html form sent using the POST method as this example illustrates:

$somevar = $_POST['$formvar'];

the purpose of the code is to check if a field was left blank.
This code worked fine on the original server but failed to work when copied to the new server

my configuration is as follows:
./configure' '--prefix=/usr/local/apache2/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/etc' '--with-mysql'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-11 01:10 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

$_POST['somevar'] is definately not NULL..

 [2002-12-11 01:13 UTC] gregaryh at juno dot com
why would this exact code work in php ver. 4.2.1 but not in ver 4.2.3 if it is not a bug?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 05:01:28 2024 UTC