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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Fri Dec 27 01:01:28 2024 UTC