Re: PHP 4.0 Bug #8951 Updated: php_mysql_do_connect -> parameter host modified when using port or socket
| From: | Jiri Kaderavek | Date: | Tue, 30 Jan 2001 19:09:02 +0000 |
| Subject: | Re: PHP 4.0 Bug #8951 Updated: php_mysql_do_connect -> parameter host modified when using port or socket | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-45412@lists.php.net to get a copy of this message | ||
Unfortunately i cannot get any
response from http://snaps.php.net
I've tried this from our local universtity's
network with the same result.
Sorry.
JK.
----- Original Message -----
From: Bug Database <php-dev@lists.php.net>
To: <jiri.kaderavek@webstep.net>
Sent: Sunday, January 28, 2001 3:34 AM
Subject: PHP 4.0 Bug #8951 Updated: php_mysql_do_connect -> parameter host
modified when using port or socket
> ID: 8951
> Updated by: sniper
> Reported By: jiri.kaderavek@webstep.net
> Old-Status: Open
> Status: Feedback
> Bug Type: MySQL related
> Assigned To:
> Comments:
>
> Could you please try the latest snapshot from
> http://snaps.php.net/
> to check if this is fixed already?
>
> --Jani
>
> Previous Comments:
> --------------------------------------------------------------------------
-
>
> [2001-01-27 12:46:46] jiri.kaderavek@webstep.net
> Parameter $host is modified in function php_mysql_do_connect(). Example:
>
> $host = "localhost:/tmp/mysql.sock";
> $conn = mysql_connect($host .....
> echo $host;
>
> Output is: localhost/tmp/mysql.sock
> because of replacing of ":" charcter by null char in
> this part of php_mysql_do_connect
>
> ===================
>
> static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int
persistent)
>
> char *user,*passwd,*host,*socket=NULL,*tmp;
> char *hashed_details;
> int hashed_details_length,port = MYSQL_PORT;
> ....
> /* We cannot use mysql_port anymore in windows, need to use
> * mysql_real_connect() to set the port.
> */
>
> if (host && (tmp=strchr(host,':'))) {
> *tmp=0;
> tmp++;
> if (tmp[0] != '/') {
> port = atoi(tmp);
> } else {
> socket = tmp;
> }
> .....
> }
>
> ===================
>
>
> solution:
> copying of *host content through *host2 pointer
>
> ===================
>
>
> static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int
persistent)
>
> char *user,*passwd,*host,*socket=NULL,*tmp,*host2;
> char *hashed_details;
> int hashed_details_length,port = MYSQL_PORT;
> ....
> /* We cannot use mysql_port anymore in windows, need to use
> * mysql_real_connect() to set the port.
> */
>
> host2 = (char *) emalloc(strlen(SAFE_STRING(host) + 1));
> strcpy(host2, host);
> host = host2;
>
> if (host && (tmp=strchr(host,':'))) {
> *tmp=0;
> tmp++;
> if (tmp[0] != '/') {
> port = atoi(tmp);
> } else {
> socket = tmp;
> }
> ...
> }
>
> --------------------------------------------------------------------------
-
>
>
> Full Bug description available at: http://bugs.php.net/?id=8951
>
>