php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17586 Odd Functions/Global
Submitted: 2002-06-03 20:56 UTC Modified: 2002-06-03 21:17 UTC
From: rgldman at aol dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.1 OS: Win32/ME
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: rgldman at aol dot com
New email:
PHP Version: OS:

 

 [2002-06-03 20:56 UTC] rgldman at aol dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-03 21:17 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC