#30312 [Com]: sybase_unbuffered_query calls
ID: 30312 Comment by: lobster2 at xs4all dot nl Reported By: dfleury2 at libertysurf dot fr Status: Assigned Bug Type: Sybase-ct (ctlib) related Operating System: * PHP Version: 5.1.3, 4.4.2 Assigned To: thekid New Comment: The use of sybase_query instead of sybase_unbuffered_query solved the core dumps in my case (PHP 4.4.0 5.2.0 CLI with Sybase 12.5.3 on AIX 5.2). I used the sybase_unbuffered_query calls with the third parameter = false. The second sql query call in the script would crash the process every time, surviving only the first fetch on the result set. Previous Comments: [2006-05-02 16:36:41] dfleury2 at libertysurf dot fr The bugs are still here in the 5.1.3 release. [2005-02-07 22:01:53] dfleury2 at libertysurf dot fr The patch seems to work for the first example but not this one. ?php $db = sybase_connect( 'LOCALHOST', 'sa', '' ); $query= sybase_unbuffered_query( 'select getdate()' ); $array= sybase_fetch_array( $query ); var_dump( $array ); sybase_free_result( $query ); $query = sybase_unbuffered_query( 'select getdate(), getdate()' ); $array = sybase_fetch_array( $query ); var_dump( $array ); sybase_free_result( $query ); ? OUTPUT array(2) { [0]= string(19) Feb 7 2005 2:18PM [computed]= string(19) Feb 7 2005 2:18PM } array(4) { [0]= string(19) Feb 7 2005 2:18PM [8]= string(19) Feb 7 2005 2:18PM [1]= string(19) Feb 7 2005 2:18PM [Ø]= string(19) Feb 7 2005 2:18PM } Bus error with the patch a sample like this didn't work. (I not sure if it's a legitimate code) ?php $db = sybase_connect( 'LOCAHOST', 'sa', '' ); $i = 0; while( 1 ) { $query = sybase_unbuffered_query( 'select * from big_table' ); $array = sybase_fetch_array( $query ); echo $i++. \n; } ? but I got : Warning: sybase_fetch_array(): supplied argument is not a valid Sybase result resource in /tmp_mnt/users/fxa/fle ury/divers/php/test2.php on line 8 (work fine in 4.3.8 but with memory leaks). [2005-02-06 15:35:40] [EMAIL PROTECTED] Sorry, I cannot reproduce this, neither with apache / mod_php4 nor with cli-php. Maybe this is because I'm using FreeTDS (and not the ct-libs?) I added a test case to the PHP test system (http://cvs.php.net/co.php/php-src/ext/sybase_ct/tests/bug30312.phpt) which worked fine for me. I can see a possible double-free in the sourcecode. Maybe could you try the following patch: http://sitten-polizei.de/bug30312.patch [2005-02-03 21:11:37] dfleury2 at libertysurf dot fr The problem still here. (php_sybase_ct.c didn't move) A free avoid the core, but the array is corrupted for the second fetch. ?php $db = sybase_connect( 'LOCALHOST', 'sa', '' ); $query = sybase_unbuffered_query( 'select getdate()' ); $array = sybase_fetch_array( $query ); var_dump( $array ); sybase_free_result( $query ); $query = sybase_unbuffered_query( 'select getdate(), getdate()' ); while( $array = sybase_fetch_array( $query ) ) var_dump( $array ); //sybase_free_result( $query ); ? [2004-10-03 20:21:32] dfleury2 at libertysurf dot fr Description: Two calls to sybase_unbuffered_query core Apache. To correct the problem before somelse those it perfectly, I had add a return after php_sybase_finish_results(result); /* Forward declaration */ static int php_sybase_finish_results (sybase_result *result); static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { sybase_result *result = (sybase_result *)rsrc-ptr; /* Check to see if we've read all rows */ if (result-sybase_ptr result-sybase_ptr-active_result_index) { if (result-sybase_ptr-cmd) { ct_cancel(NULL, result-sybase_ptr-cmd, CS_CANCEL_ALL); } php_sybase_finish_results(result); return;// correction } _free_sybase_result(result); } Reproduce code: --- ?php $db = sybase_connect( 'LOCALHOST', 'sa', '' ); $query = sybase_unbuffered_query( 'select getdate()' ); $array = sybase_fetch_array( $query ); echo $array[ 0 ]; echo 'br'; $query = sybase_unbuffered_query( 'select getdate()' ); $array = sybase_fetch_array( $query ); echo $array[ 0 ]; ? Expected result: 2-Oct-2004 18:42:50 2-Oct-2004 18:42:50 Actual result: -- Core dump (gdb) bt #0 0x080e2890 in _free_sybase_result (result=0x81cb89c) at /home/david/Documents/php-4.3.9/ext/sybase_ct/php_sybase_ct.c:128 #1
#30312 [Com]: sybase_unbuffered_query calls
ID: 30312 Comment by: A at massagelon dot org Reported By: dfleury2 at libertysurf dot fr Status: Analyzed Bug Type: Sybase-ct (ctlib) related Operating System: * PHP Version: 4CVS-2005-02-05 Assigned To: thekid New Comment: http://www.massagelondon.org London Massage Therapist http://www.massagelondon.biz massage therapy West London UK http://www.massagelondon.me.uk London chair Massage UK http://www.health-resources.co.uk Medical Alternative Medicine resources in London England UK http://www.mobilephonesites.co.uk Nokia Free Mobile Phones Sites London England UK http://www.massagelondon.org.uk London Alternative Medicine UK http://www.massagelondon.info http://www.centrallondonmassage.co.uk W1 Massage Therapy Central London West End UK http://www.centrallondonmassage.me.uk W2 Paddington Therapeutic Massages Alternative Therapies London http://www.centrallondonmassage.org.uk W3 Acton Complementary Health Clinic London http://www.eastlondonmassage.co.uk E1 Eastern Medicine London City of http://www.londonclinic.me.uk W4 Chiswick Health Clinic ME London http://www.londonmassagecentre.co.uk W5 Ealing Holistic Centre London UK http://www.londonmassagecentre.me.uk W6 Hammersmith Healing Massage London http://www.londonmassagecentre.org.uk W7 Hanwell Wellness Centre London http://www.londonmassageclinic.co.uk W8 Kensington Technique London Clinic http://www.londonmassageclinic.me.uk Thai Massage London Center W9 Maida Vale http://www.londonmassageclinic.org.uk W11 Notting Hill Alternative Health in London W10 http://www.londonmassagetherapy.co.uk W12 Shepherd's Shepherds Bush Complementary Therapies London http://www.londonmassagetherapy.me.uk W14 West Kensington On Site Office Chair Massage London http://www.ilovemassage.co.uk http://www.ilovemassage.me.uk http://www.ilovemassage.org.uk http://www.imassage.info http://www.mywellness.me.uk http://www.therapeuticmassage.info http://www.massageme.co.uk http://www.mymedicine.co.uk http://www.mytherapy.co.uk http://www.mylove.org.uk EAST ACTON SHEPHERDS SHEPHER'S BUSH CHISWICK HAMMERSMITH FULHAM SOHO WESTMINSTER NOTTING HILL GATE BAYSWATER QUEENSWAY HOLLAND PARK KNIGHTSBRIDGE PICCADILLY LEICESTER SQUARE GREEN PARK HYDE PARK EARLS COURT TURNHAM GREEN WC1 Euston Bloomsbury WC2 Holborn Covent Garden Strand Fitzrovia Mayfair Soho Chinatown SW1 Victoria Belgravia http://www.londonmassagetherapy.org.uk Massage Tables Couches Chairs UK MASSAGE THERAPY THERAPEUTIC MASSAGE THAI MASSAGE TRADITIONAL THAI MASSAGE INDONESIAN MASSAGE HAWAIIAN MASSAGE COMPLEMENTARY HEALTH ALTERNATIVE THERAPIES COMPLEMENTARY MEDICINE ALTERNATIVE MEDICINE HOLISTIC MASSAGE BOWEN TECHNIQUE BOWEN THERAPY CRANIOSACRAL THERAPY CRANIO SACRAL THERAPY LONDON THERAPIST THERAPISTS LONDON MASSAGE TREATMENT TREATMENTS LONDON MASSAGE http://www.londontherapist.me.uk Hawaiian Huna Bodywork London http://www.londontherapist.org.uk Healthy Massage Treatment http://www.massagecentrallondon.co.uk Lomi Lomi Kahuna Oil Massage http://www.massagecentrallondon.me.uk Holistic Therapists London http://www.massagecentrallondon.org.uk Craniosacral Therapy London http://www.massageclinic.me.uk Manual Lymph Drainage London http://www.massageclinic.org.uk Massage Experienced Qualified Insured London http://www.massagelondon-home.me.uk London Therapy at Home or Clinic http://www.massagelondon-home.org.uk Home Wellness London Therapy http://www.massagelondoncentral.co.uk Complementary Alternative Medicine West London http://www.massagelondononline.me.uk Generic Domain Names Google Ranked Sale http://www.massagelondononline.org.uk Info on Massage Equipment Sale UK http://www.massagelondonpage.me.uk Information Site about Massage Therapy London UK http://www.massagelondonpage.org.uk London UK complementary therapies massage http://www.massagelondonweb.me.uk alternative health London UK thai massage http://www.massagelondonweb.org.uk http://www.massagelondonwest.co.uk traditional thai indonesian massage therapy London http://www.massagenorthlondon.co.uk http://www.massagepractitioner.co.uk http://www.massagepractitioner.me.uk http://www.massagepractitioner.org.uk http://www.massagesouthlondon.co.uk http://www.massagetherapylondon.co.uk http://www.massagetherapylondon.me.uk http://www.massagetherapylondon.org.uk http://www.massagewestlondon.co.uk http://www.massagewestlondon.me.uk http://www.massagewestlondon.org.uk http://www.mybodywork.me.uk http://www.mybodywork.org.uk http://www.mylondonmassage.me.uk http://www.mylondonmassage.org.uk http://www.mymassagenow.me.uk http://www.mymassagenow.org.uk http://www.myrub.me.uk http://www.myrub.org.uk http://www.mythaimassage.me.uk http://www.northlondonmassage.co.uk http://www.oilmassage.me.uk http://www.southlondonmassage.co.uk http://www.therapeuticmassagelondon.co.uk http://www.therapeuticmassagelondon.me.uk http://www.therapeuticmassagelondon.org.uk http://www.therapist.me.uk http://www.therapistonline.me.uk