From: kkimmel at cse dot ohio-state dot edu Operating system: RHEL 4 x86_64 Kernel 2.6.9 PHP version: 4.4.4 PHP Bug Type: *General Issues Bug description: emalloc() fails when calling sybase_query()
Description: ------------ This error happens with php 4.4.4 and php 5.2.0. Test system: Dual Processor Intel Xeon CPU 3.20ghz Red Hat Enterprise 4 x86_64 glibc 2.3.4 gcc 3.4.6 apache 2.0.59 PHP 4.4.4 build flags: ./configure \ --prefix=/opt/php-4.4.4 \ --with-apxs2=/opt/apache-2.0.59/bin/apxs \ --with-sybase-ct=/usr/local/sybase/OCS-12_5 \ --enable-debug The apache startup script exports the following env vars: SYBASE="/usr/local/sybase" SYBASE_OCS="OCS-12_5" SYBASE_SYSAM="SYSAM-1_0" LANG="en_US" There are no errors reported from the sybase client library in the log file. I also had to hand edit ./configure because it cannot find the sybase 64bit libraries. The below code executes correctly on our old server which ran Solaris 8, Apache 1.3.33, PHP 4.4.0 and connected to the same sybase server. Reproduce code: --------------- ini_set('display_errors', '1'); error_reporting(E_ALL); $link = sybase_connect('omega', 'test1', 'pass'); $worked = sybase_select_db('dev01', $link); $sql = "SELECT * FROM Events"; $mixed = sybase_query($sql, $link); print_r($mixed); Expected result: ---------------- It should print out something like the following: Resource id #3 Actual result: -------------- In the apache log I see the following error: FATAL: emalloc(): Unable to allocate 42949672961 bytes Below is the backtrace of the code attached to this bug: (gdb) bt #0 0x000000374dd2e829 in kill () from /lib64/tls/libc.so.6 #1 0x0000002a956de859 in _emalloc (size=42949672961, __zend_filename=0x2a9572a338 "/tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c", __zend_lineno=1302, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /tmp/php-4.4.4/Zend/zend_alloc.c:187 #2 0x0000002a956842cc in php_sybase_fetch_result_set (sybase_ptr=0x6eab50, buffered=0, store=1) at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1302 #3 0x0000002a95684cbf in php_sybase_query (ht=2, return_value=0x6fa0b0, this_ptr=0x0, return_value_used=1, buffered=0) at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1497 #4 0x0000002a9568500f in zif_sybase_query (ht=2, return_value=0x6fa0b0, this_ptr=0x0, return_value_used=1) at /tmp/php-4.4.4/ext/sybase_ct/php_sybase_ct.c:1626 #5 0x0000002a9570cab3 in execute (op_array=0x6ea9c0) at /tmp/php-4.4.4/Zend/zend_execute.c:1675 #6 0x0000002a956f538f in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /tmp/php-4.4.4/Zend/zend.c:934 #7 0x0000002a956b5844 in php_execute_script (primary_file=0x7fbffff270) at /tmp/php-4.4.4/main/main.c:1752 #8 0x0000002a95713453 in php_handler (r=0x6db570) at /tmp/php-4.4.4/sapi/apache2handler/sapi_apache2.c:581 #9 0x000000000043ca93 in ap_run_handler (r=0x6db570) at config.c:152 #10 0x000000000043cf31 in ap_invoke_handler (r=0x6db570) at config.c:364 #11 0x000000000042b360 in ap_process_request (r=0x6db570) at http_request.c:249 #12 0x0000000000426728 in ap_process_http_connection (c=0x6d6dd0) at http_core.c:253 #13 0x00000000004475d3 in ap_run_process_connection (c=0x6d6dd0) at connection.c:43 #14 0x000000000043af1f in child_main (child_num_arg=Variable "child_num_arg" is not available. ) at prefork.c:610 #15 0x000000000043b154 in make_child (s=0x5eda50, slot=0) at prefork.c:650 #16 0x000000000043b22e in startup_children (number_to_start=5) at prefork.c:722 #17 0x000000000043b90b in ap_mpm_run (_pconf=Variable "_pconf" is not available. ) at prefork.c:941 #18 0x0000000000441b70 in main (argc=2, argv=0x7fbffff878) at main.c:623 -- Edit bug report at http://bugs.php.net/?id=39871&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39871&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39871&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39871&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39871&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39871&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39871&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39871&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39871&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39871&r=support Expected behavior: http://bugs.php.net/fix.php?id=39871&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39871&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39871&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39871&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39871&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39871&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39871&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39871&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39871&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39871&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39871&r=mysqlcfg