php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7857 odbc_exec crashes php
Submitted: 2000-11-16 23:22 UTC Modified: 2001-03-28 10:19 UTC
From: badams at ingenico dot com dot au Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.3 OS: NT sp6
Private report: No CVE-ID: None
 [2000-11-16 23:22 UTC] badams at ingenico dot com dot au
Function that executes an odbc sql query. The php module crashes.
The SQL query doesn't seem to matter.
If I move the code out of a function it works
If I remove the $result = section of $result = odbc_exec($db, $sql) if works. 

I have tried php4.02, php4.03 and both fail. I have updated the odbc drivers to orriface2000 and still it fails. I have rebooted the machine several times, tried different machines.

I do not understand this, I have a similar system on the same machine it has no problems like this.

<?
  function db_connect( $dbname )
  {
    global $TRAINING_MODE, $SYSTEM_SERVER_USERID, $SYSTEM_SERVER_PASSWORD;

    echo "Connecting to ".$name."<br> \n";

    return odbc_connect($dbname, $SYSTEM_SERVER_USERID, $SYSTEM_SERVER_PASSWORD);
  }

  function Session_RemoveExpired( )
  {
    global $DB_TMS;

    echo "Before Query <br> \n";

    // BUG NOTE - All these queries crash...
//    $sql = "DELETE FROM Sessions WHERE Expiry < ".$Now;
//    $sql = "SELECT * FROM TerminalConfig WHERE TerminalID='".$Now."'";
//    $sql = "SELECT * FROM TerminalConfig WHERE Serial='50000002'";
    $sql = "SELECT * FROM TerminalConfig";

    echo "SQL ".$sql."<br> \n";

    // BUG NOTE - Replace this line with the one below and no crash
    $result = odbc_exec($DB_TMS, $sql);
//    odbc_exec($DB_TMS, $sql);

    die("Finished db_exec <Br> \n");
  }

  $DB_TMS = db_connect("BASE_TMS");
  if( !$DB_TMS ) echo "Connect Failed <br> \n";

  Session_RemoveExpired( );
?>

Dr Watson Error Log Entry
-------------------------------

Microsoft (R) Windows NT (TM) Version 4.00 DrWtsn32
Copyright (C) 1985-1996 Microsoft Corp. All rights reserved.



Application exception occurred:
        App:  (pid=241)
        When: 11/17/2000 @ 16:7:9.360
        Exception number: c0000005 (access violation)

*----> System Information <----*
        Computer Name: GOODUP
        User Name: SYSTEM
        Number of Processors: 1
        Processor Type: x86 Family 6 Model 7 Stepping 3
        Windows Version: 4.0
        Current Build: 1381
        Service Pack: 6
        Current Type: Uniprocessor Free
        Registered Organization: Pick Me Inc
        Registered Owner: Pick Me

*----> Task List <----*
   0 Idle.exe
   2 System.exe
  25 smss.exe
  33 csrss.exe
  39 winlogon.exe
  45 services.exe
  48 lsass.exe
  75 spoolss.exe
  80 Apache.exe
  89 llssrv.exe
  93 RpcSs.exe
 102 tapisrv.exe
 109 rasman.exe
 112 Apache.exe
 167 pstores.exe
 170 LnchSvc.exe
 185 Blackbox.exe
 188 SerialBlackbox..exe
 200 war-ftpd.exe
 208 nddeagnt.exe
  51 Explorer.exe
 225 Memv200.exe
 227 Winampa.exe
 229 starter.exe
 231 OSA.exe
 233 FINDFAST.exe
 235 getright.exe
 241 php.exe
 243 drwtsn32.exe
   0 _Total.exe

(00400000 - 00400000) 
(77f60000 - 77fbe000) dll\ntdll.dbg
(10000000 - 10000000) 
(77f00000 - 77f5e000) dll\kernel32.dbg
(77e70000 - 77ec5000) dll\user32.dbg
(77ed0000 - 77efc000) dll\gdi32.dbg
(77dc0000 - 77dff000) dll\advapi32.dbg
(77e10000 - 77e67000) dll\rpcrt4.dbg
(776d0000 - 776d8000) dll\wsock32.dbg
(776b0000 - 776c4000) dll\ws2_32.dbg
(78000000 - 78040000) 
(776a0000 - 776a7000) dll\ws2help.dbg
(77b20000 - 77bd7000) dll\ole32.dbg
(65340000 - 653d2000) oleaut32.dbg
(04a50000 - 04a90000) odbc32.DBG
(779d0000 - 779d0000) 
(780a0000 - 780a0000) 
(77aa0000 - 77b15000) COMCTL32.dbg
(77c40000 - 77d7c000) dll\shell32.dbg
(77d80000 - 77db2000) dll\comdlg32.dbg
(77a90000 - 77a9b000) dll\version.dbg
(779c0000 - 779c8000) dll\lz32.dbg
(04a00000 - 04a00000) 

