Bug #17586: Odd Functions/Global
| From: | rgldman at aol dot com | Date: | Tue, 04 Jun 2002 00:56:30 +0000 |
| Subject: | Bug #17586: Odd Functions/Global | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9403@lists.php.net to get a copy of this message | ||
From: rgldman@aol.com
Operating system: Win32/ME
PHP version: 4.2.1
PHP Bug Type: Output Control
Bug description: Odd Functions/Global
Webserver: Apache 2.0.36 / PHP 4.2.1(module) / register_globals = Off
Kind of difficult to explain so here you have it. (This is not the exact
script but structure.)
**OCCURANCE #1
---mysql.php---
$dbhost = "localhost";
$dbuser = "user";
...
function dbconnect() { global $dbhost, $dbuser
if (!mysql_connect($dbhost, $dbuser,...)) { die..}
else if (!mysql_select_db(...)) { die..}
else { print "connection ok"; }
}
dbconnect();
---end mysql.php---
I ran this script throug my browser, it worked.
**OCCURANCE #2
---mysql.php---
$dbhost = "localhost";
$dbuser = "user";
...
function dbconnect() { global $dbhost, $dbuser
if (!mysql_connect($dbhost, $dbuser,...)) { die..}
else if (!mysql_select_db(...)) { die..}
else { print "connection ok"; }
}
---end mysql.php---
---test.php---
require "mysql.php";
dbconnect();
---end test.php---
No result.
**OCCURENCE #3
---mysql.php---
$dbhost = "localhost";
$dbuser = "user";
...
function dbconnect() { global $dbhost, $dbuser
if (!mysql_connect($dbhost, $dbuser,...)) { die..}
else if (!mysql_select_db(...)) { die..}
else { print "connection ok"; }
}
dbconnect();
---end mysql.php---
Nothings happens, although #1 and #3 are exact. I should have received the
same result if the scripts are exact, right? I am confused. This was
within one minute time span. I don't know if this is a bug or really
matters at all but something doesn't seem right, and that gets annoying.
PHP 4.2.1 is very annoying. I lub PHP --all $_GET, $_POST, globals, ETC.
make me sick. :0`',
I do not understand why #1 was successfull in the first place, with global
$vars;.
Sincerely, RG.
--
Edit bug report at http://bugs.php.net/?id=17586&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17586&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17586&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17586&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17586&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17586&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17586&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17586&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17586&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17586&r=globals