php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8366 the results returned for isset() do not seem to match those returned in php3.
Submitted: 2000-12-21 16:04 UTC Modified: 2000-12-22 05:04 UTC
From: beth at iensemble dot com Assigned:
Status: Closed Package: *Function Specific
PHP Version: 4.0.1pl2 OS: same results in Linux; Apache an
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: beth at iensemble dot com
New email:
PHP Version: OS:

 

 [2000-12-21 16:04 UTC] beth at iensemble dot com
<?php
echo "can edit: ".$c_edit;
if (isset($c_edit)){
     $edit=1;
} else {
     $edit = 0;
}

$edit2 = isset($c_edit);

echo "<br>edit: ".$edit;
echo "<br>edit2: ".$edit2;
?>

for php3.0.14 (http://stage.iensemble.com/beth/isset_test.php) , the above code returns thee same results for the variables $edit and $edit2. In php 4.0.1pl2 (http://www.ddeb3.org/php/isset_test.php), however, no value is returned for $edit2. 

This seems to happen whether on WinNT, Apache or Linux systems.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-22 05:04 UTC] hholzgra@php.net
php 4 has a true boolean type while php 3 hadn't

so isset() returned an integer in php 3
(same behavior as your if-statement)

php 4 isset() returns 'true' or 'false' instead,
converting theese boolean values into strings
will give a '1' for 'true' and '' (the empty string)
for false
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 22:01:30 2024 UTC