Date: 04/30/01
- Next message: erick <email protected>: "[PHP-DEV] Bug #10566: don't work properly fopen"
- Previous message: tsukada <email protected>: "Re: [PHP-DEV] 4.0.6"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: glen <email protected>
Operating system: SCO OpenServer 5.0.6
PHP version: 4.0.4pl1
PHP Bug Type: MySQL related
Bug description: mysql_real_connect dumps core, fix included
** This is a problem in MySql. This report provides a code
modification to compensate for the MySql problem. **
Under SCO OpenServer 5.0.6, Apache 1.3.19, PHP 4.0.4 PL 1,
and MySql 3.23.36 (precompiled MySQL for OpenServer 5.0.x),
calls to mysql_real_connect will silently dump core if
mysql_init was not allowed to *allocate* the memory for the
MySQL structure.
To function properly, mysql_init must be passed NULL, thus
allowing it to allocate and manage the memory. If you use
a previously malloc()'ed or static structure, MySQL will
dump core on connect.
We find this problem to be present in MySQL, and can
duplicate it using a C code stub. The problem, of course,
also exists in PHP, causing a core dump there as well,
since PHP pre-malloc()'s its own structure.
Here is a DIFF for ext/mysql/php_mysql.c which fixes the
problem for us. It's ugly, and hack-y, but it works. FYI.
198c198
< efree(link);
--- > /* efree(link); */ 456c456 < mysql = (MYSQL *) malloc(sizeof(MYSQL)); --- > /* mysql = (MYSQL *) malloc(sizeof(MYSQL)); */ 458c458 < mysql_init(mysql); --- > mysql = mysql_init(NULL); 542c542 < mysql = (MYSQL *) emalloc(sizeof(MYSQL)); --- > /* mysql = (MYSQL *) emalloc(sizeof(MYSQL)); */ 544c544 < mysql_init(mysql); --- > mysql = mysql_init(NULL);-- Edit Bug report at: http://bugs.php.net/?id=10565&edit=1
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: erick <email protected>: "[PHP-DEV] Bug #10566: don't work properly fopen"
- Previous message: tsukada <email protected>: "Re: [PHP-DEV] 4.0.6"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