State Dump for Thread Id 0xf9

eax=00000000 ebx=00000000 ecx=00000301 edx=77fa75d0 esi=007eac94 edi=00000000
eip=77f6ce4c esp=0012fd70 ebp=0012fdd0 iopl=0         nv up ei ng nz ac po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000296


function: RtlpWaitForCriticalSection
        77f6ce28 e920010000       jmp     RtlpWaitForCriticalSection+0x196 (77f6cf4d)
        77f6ce2d 803d987ffa7701                                        ds:77fa7f98=01
                                  cmp     byte ptr [fltused+0x12a8 (77fa7f98)],0x1
        77f6ce34 1bc0             sbb     eax,eax
        77f6ce36 25e080fa77       and     eax,0x77fa80e0
        77f6ce3b 837e1000         cmp   dword ptr [esi+0x10],0x0 ds:0180969a=????????
        77f6ce3f 8945fc           mov     [ebp-0x4],eax          ss:0114e7d6=????????
        77f6ce42 7506             jnz     RtlpWaitForCriticalSection+0x93 (77f6ce4a)
        77f6ce44 56               push    esi
        77f6ce45 e8b6fdffff       call RtlSetCriticalSectionSpinCount+0x70 (77f6cc00)
        77f6ce4a 8b06             mov     eax,[esi]              ds:007eac94=00000000
FAULT ->77f6ce4c ff4010           inc     dword ptr [eax+0x10]   ds:0101ea06=????????
        77f6ce4f 8b06             mov     eax,[esi]              ds:007eac94=00000000
        77f6ce51 ff75fc           push    dword ptr [ebp-0x4]    ss:0114e7d6=????????
        77f6ce54 6a00             push    0x0
        77f6ce56 ff4014           inc     dword ptr [eax+0x14]   ds:0101ea06=????????
        77f6ce59 ff7610           push    dword ptr [esi+0x10]   ds:0180969a=????????
        77f6ce5c e86fb4ffff       call    NtWaitForSingleObject (77f682d0)
        77f6ce61 3d02010000       cmp     eax,0x102
        77f6ce66 0f85b2000000     jne     RtlpWaitForCriticalSection+0x167 (77f6cf1e)
        77f6ce6c 57               push    edi
        77f6ce6d 6822cdf677       push    0x77f6cd22
        77f6ce72 e881940000       call    DbgPrint (77f762f8)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
0012fdd0 77f67586 007eac94 04a6df2d 007eac94 0012fe94 ntdll!RtlpWaitForCriticalSection 
007eac70 007ead00 00000000 00000000 00000000 00000000 ntdll!RtlEnterCriticalSection 

