php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35945 sybase_query() fails on AMD64
Submitted: 2006-01-09 16:17 UTC Modified: 2008-11-09 13:16 UTC
Votes:9
Avg. Score:4.2 ± 0.8
Reproduced:8 of 8 (100.0%)
Same Version:5 (62.5%)
Same OS:4 (50.0%)
From: dbaffaleuf at ixis-cib dot com Assigned: thekid
Status: Not a bug Package: Sybase-ct (ctlib) related
PHP Version: 5CVS, 4CVS (2006-01-11) (snap) OS: Linux 2.6.9-22 RedHat AMD64
Private report: No CVE-ID:
 [2006-01-09 16:17 UTC] dbaffaleuf at ixis-cib dot com
Description:
------------
Acutally I have the problem both in PHP 4.4.1 and 4.4.2RC3


Always returns a correct resource id for the handler, but FALSE for the query (see the following code)

The Sybase OpenClient warning code suggest an overflow in the CS_DATAFMT.maxlength C struct. When returning, the datalength is sized whether the type is CS_NUMERIC, CS_MONEY, etc... in the php_sybase_fetch_result_set() fonction (src: php_sybase_ct.c). 

Works fine in DB-LIB.

The configure :

./configure     \
        --prefix=/msmorzine/sgbd/contrib/src/php4-STABLE-200601091335/MKTEST    \
        --with-sybase-ct=/msmorzine/sgbd/MX_MT_MSMORZINE/ASE1253/OCS-12_5/devlib \
        --enable-static=sybase-ct \
        --with-config-file-path=/msmorzine/sgbd/contrib/src/php4-STABLE-200601091335/MKTEST \
        --with-apxs2=/msmorzine/sgbd/contrib/bin/apxs   \
        --with-gd=/msmorzine/sgbd/contrib/ \
        --enable-sysvmsg \
        --enable-sysvsem \
        --enable-sysvshm



Reproduce code:
---------------
The following code:

$STR    = "select name from syslogins";
$DBH    = @sybase_connect("MX_MT_MSMORZINE","sa", "mypassword");
$QUERY  = sybase_query($STR,$DBH);
var_dump($DBH);
var_dump($QUERY);

while($row = sybase_fetch_row($QUERY)) {
    while(list($k, $v) = each($row)) {
        echo "\$row[$k] => $v\n";
    }
}


Expected result:
----------------
int(4)
int(5)
$row[0] => probe
$row[0] => sa


Actual result:
--------------
"Warning: sybase_query(): Sybase:  Client message:  (): user api layer: internal common library error: The bind of result set item 1 resulted in truncation. (severity 116) in /msmorzine/sgbd/contrib/src/php4-STABLE-200601091335/MKTEST/bin/test_sybase_ct.php on line 5
resource(4) of type (sybase-ct link)
bool(false)".


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-11 12:05 UTC] dbaffaleuf at ixis-cib dot com
Hi, thx for your reply.

Though, it does not work either with the 5.1. CVS snapshot you provided. I get exactly the same error message:

Warning: sybase_query(): Sybase:  Client message:  (): user api layer: internal common library error: The bind of result set item 1 resulted in truncation. (severity 116) in /msmorzine/sgbd/contrib/src/php5.1-200601110930/MKTEST/bin/test_sybase_ct.php on line 4
resource(4) of type (sybase-ct link)
bool(false)

Warning: sybase_fetch_row(): supplied argument is not a valid Sybase result resource in /msmorzine/sgbd/contrib/src/php5.1-200601110930/MKTEST/bin/test_sybase_ct.php on line 8
 [2006-02-04 16:59 UTC] shawnf at fletcher dot org dot za
here is a patch for php-5.1

it makes the module use the 64bit libraries and most importantly adds 

CFLAGS="${CFLAGS} -g -DSYB_LP64"

-----------------cut here------------------------


*** ext/sybase_ct/config.m4     2006-02-04 16:41:12.000000000 +0100
--- ext/sybase_ct/config.m4.old 2005-05-30 00:16:44.000000000 +0100
***************
*** 29,59 ****
    else
      AC_MSG_ERROR([ctpublic.h missing!])
    fi
-
-   CFLAGS="${CFLAGS} -g -DSYB_LP64"
-

    PHP_ADD_LIBPATH($SYBASE_CT_LIBDIR, SYBASE_CT_SHARED_LIBADD)
    if test -f $SYBASE_CT_INCDIR/tds.h; then
      PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
!     SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lct64"
    else
!     PHP_ADD_LIBRARY(cs64,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(ct64,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(comn64,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(intl64,, SYBASE_CT_SHARED_LIBADD)

!     SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lcs64 -lct64 -lcomn64 -lintl64"

!     PHP_CHECK_LIBRARY(tcl64, netg_errstr, [
!       PHP_ADD_LIBRARY(tcl64,,SYBASE_CT_SHARED_LIBADD)
      ],[
!       PHP_ADD_LIBRARY(sybtcl64,,SYBASE_CT_SHARED_LIBADD)
      ],[
        $SYBASE_CT_LIBS
      ])

!     PHP_CHECK_LIBRARY(insck64, insck__getVdate, [PHP_ADD_LIBRARY(insck64,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
!     PHP_CHECK_LIBRARY(insck64, bsd_tcp,         [PHP_ADD_LIBRARY(insck64,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
    fi
  fi
--- 29,56 ----
    else
      AC_MSG_ERROR([ctpublic.h missing!])
    fi

    PHP_ADD_LIBPATH($SYBASE_CT_LIBDIR, SYBASE_CT_SHARED_LIBADD)
    if test -f $SYBASE_CT_INCDIR/tds.h; then
      PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
!     SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lct"
    else
!     PHP_ADD_LIBRARY(cs,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(comn,, SYBASE_CT_SHARED_LIBADD)
!     PHP_ADD_LIBRARY(intl,, SYBASE_CT_SHARED_LIBADD)

!     SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lcs -lct -lcomn -lintl"

!     PHP_CHECK_LIBRARY(tcl, netg_errstr, [
!       PHP_ADD_LIBRARY(tcl,,SYBASE_CT_SHARED_LIBADD)
      ],[
!       PHP_ADD_LIBRARY(sybtcl,,SYBASE_CT_SHARED_LIBADD)
      ],[
        $SYBASE_CT_LIBS
      ])

!     PHP_CHECK_LIBRARY(insck, insck__getVdate, [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
!     PHP_CHECK_LIBRARY(insck, bsd_tcp,         [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
    fi
  fi
 [2007-04-25 23:09 UTC] sabapamu at mizuho-sc dot com
I experienced the same problem with PHP 5.2.1 on Intel x86_64 using Sybase Open Client 15.0 64bit libraries.
Fix quoted by shawnf worked for me.
 [2007-07-09 13:50 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

Provide your patch as unified diff and in correct order, the one here is reversed..and use the provided latest snapshot for it.
 [2007-07-17 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".
 [2008-07-02 10:44 UTC] felipe@php.net
Assigned to maintainer.
 [2008-11-09 13:16 UTC] thekid@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Seems to be a duplicate of Bug #45357. As stated there, please have a look if http://sitten-polizei.de/php/sybase-configm4.diff helps!
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 12:01:52 2014 UTC