Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
Hi, Could someone w/ sufficient karma commit add these lines to PHP_5_3/NEWS: You have karma for NEWS now :) Committed news entries to PHP_5_2 and PHP_5_3 Thanks again for giving sybase_ct some love :) You're welcome:) - Timm -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
On Sat, Nov 8, 2008 at 2:59 PM, Timm Friebe <[EMAIL PROTECTED]> wrote: > Hi, > >>> - MFB: Changed while loop in php_sybase_fetch_result_row() to also read >>> rows with >>> retcode == CS_ROW_FAIL. >>> # Reported by Detlef Neumerkel and Frank Irnich of Sybase >> >> Thanks for this commit :) Please add the NEWS entry as well. > > Tried so: > > $ cvs ci -m '- Added notes in fixes to ext/sybase_ct' NEWS > COMMITINFO /repository/php-src NEWS > Access denied: insufficient karma (thekid|php-src) >Contact [EMAIL PROTECTED] for access to php-src > cvs commit: Pre-commit check failed > cvs [commit aborted]: correct above errors first! > > Could someone w/ sufficient karma commit add these lines to PHP_5_3/NEWS: You have karma for NEWS now :) Thanks again for giving sybase_ct some love :) Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thekid Sat Nov 8 14:15:09 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: - MFB: Fixed problems with segmentation faults when using unbuffered queries # Double-freeing results caused these http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.15&r2=1.103.2.5.2.16&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.15 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.16 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.15Sat Nov 8 12:06:08 2008 +++ php-src/ext/sybase_ct/php_sybase_ct.c Sat Nov 8 14:15:08 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.15 2008/11/08 12:06:08 thekid Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.16 2008/11/08 14:15:08 thekid Exp $ */ #ifdef HAVE_CONFIG_H @@ -138,6 +138,21 @@ #define efree_n(x) { efree(x); x = NULL; } #define efree_if(x) if (x) efree_n(x) +#ifdef PHP_SYBASE_DEBUG +#define FREE_SYBASE_RESULT(result) \ + if (result) { \ + fprintf(stderr, "_free_sybase_result(%p) called from line #%d\n", result, __LINE__); \ + fflush(stderr); \ + _free_sybase_result(result); \ + result = NULL; \ + } +#else +#define FREE_SYBASE_RESULT(result) \ + if (result) { \ + _free_sybase_result(result); \ + result = NULL; \ + } +#endif static void _free_sybase_result(sybase_result *result) { int i, j; @@ -191,7 +206,7 @@ php_sybase_finish_results(result TSRMLS_CC); } - _free_sybase_result(result); + FREE_SYBASE_RESULT(result); } static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) @@ -1109,8 +1124,6 @@ case CS_CANCELED: default: - _free_sybase_result(result); - result = NULL; retcode = CS_FAIL; break; } @@ -1216,7 +1229,7 @@ break; default: - _free_sybase_result(result); + FREE_SYBASE_RESULT(result); result = NULL; retcode = CS_FAIL; /* Just to be sure */ break; @@ -1425,17 +1438,9 @@ INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); - /* Causes the following segfault: - Program received signal SIGSEGV, Segmentation fault. - 0x8144380 in _efree (ptr=0x81fe024, __zend_filename=0x81841a0 "php4/ext/sybase_ct/php_sybase_ct.c", - __zend_lineno=946, __zend_orig_filename=0x0, __zend_orig_lineno=0) at php4/Zend/zend_alloc.c:229 - php4/Zend/zend_alloc.c:229:7284:beg:0x8144380 - */ - #if O_TIMM if (result) { php_sybase_finish_results(result TSRMLS_CC); } - #endif zval_ptr_dtor(&tmp); zend_list_delete(sybase_ptr->active_result_index); @@ -1590,9 +1595,7 @@ /* Retry deadlocks up until deadlock_retry_count times */ if (sybase_ptr->deadlock && SybCtG(deadlock_retry_count) != -1 && ++deadlock_count > SybCtG(deadlock_retry_count)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Retried deadlock %d times [max: %ld], giving up", deadlock_count- 1, SybCtG(deadlock_retry_count)); - if (result != NULL) { - _free_sybase_result(result); - } + FREE_SYBASE_RESULT(result); break; } @@ -1611,9 +1614,7 @@ * optimization, we could try not to fetch results in known * deadlock conditions, but deadlock is (should be) rare. */ - if (result != NULL) { - _free_sybase_result(result); -
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
Hi, - MFB: Changed while loop in php_sybase_fetch_result_row() to also read rows with retcode == CS_ROW_FAIL. # Reported by Detlef Neumerkel and Frank Irnich of Sybase Thanks for this commit :) Please add the NEWS entry as well. Tried so: $ cvs ci -m '- Added notes in fixes to ext/sybase_ct' NEWS COMMITINFO /repository/php-src NEWS Access denied: insufficient karma (thekid|php-src) Contact [EMAIL PROTECTED] for access to php-src cvs commit: Pre-commit check failed cvs [commit aborted]: correct above errors first! Could someone w/ sufficient karma commit add these lines to PHP_5_3/NEWS: == - Fixed sybase_unbuffered_query() crashes when not reading all results (Timm) - Fixed sybase_fetch_*() functions to also read rows with CS_ROW_FAIL (Timm) == Thanks in advance! - Timm -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
hi Timm, On Sat, Nov 8, 2008 at 1:06 PM, Timm Friebe <[EMAIL PROTECTED]> wrote: > thekid Sat Nov 8 12:06:08 2008 UTC > > Modified files: (Branch: PHP_5_2) >/php-src/ext/sybase_ct php_sybase_ct.c > Log: > - MFB: Changed while loop in php_sybase_fetch_result_row() to also read rows > with >retcode == CS_ROW_FAIL. > # Reported by Detlef Neumerkel and Frank Irnich of Sybase Thanks for this commit :) Please add the NEWS entry as well. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thekid Sat Nov 8 12:06:08 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: - MFB: Changed while loop in php_sybase_fetch_result_row() to also read rows with retcode == CS_ROW_FAIL. # Reported by Detlef Neumerkel and Frank Irnich of Sybase http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.14&r2=1.103.2.5.2.15&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.14 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.15 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.14Mon Dec 31 07:20:13 2007 +++ php-src/ext/sybase_ct/php_sybase_ct.c Sat Nov 8 12:06:08 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.14 2007/12/31 07:20:13 sebastian Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.15 2008/11/08 12:06:08 thekid Exp $ */ #ifdef HAVE_CONFIG_H @@ -1143,7 +1143,7 @@ } if (numrows!=-1) numrows+= result->num_rows; - while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED) { + while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED || retcode == CS_ROW_FAIL) { result->num_rows++; i= result->store ? result->num_rows- 1 : 0; if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
helly Tue Apr 10 15:56:31 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: - WS/CS http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.12&r2=1.103.2.5.2.13&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.12 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.12Tue Apr 10 15:50:34 2007 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Apr 10 15:56:31 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.12 2007/04/10 15:50:34 helly Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13 2007/04/10 15:56:31 helly Exp $ */ #ifdef HAVE_CONFIG_H @@ -160,12 +160,12 @@ efree(result->fields); } -if (result->tmp_buffer) { -for (i=0; inum_fields; i++) { -efree(result->tmp_buffer[i]); -} -efree(result->tmp_buffer); -} + if (result->tmp_buffer) { + for (i=0; inum_fields; i++) { + efree(result->tmp_buffer[i]); + } + efree(result->tmp_buffer); + } efree_if(result->lengths); efree_if(result->indicators); @@ -528,16 +528,16 @@ if (charset) { if (cs_loc_alloc(SybCtG(context), &tmp_locale)!=CS_SUCCEED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to allocate locale information."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to allocate locale information"); } else { if (cs_locale(SybCtG(context), CS_SET, tmp_locale, CS_LC_ALL, NULL, CS_NULLTERM, NULL)!=CS_SUCCEED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to load default locale data."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to load default locale data"); } else { if (cs_locale(SybCtG(context), CS_SET, tmp_locale, CS_SYB_CHARSET, charset, CS_NULLTERM, NULL)!=CS_SUCCEED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update character set."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update character set"); } else { if (ct_con_props(sybase->connection, CS_SET, CS_LOC_PROP, tmp_locale, CS_UNUSED, NULL)!=CS_SUCCEED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection properties."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection properties"); } } } @@ -546,7 +546,7 @@ if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize"); } } @@ -1202,7 +1202,7 @@ } if (retcode==CS_ROW_FAIL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows); return retcode; } result->last_retcode= retcode; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
helly Tue Apr 10 15:50:34 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: - Cleanup the cleanup http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.11&r2=1.103.2.5.2.12&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.11 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.12 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.11Wed Mar 14 11:48:49 2007 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Apr 10 15:50:34 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.11 2007/03/14 11:48:49 thekid Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.12 2007/04/10 15:50:34 helly Exp $ */ #ifdef HAVE_CONFIG_H @@ -135,6 +135,9 @@ return 0; } +#define efree_n(x) { efree(x); x = NULL; } +#define efree_if(x) if (x) efree_n(x) + static void _free_sybase_result(sybase_result *result) { int i, j; @@ -157,6 +160,19 @@ efree(result->fields); } +if (result->tmp_buffer) { +for (i=0; inum_fields; i++) { +efree(result->tmp_buffer[i]); +} +efree(result->tmp_buffer); +} + + efree_if(result->lengths); + efree_if(result->indicators); + efree_if(result->datafmt); + efree_if(result->numerics); + efree_if(result->types); + efree(result); } @@ -246,7 +262,7 @@ TSRMLS_FETCH(); if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Client message: %s (severity %d)", errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Client message: %s (severity %ld)", errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber)); } STR_FREE(SybCtG(server_message)); SybCtG(server_message) = estrdup(errmsg->msgstring); @@ -351,8 +367,8 @@ /* Spit out a warning if neither of them has handled this message */ if (!handled) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Server message: %s (severity %d, procedure %s)", - srvmsg->text, srvmsg->severity, ((srvmsg->proclen>0) ? srvmsg->proc : "N/A")); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Server message: %s (severity %ld, procedure %s)", + srvmsg->text, (long)srvmsg->severity, ((srvmsg->proclen>0) ? srvmsg->proc : "N/A")); } return CS_SUCCEED; @@ -1015,15 +1031,15 @@ CS_RETCODE retcode; CS_INT restype; - efree(result->datafmt); - efree(result->lengths); - efree(result->indicators); - efree(result->numerics); - efree(result->types); + efree_n(result->datafmt); + efree_n(result->lengths); + efree_n(result->indicators); + efree_n(result->numerics); + efree_n(result->types); for (i=0; inum_fields; i++) { efree(result->tmp_buffer[i]); } - efree(result->tmp_buffer); + efree_n(result->tmp_buffer); /* Indicate we have read all rows */ result->sybase_ptr->active_result_index= 0; @@ -1105,7 +1121,7 @@ #define RETURN_DOUBLE_VAL(result, buf, length) \ if ((length - 1) <= EG(precision)) {\ errno = 0; \ - Z_DVAL(result) = strtod(buf, NULL); \ + Z_DVAL(result) = zend_strtod(buf, NULL);\ if (errno != ERANGE) { \ Z_TYPE(result) = IS_DOUBLE; \ } else {\ @@ -1127,14 +1143,7 @@ } if (numrows!=-1) numrows+= result->num_rows; - while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED - || retcode==CS_ROW_FAIL) { - /* - if (retcode==CS_ROW_FAIL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows); - } - */ - + while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED) { result->num_rows++; i= result->store ? result->num_rows- 1 : 0; if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) { @@ -1191,7 +1200,11 @@ } if (numrows!=-1 && result->num_rows>=numrows) break; } - + + if (retcode==CS_ROW_FAIL) { + php_error_docref(
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thekid Wed Mar 14 11:48:49 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: - Fixed segmentation fault in sybase_connect() # This was introduced by changing sprintf -> spprintf and resulted # from passing a char* to spprintf() instead of a char** http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.10&r2=1.103.2.5.2.11&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.10 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.11 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.10Tue Mar 6 02:07:10 2007 +++ php-src/ext/sybase_ct/php_sybase_ct.c Wed Mar 14 11:48:49 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.10 2007/03/06 02:07:10 stas Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.11 2007/03/14 11:48:49 thekid Exp $ */ #ifdef HAVE_CONFIG_H @@ -599,7 +599,7 @@ convert_to_string_ex(yyhost); host = Z_STRVAL_PP(yyhost); user=passwd=charset=appname=NULL; - hashed_details_length = spprintf(hashed_details, 0, "sybase_%s", Z_STRVAL_PP(yyhost)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s", Z_STRVAL_PP(yyhost)); } break; case 2: { @@ -613,7 +613,7 @@ host = Z_STRVAL_PP(yyhost); user = Z_STRVAL_PP(yyuser); passwd=charset=appname=NULL; - hashed_details_length = spprintf(hashed_details, 0, "sybase_%s_%s___", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s_%s___", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser)); } break; case 3: { @@ -629,7 +629,7 @@ user = Z_STRVAL_PP(yyuser); passwd = Z_STRVAL_PP(yypasswd); charset=appname=NULL; - hashed_details_length = spprintf(hashed_details, 0, "sybase_%s_%s_%s__", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s_%s_%s__", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd)); } break; case 4: { @@ -647,7 +647,7 @@ passwd = Z_STRVAL_PP(yypasswd); charset = Z_STRVAL_PP(yycharset); appname=NULL; - hashed_details_length = spprintf(hashed_details, 0, "sybase_%s_%s_%s_%s_", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s_%s_%s_%s_", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset)); } break; case 5: { @@ -666,7 +666,7 @@ passwd = Z_STRVAL_PP(yypasswd); charset = Z_STRVAL_PP(yycharset); appname = Z_STRVAL_PP(yyappname); - hashed_details_length = spprintf(hashed_details, 0, "sybase_%s_%s_%s_%s_%s", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset), Z_STRVAL_PP(yyappname)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s_%s_%s_%s_%s", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd), Z_STRVAL_PP(yycharset), Z_STRVAL_PP(yyappname)); } break; default: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
stasTue Mar 6 02:07:10 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: use safe_realloc http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.9&r2=1.103.2.5.2.10&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.9 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.10 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.9 Sat Feb 24 02:17:27 2007 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Mar 6 02:07:10 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.9 2007/02/24 02:17:27 helly Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.10 2007/03/06 02:07:10 stas Exp $ */ #ifdef HAVE_CONFIG_H @@ -1138,7 +1138,7 @@ result->num_rows++; i= result->store ? result->num_rows- 1 : 0; if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) { - result->data = (zval **) erealloc(result->data, sizeof(zval *)*SYBASE_ROWS_BLOCK*(++result->blocks_initialized)); + result->data = (zval **) safe_erealloc(result->data, SYBASE_ROWS_BLOCK*(++result->blocks_initialized), sizeof(zval *), 0); } if (result->store || 1 == result->num_rows) { result->data[i] = (zval *) safe_emalloc(sizeof(zval), result->num_fields, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thetaphiTue Jul 25 09:20:32 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: MFH: Fix compilation with TSRM (now correct) http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.5&r2=1.103.2.5.2.6&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.5 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.6 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.5 Tue Jul 25 09:19:38 2006 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Jul 25 09:20:32 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.5 2006/07/25 09:19:38 thetaphi Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.6 2006/07/25 09:20:32 thetaphi Exp $ */ #ifdef HAVE_CONFIG_H @@ -161,7 +161,7 @@ } /* Forward declaration */ -static int php_sybase_finish_results (sybase_result *result); +static int php_sybase_finish_results (sybase_result *result TSRMLS_DC); static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { @@ -172,7 +172,7 @@ if (result->sybase_ptr->cmd) { ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); } - php_sybase_finish_results(result); + php_sybase_finish_results(result TSRMLS_CC); } _free_sybase_result(result); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thetaphiTue Jul 25 09:19:39 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: revert shitty whitespace patch (forgot to reconfigure my editor after reinstallation) http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.4&r2=1.103.2.5.2.5&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.4 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.5 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.4 Tue Jul 25 08:42:54 2006 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Jul 25 09:19:38 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.4 2006/07/25 08:42:54 thetaphi Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.5 2006/07/25 09:19:38 thetaphi Exp $ */ #ifdef HAVE_CONFIG_H @@ -161,7 +161,7 @@ } /* Forward declaration */ -static int php_sybase_finish_results (sybase_result *result TSRMLS_DC); +static int php_sybase_finish_results (sybase_result *result); static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { @@ -172,7 +172,7 @@ if (result->sybase_ptr->cmd) { ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); } - php_sybase_finish_results(result TSRMLS_CC); + php_sybase_finish_results(result); } _free_sybase_result(result); @@ -290,10 +290,10 @@ ZVAL_LONG(line, srvmsg->line); args[3] = &line; - MAKE_STD_ZVAL(text); + MAKE_STD_ZVAL(text); ZVAL_STRING(text, srvmsg->text, 1); args[4] = &text; - + if (call_user_function_ex(EG(function_table), NULL, callback_name, &retval, 5, args, 0, NULL TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot call the messagehandler %s", Z_STRVAL_P(callback_name)); } @@ -401,10 +401,10 @@ } } - /* Set the timeout, which is per context and can't be set with -* ct_con_props(), so set it globally from the config value if + /* Set the timeout, which is per context and can't be set with +* ct_con_props(), so set it globally from the config value if * requested. The default is CS_NO_LIMIT. -* +* * Note that despite some noise in the documentation about using * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. @@ -502,7 +502,7 @@ } if (appname) { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, appname, CS_NULLTERM, NULL); - } else { + } else { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, SybCtG(appname), CS_NULLTERM, NULL); } @@ -527,7 +527,7 @@ } } } - + if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize."); @@ -535,15 +535,15 @@ } /* Set the login timeout. Actually, the login timeout is per context -* and not per connection, but we will update the context here to +* and not per connection, but we will update the context here to * allow for code such as the following: -* +* * ini_set('sybct.login_timeout', $timeout); * sybase_connect(...) -* -* Note that preceding calls to sybase_connect() will now use the +* +* Note that preceding calls to sybase_connect() will now use the * updated value and not the default one! -* +* * The default value for CS_LOGIN_TIMEOUT is 60 (1 minute). */ if (SybCtG(login_timeout) != -1) { @@ -1020,12 +1020,12 @@ /* }}} */ -static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) +static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) { int i, fail; CS_RETCODE retcode; CS_INT restype; - + efree(result->datafmt); efree(result->lengths); efree(result->indicators); @@ -1101,7 +1101,7 @@ * dead ourselves. */ result->sybase_ptr->dead = 1; - + case CS_CANCELED: default: _free_sybase_result(result); @@ -1131,12 +1131,12 @@ int i, j; CS_INT retcode;
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
thetaphiTue Jul 25 08:42:54 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: Fix compilation with TSRM http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.3&r2=1.103.2.5.2.4&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.3 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.4 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.3 Sun Jul 23 23:50:43 2006 +++ php-src/ext/sybase_ct/php_sybase_ct.c Tue Jul 25 08:42:54 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.3 2006/07/23 23:50:43 sniper Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.4 2006/07/25 08:42:54 thetaphi Exp $ */ #ifdef HAVE_CONFIG_H @@ -161,7 +161,7 @@ } /* Forward declaration */ -static int php_sybase_finish_results (sybase_result *result); +static int php_sybase_finish_results (sybase_result *result TSRMLS_DC); static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { @@ -172,7 +172,7 @@ if (result->sybase_ptr->cmd) { ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); } - php_sybase_finish_results(result); + php_sybase_finish_results(result TSRMLS_CC); } _free_sybase_result(result); @@ -290,10 +290,10 @@ ZVAL_LONG(line, srvmsg->line); args[3] = &line; - MAKE_STD_ZVAL(text); + MAKE_STD_ZVAL(text); ZVAL_STRING(text, srvmsg->text, 1); args[4] = &text; - + if (call_user_function_ex(EG(function_table), NULL, callback_name, &retval, 5, args, 0, NULL TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot call the messagehandler %s", Z_STRVAL_P(callback_name)); } @@ -401,10 +401,10 @@ } } - /* Set the timeout, which is per context and can't be set with -* ct_con_props(), so set it globally from the config value if + /* Set the timeout, which is per context and can't be set with +* ct_con_props(), so set it globally from the config value if * requested. The default is CS_NO_LIMIT. -* +* * Note that despite some noise in the documentation about using * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. @@ -502,7 +502,7 @@ } if (appname) { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, appname, CS_NULLTERM, NULL); - } else { + } else { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, SybCtG(appname), CS_NULLTERM, NULL); } @@ -527,7 +527,7 @@ } } } - + if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize."); @@ -535,15 +535,15 @@ } /* Set the login timeout. Actually, the login timeout is per context -* and not per connection, but we will update the context here to +* and not per connection, but we will update the context here to * allow for code such as the following: -* +* * ini_set('sybct.login_timeout', $timeout); * sybase_connect(...) -* -* Note that preceding calls to sybase_connect() will now use the +* +* Note that preceding calls to sybase_connect() will now use the * updated value and not the default one! -* +* * The default value for CS_LOGIN_TIMEOUT is 60 (1 minute). */ if (SybCtG(login_timeout) != -1) { @@ -1020,12 +1020,12 @@ /* }}} */ -static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) +static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) { int i, fail; CS_RETCODE retcode; CS_INT restype; - + efree(result->datafmt); efree(result->lengths); efree(result->indicators); @@ -1101,7 +1101,7 @@ * dead ourselves. */ result->sybase_ptr->dead = 1; - + case CS_CANCELED: default: _free_sybase_result(result); @@ -1131,12 +1131,12 @@ int i, j; CS_INT retcode; TSRMLS_FETCH(); - + /* We've already fetched
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
sniper Sun Jul 23 23:50:43 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: MFH: fix compile failure and remove unnecessary TSRMLS_FETCH calls http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.2&r2=1.103.2.5.2.3&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.2 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.3 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.2 Thu Jun 15 18:33:09 2006 +++ php-src/ext/sybase_ct/php_sybase_ct.c Sun Jul 23 23:50:43 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.2 2006/06/15 18:33:09 dmitry Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.3 2006/07/23 23:50:43 sniper Exp $ */ #ifdef HAVE_CONFIG_H @@ -374,7 +374,6 @@ static PHP_GINIT_FUNCTION(sybase) { long opt; - TSRMLS_FETCH(); if (cs_ctx_alloc(CTLIB_VERSION, &sybase_globals->context)!=CS_SUCCEED || ct_init(sybase_globals->context, CTLIB_VERSION)!=CS_SUCCEED) { return; @@ -477,11 +476,10 @@ } -static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char *user, char *passwd, char *charset, char *appname) +static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char *user, char *passwd, char *charset, char *appname TSRMLS_DC) { CS_LOCALE *tmp_locale; long packetsize; - TSRMLS_FETCH(); /* set a CS_CONNECTION record */ if (ct_con_alloc(SybCtG(context), &sybase->connection)!=CS_SUCCEED) { @@ -708,7 +706,7 @@ } sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link)); - if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) { + if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname TSRMLS_CC)) { free(sybase_ptr); efree(hashed_details); RETURN_FALSE; @@ -762,7 +760,7 @@ * NULL before trying to use it elsewhere . . .) */ memcpy(&sybase, sybase_ptr, sizeof(sybase_link)); - if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) { + if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname TSRMLS_CC)) { memcpy(sybase_ptr, &sybase, sizeof(sybase_link)); efree(hashed_details); RETURN_FALSE; @@ -806,7 +804,7 @@ } sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link)); - if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname)) { + if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd, charset, appname TSRMLS_CC)) { efree(sybase_ptr); efree(hashed_details); RETURN_FALSE; @@ -1022,12 +1020,11 @@ /* }}} */ -static int php_sybase_finish_results (sybase_result *result) +static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) { int i, fail; CS_RETCODE retcode; CS_INT restype; - TSRMLS_FETCH(); efree(result->datafmt); efree(result->lengths); @@ -1209,7 +1206,7 @@ result->last_retcode= retcode; switch (retcode) { case CS_END_DATA: - retcode = php_sybase_finish_results(result); + retcode = php_sybase_finish_results(result TSRMLS_CC); break; case CS_ROW_FAIL: @@ -1434,7 +1431,7 @@ */ #if O_TIMM if (result) { - php_sybase_finish_results(result); + php_sybase_finish_results(result TSRMLS_CC); } #endif @@ -1669,7 +1666,7 @@ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results"); */ ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); - php_sybase_finish_results(result); + php_sybase_finish_results(result TSRMLS_CC); } zend_list_delete(Z_LVAL_PP(sybase_result_index)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sybase_ct php_sybase_ct.c
tony2001Wed May 24 20:21:02 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase_ct php_sybase_ct.c Log: fix #37499 (CLI segmentation faults during cleanup (only with sybase-ct extension enabled)) http://cvs.php.net/viewcvs.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5&r2=1.103.2.5.2.1&diff_format=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5 php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.1 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5 Sun Jan 1 12:50:16 2006 +++ php-src/ext/sybase_ct/php_sybase_ct.c Wed May 24 20:21:02 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.103.2.5 2006/01/01 12:50:16 sniper Exp $ */ +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.1 2006/05/24 20:21:02 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H @@ -442,6 +442,11 @@ PHP_MSHUTDOWN_FUNCTION(sybase) { UNREGISTER_INI_ENTRIES(); +#ifdef ZTS + ts_free_id(sybase_globals_id); +#else + php_sybase_destroy_globals(&sybase_globals TSRMLS_CC); +#endif #if 0 ct_exit(context, CS_UNUSED); cs_ctx_drop(context); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php