php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44283 After mysql_close () "Invalid pointer" and "Segmentation fault"
Submitted: 2008-02-28 15:14 UTC Modified: 2010-08-18 12:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: izh1979 at gmail dot com Assigned: mysql (profile)
Status: Not a bug Package: MySQL related
PHP Version: 5.2CVS-2008-02-28 OS: Linux 2.6.23.15-137.fc8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: izh1979 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-02-28 15:14 UTC] izh1979 at gmail dot com
Description:
------------
PHP 5.2.5, MySQL 5.0.51a, for redhat-linux-gnu (i686) using  EditLine wrapper.

Running test script with correct user password, you will see:

Connected successfully.
[Thu Feb 28 18:04:59 2008]  Script:  '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/ext/mysql/php_mysql.c(316) : Block 0x08f54820 status:
Invalid pointer: ((size=0x00000251) != (next.prev=0x00000000))
---------------------------------------
Disconnected successfully.
[Thu Feb 28 18:04:59 2008]  Script:  '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/Zend/zend_opcode.c(238) : Block 0x08f554e8 status:
Invalid pointer: ((prev=0x00000a78) != (prev.size=0x00000000))
---------------------------------------
zend_mm_heap corrupted
Segmentation fault

First problem occured in php_mysql.c(316) in function _close_mysql_link on line "efree(link);". Second in zend_opcode.c in function destroy_op_array on line "efree(op_array->vars[i].name);".

If you change hostname or password to wrong, you will see another error:

Warning: mysql_connect(): Unknown MySQL server host 'localhost2' (1) in /home/user/www/t.php on line 2
[Thu Feb 28 18:09:24 2008]  Script:  '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/ext/mysql/php_mysql.c(831) : Block 0x097db818 status:
Invalid pointer: ((size=0x00000251) != (next.prev=0x00000000))
---------------------------------------
Could not connect: Unknown MySQL server host 'localhost2' (1)

There is no segmentation fault now. But the problem is. In file php_mysql.c(831) the line is "efree(mysql);" in function php_mysql_do_connect.

Reproduce code:
---------------
%
<?php
$link = mysql_connect ('localhost', 'login', 'password');
if (!$link)
  die ("Could not connect: ". mysql_error ());

echo "Connected successfully.\n";
mysql_close ($link);
echo "Disconnected successfully.\n";
?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-28 17:16 UTC] izh1979 at gmail dot com
For php5.2-200802281530 problem is actual:

Connected successfully.
[Thu Feb 28 20:15:31 2008]  Script:  '/home/bsg/www/t.php'
---------------------------------------
/home/bsg/php5.2-200802281530/ext/mysql/php_mysql.c(316) : Block 0x0a03d3fc status:
Invalid pointer: ((size=0x00000251) != (next.prev=0x00000000))
---------------------------------------
Disconnected successfully.
[Thu Feb 28 20:15:31 2008]  Script:  '/home/bsg/www/t.php'
---------------------------------------
/home/bsg/php5.2-200802281530/Zend/zend_opcode.c(240) : Block 0x0a03e0c4 status:
Invalid pointer: ((prev=0x00000a78) != (prev.size=0x00000000))
---------------------------------------
zend_mm_heap corrupted
 [2008-02-28 17:24 UTC] izh1979 at gmail dot com
Here is backtrace from core:

#0  0x00110402 in __kernel_vsyscall ()
#1  0x00959ac6 in kill () from /lib/libc.so.6
#2  0x0817a829 in zend_mm_panic (message=0x8295bc0 "zend_mm_heap corrupted") at /home/bsg/php5.2-200802281530/Zend/zend_alloc.c:94
#3  0x0817b9d2 in zend_mm_check_leaks (heap=0xa02b1c8) at /home/bsg/php5.2-200802281530/Zend/zend_alloc.c:1194
#4  0x0817c5fe in zend_mm_shutdown (heap=0xa02b1c8, full_shutdown=0, silent=0) at /home/bsg/php5.2-200802281530/Zend/zend_alloc.c:1567
#5  0x0817e85f in shutdown_memory_manager (silent=0, full_shutdown=0) at /home/bsg/php5.2-200802281530/Zend/zend_alloc.c:2477
#6  0x08149634 in php_request_shutdown (dummy=0x0) at /home/bsg/php5.2-200802281530/main/main.c:1506
#7  0x08219129 in main (argc=2, argv=0xbfd296d4) at /home/bsg/php5.2-200802281530/sapi/cli/php_cli.c:1321
 [2008-03-03 13:12 UTC] jani@php.net
I can't reproduce this. Try running the script without loading php.ini using the '-n' option. If it still fails, provide the full configure line you used.
 [2008-03-03 14:40 UTC] izh1979 at gmail dot com
The same thing with php -n. It doesn't depend on configure options. But last time I use:

