From: akbara13 at gmail dot com Operating system: Debian GNU/Linux Etch PHP version: 5.1.6 PHP Bug Type: MySQL related Bug description: Defined in __construct () variables are not "seen" into mysql-functions
Description: ------------ When defining some variables into a constructor, these ones are not "seen" when calling mysql-functions. For instance: __construct () { $db_host = "localhost"; $db_user = "akbara"; $db_pass = ""; } public function db_routine () { mysql_connect ($db_host, $db_user, $db_pass) or die (mysql_error()); } -------------- The error message is: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www-data'@'localhost' (using password: NO) in /home/akbara/server/localhost/www/fa.php on line 33 Access denied for user 'www-data'@'localhost' (using password: NO) --------------- Defining the variables within the function db_routine () doesn't causes such an error. The workaround of this problem: using $this->var when defining the var within __construct () and then into mysql_function ($this->var). This is usually processed correctly. -- Edit bug report at http://bugs.php.net/?id=38709&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38709&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38709&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38709&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38709&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38709&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38709&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38709&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38709&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38709&r=support Expected behavior: http://bugs.php.net/fix.php?id=38709&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38709&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38709&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38709&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38709&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38709&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38709&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38709&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38709&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38709&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38709&r=mysqlcfg