*----> Raw Stack Dump <----*
0012fd70  90 a2 7e 00 40 75 f6 77 - 00 00 00 00 00 ad 7e 00  ..~.@u.w......~.
0012fd80  8e 13 00 78 00 ad 7e 00 - 01 00 00 00 bc fd 12 00  ...x..~.........
0012fd90  17 4e f6 77 00 00 7b 00 - a8 f4 7b 00 f1 4e f6 77  .N.w..{...{..N.w
0012fda0  48 05 7b 00 70 6d 7b 00 - b0 f4 7b 00 1e 00 00 00  H.{.pm{...{.....
0012fdb0  00 ad 7e 00 8e 13 00 78 - 6b 01 00 00 04 fe 12 00  ..~....xk.......
0012fdc0  34 14 00 78 00 00 7b 00 - 00 00 00 00 00 00 00 00  4..x..{.........
0012fdd0  70 ac 7e 00 86 75 f6 77 - 94 ac 7e 00 2d df a6 04  p.~..u.w..~.-...
0012fde0  94 ac 7e 00 94 fe 12 00 - 00 00 7c 00 90 a2 7e 00  ..~.......|...~.
0012fdf0  01 00 00 00 00 00 00 00 - 06 ef 00 78 71 de a6 04  ...........xq...
0012fe00  90 a2 7e 00 01 00 00 00 - 10 00 00 00 48 17 7c 00  ..~.........H.|.
0012fe10  b0 90 7e 00 00 00 00 00 - 3f 8e 03 10 90 a2 7e 00  ..~.....?.....~.
0012fe20  01 00 00 00 e0 ba 7e 00 - 15 e5 08 10 b0 90 7e 00  ......~.......~.
0012fe30  f0 90 7e 00 64 24 08 10 - e0 e1 7d 00 fc 15 7c 00  ..~.d$....}...|.
0012fe40  48 17 7c 00 94 fe 12 00 - 00 00 00 00 13 24 08 10  H.|..........$..
0012fe50  48 17 7c 00 f0 90 7e 00 - b0 15 7c 00 cf e5 08 10  H.|...~...|.....
0012fe60  48 17 7c 00 b9 ce 08 10 - b0 15 7c 00 e0 01 7c 00  H.|.......|...|.
0012fe70  50 cf 08 10 20 02 7c 00 - 50 cf 08 10 a0 17 7c 00  P... .|.P.....|.
0012fe80  24 20 02 78 b0 15 7c 00 - ac 8d 08 10 b0 15 7c 00  $ .x..|.......|.
0012fe90  b0 15 7c 00 b8 fe 12 00 - 6b 4e 00 10 10 1b 7c 00  ..|.....kN....|.
0012fea0  b0 15 7c 00 70 03 7c 00 - a0 3b 7c 00 10 1b 7c 00  ..|.p.|..;|...|.

State Dump for Thread Id 0xf2

eax=7ffdd044 ebx=00000000 ecx=002b01ee edx=00000000 esi=77e726e5 edi=00ddff6c
eip=77e72397 esp=00ddff24 ebp=00ddff48 iopl=0         nv up ei pl zr na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246


function: InvalidateRect
        77e7237e b89e110000       mov     eax,0x119e
        77e72383 8d542404         lea     edx,[esp+0x4]          ss:01dfe92b=????????
        77e72387 cd2e             int     2e
        77e72389 c20c00           ret     0xc
        77e7238c b885110000       mov     eax,0x1185
        77e72391 8d542404         lea     edx,[esp+0x4]          ss:01dfe92b=????????
        77e72395 cd2e             int     2e
        77e72397 c21400           ret     0x14

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
00ddff48 1008df05 00ddff6c 00000000 00000000 00000000 user32!InvalidateRect 

*----> Raw Stack Dump <----*
00ddff24  15 27 e7 77 6c ff dd 00 - 00 00 00 00 00 00 00 00  .'.wl...........
00ddff34  00 00 00 00 44 ff dd 00 - 66 25 e7 77 e5 26 e7 77  ....D...f%.w.&.w
00ddff44  e5 26 e7 77 b8 ff dd 00 - 05 df 08 10 6c ff dd 00  .&.w........l...
00ddff54  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
00ddff64  f0 6b 7e 00 f0 6b 7e 00 - 00 00 00 00 01 04 00 00  .k~..k~.........
00ddff74  f9 00 00 00 00 00 00 00 - b7 5d 0d 00 ea 00 00 00  .........]......
00ddff84  7d 02 00 00 20 38 00 78 - 00 00 00 00 00 00 00 00  }... 8.x........
00ddff94  b4 fd 12 0e f0 6b 7e 00 - a5 dd 11 80 90 ff dd 00  .....k~.........
00ddffa4  8b 74 11 80 dc ff dd 00 - 06 ef 00 78 c0 e2 02 78  .t.........x...x
00ddffb4  00 00 00 00 ec ff dd 00 - de 4e f0 77 f0 6b 7e 00  .........N.w.k~.
00ddffc4  00 00 00 00 b4 fd 12 0e - f0 6b 7e 00 b4 fd 12 0e  .........k~.....
00ddffd4  c4 ff dd 00 73 3b f0 77 - ff ff ff ff 44 b9 f3 77  ....s;.w....D..w
00ddffe4  38 d2 f3 77 00 00 00 00 - 00 00 00 00 00 00 00 00  8..w............
00ddfff4  c5 37 00 78 f0 6b 7e 00 - 00 00 00 00 07 00 00 00  .7.x.k~.........
00de0004  01 01 00 00 ee ff ee ff - 00 00 00 00 00 00 7b 00  ..............{.
00de0014  00 80 0f 00 00 00 de 00 - 00 01 00 00 38 00 de 00  ............8...
00de0024  00 00 ee 00 fc 00 00 00 - 02 00 00 00 d8 04 7b 00  ..............{.
00de0034  00 00 00 00 01 02 07 00 - 01 01 08 00 58 2d 50 6f  ............X-Po
00de0044  77 65 72 65 64 2d 42 79 - 3a 20 50 48 50 2f 34 2e  wered-By: PHP/4.
00de0054  30 2e 33 0d 0a 43 6f 6e - 74 65 6e 74 2d 74 79 70  0.3..Content-typ

Help me obi-one, your my only hope.
Thankss in advance.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-27 10:47 UTC] kalowsky@php.net
so the first question is, is this still the case in the latest releases?
 [2001-03-27 18:59 UTC] badams at ingenico dot com dot au
I'll code it up again and try it with php404 (dont have the release 1 yet)...

any preferably debug ?


 [2001-03-27 19:06 UTC] badams at ingenico dot com dot au
Still fails for php402
but works for php404.

thanks for looking into it.

doveraldo
 [2001-03-28 10:19 UTC] kalowsky@php.net
User reports fixed in 4.0.4... direct quote from email:

"
ID: 7857
User Update by: badams@ingenico.com.au
Status: Open
Bug Type: ODBC related
Description: odbc_exec crashes php

Still fails for php402
but works for php404.

thanks for looking into it.

doveraldo
"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 07:01:29 2024 UTC