./configure  --disable-cgi --disable-all --enable-debug --with-mysql
 [2008-03-25 19:26 UTC] andrey@php.net
Hi,
can you try the following
USE_ZEND_ALLOC=0 valgrind php the_script.php

And post the result.

I can't reproduce it with 5.2 CVS
 [2008-03-25 19:58 UTC] izh1979 at gmail dot com
==30123== Memcheck, a memory error detector.
==30123== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==30123== Using LibVEX rev 1732, a library for dynamic binary translation.
==30123== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==30123== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==30123== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==30123==
--30123-- Command line
--30123--    sapi/cli/php
--30123--    -n
--30123--    /home/user/www/t.php
--30123-- Startup, with flags:
--30123--    -v
--30123--    --leak-check=full
--30123-- Contents of /proc/version:
--30123--   Linux version 2.6.23.15-137.fc8 (mockbuild@xenbuilder2.fedora.redhat.com) (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) #1 SMP Sun Feb 10 17:48:34 EST 2008
--30123-- Arch and hwcaps: X86, x86-sse1-sse2
--30123-- Page sizes: currently 4096, max supported 4096
--30123-- Valgrind library directory: /usr/lib/valgrind
--30123-- Reading syms from /lib/ld-2.7.so (0x911000)
--30123-- Reading syms from /home/bsg/php5.2-200802281530/sapi/cli/php (0x8048000)
--30123-- Reading syms from /usr/lib/valgrind/x86-linux/memcheck (0x38000000)
--30123--    object doesn't have a dynamic symbol table
--30123-- Reading suppressions file: /usr/lib/valgrind/default.supp
--30123-- REDIR: 0x926BB0 (index) redirected to 0x38027F5F (vgPlain_x86_linux_REDIR_FOR_index)
--30123-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_core.so (0x4001000)
--30123-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x4003000)
==30123== WARNING: new redirection conflicts with existing -- ignoring it
--30123--     new: 0x00926BB0 (index     ) R-> 0x04006230 index
--30123-- REDIR: 0x926D50 (strlen) redirected to 0x40062E0 (strlen)
--30123-- Reading syms from /lib/libcrypt-2.7.so (0x3ED0000)
--30123-- Reading syms from /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0 (0x4024000)
--30123-- Reading syms from /lib/libz.so.1.2.3 (0xAD8000)
--30123--    object doesn't have a symbol table
--30123-- Reading syms from /lib/libresolv-2.7.so (0x4088000)
--30123-- Reading syms from /lib/libm-2.7.so (0xA92000)
--30123-- Reading syms from /lib/libdl-2.7.so (0xA8B000)
--30123-- Reading syms from /lib/libnsl-2.7.so (0x734000)
--30123-- Reading syms from /lib/libc-2.7.so (0x930000)
--30123-- REDIR: 0x9A04C0 (rindex) redirected to 0x4006110 (rindex)
--30123-- REDIR: 0x9A13A0 (memset) redirected to 0x4006640 (memset)
--30123-- REDIR: 0x9A1890 (memcpy) redirected to 0x4007090 (memcpy)
--30123-- REDIR: 0x99B810 (calloc) redirected to 0x40047CD (calloc)
--30123-- REDIR: 0x99BB00 (malloc) redirected to 0x40054A0 (malloc)
--30123-- REDIR: 0x9A0120 (strlen) redirected to 0x40062C0 (strlen)
--30123-- REDIR: 0x9A0310 (strncmp) redirected to 0x4006320 (strncmp)
--30123-- REDIR: 0x99D060 (free) redirected to 0x40050BA (free)
--30123-- REDIR: 0x99FBC0 (strcmp) redirected to 0x4006390 (strcmp)
--30123-- REDIR: 0x99FA50 (index) redirected to 0x4006200 (index)
--30123-- REDIR: 0x9A2220 (strchrnul) redirected to 0x40066F0 (strchrnul)
--30123-- REDIR: 0x9A1400 (mempcpy) redirected to 0x4006B70 (mempcpy)
--30123-- REDIR: 0x9A1590 (stpcpy) redirected to 0x4006850 (stpcpy)
--30123-- REDIR: 0x99FC30 (strcpy) redirected to 0x40072F0 (strcpy)
--30123-- REDIR: 0x9A0EA0 (memchr) redirected to 0x40064B0 (memchr)
--30123-- REDIR: 0x99D250 (realloc) redirected to 0x400554F (realloc)
--30123-- REDIR: 0x99F8A0 (strcat) redirected to 0x40073E0 (strcat)
--30123-- Reading syms from /lib/libnss_files-2.7.so (0x43DB000)
--30123-- REDIR: 0x9A2150 (rawmemchr) redirected to 0x4006720 (rawmemchr)
==30123== Invalid write of size 1
==30123==    at 0x400665C: memset (mc_replace_strmem.c:490)
==30123==    by 0x4055499: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA54C is 0 bytes after a block of size 548 alloc'd
==30123==    at 0x4005525: malloc (vg_replace_malloc.c:149)
==30123==    by 0x817E267: _emalloc (zend_alloc.c:2280)
==30123==    by 0x80935F9: php_mysql_do_connect (php_mysql.c:745)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==
==30123== Invalid write of size 1
==30123==    at 0x4006654: memset (mc_replace_strmem.c:490)
==30123==    by 0x4055499: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA54D is 1 bytes after a block of size 548 alloc'd
==30123==    at 0x4005525: malloc (vg_replace_malloc.c:149)
==30123==    by 0x817E267: _emalloc (zend_alloc.c:2280)
==30123==    by 0x80935F9: php_mysql_do_connect (php_mysql.c:745)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554A0: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA620 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554AA: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6C0 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554B0: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6C4 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554B8: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6CC is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554BE: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA5B8 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 1
==30123==    at 0x4007319: strcpy (mc_replace_strmem.c:272)
==30123==    by 0x40554DD: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA57D is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 1
==30123==    at 0x400732C: strcpy (mc_replace_strmem.c:272)
==30123==    by 0x40554DD: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA582 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 1
==30123==    at 0x40554DE: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6BF is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40554E5: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA684 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 1
==30123==    at 0x40554EF: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA68D is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 1
==30123==    at 0x40554F6: mysql_init (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093614: php_mysql_do_connect (php_mysql.c:748)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6A9 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40584F9: mysql_options (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093636: php_mysql_do_connect (php_mysql.c:751)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA620 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 1
==30123==    at 0x40564B4: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA605 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40564CA: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA6D4 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40564D8: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA604 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 4
==30123==    at 0x40564E2: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA650 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 4
==30123==    at 0x4056D26: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA654 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 4
==30123==    at 0x4056714: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA648 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 4
==30123==    at 0x4056D18: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA644 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid write of size 4
==30123==    at 0x40565BD: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA614 is not stack'd, malloc'd or (recently) free'd
==30123==
==30123== Invalid read of size 4
==30123==    at 0x4056CC7: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
==30123==  Address 0x43FA630 is not stack'd, malloc'd or (recently) free'd

valgrind: m_mallocfree.c:178 (mk_plain_bszB): Assertion 'bszB != 0' failed.
==30123==    at 0x38016659: report_and_quit (m_libcassert.c:136)
==30123==    by 0x38016983: vgPlain_assert_fail (m_libcassert.c:200)
==30123==    by 0x38020663: vgPlain_arena_malloc (m_mallocfree.c:178)
==30123==    by 0x380365B7: vgPlain_cli_malloc (replacemalloc_core.c:101)
==30123==    by 0x3800248E: vgMemCheck_malloc (mc_malloc_wrappers.c:182)
==30123==    by 0x38036D12: do_client_request (scheduler.c:1158)
==30123==    by 0x3803864C: vgPlain_scheduler (scheduler.c:869)
==30123==    by 0x38058AF3: run_a_thread_NORETURN (syswrap-linux.c:87)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==30123==    at 0x4005525: malloc (vg_replace_malloc.c:149)
==30123==    by 0x4038A5C: my_malloc (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x405A56A: vio_new (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x4056DF8: mysql_real_connect (in /usr/local/mysql/lib/mysql/libmysqlclient.so.15.0.0)
==30123==    by 0x8093673: php_mysql_do_connect (php_mysql.c:754)
==30123==    by 0x80939A9: zif_mysql_connect (php_mysql.c:805)
==30123==    by 0x81C0F1B: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==30123==    by 0x81C67C6: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1682)
==30123==    by 0x81C0A7C: execute (zend_vm_execute.h:92)
==30123==    by 0x819B94E: zend_execute_scripts (zend.c:1134)
==30123==    by 0x814A21A: php_execute_script (main.c:2006)
==30123==    by 0x8218788: main (php_cli.c:1140)
 [2008-04-25 20:20 UTC] jani@php.net
Assigned to Andrey (so he won't forget..:)
 [2008-07-23 12:03 UTC] andrey@php.net
Hi,
I suspect that you have different headers for MySQL and compile PHP with one set and run with another libmysql. The valgrind problem is that mysql_init writes after the end of php_mysql_conn, which doesn't use a pointer but aggregates a MYSQL structure. This way, if you have compiled PHP with one header set and use different (later) libmysql, which thinks MYSQL is bigger, you get these errors.
 [2008-07-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-08-18 12:33 UTC] andrey@php.net
-Status: No Feedback +Status: Bogus -Assigned To: andrey +Assigned To: mysql
 [2010-08-18 12:33 UTC] andrey@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Headers/library mismatch
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 05 22:01:28 2024 UTC