[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pgsql pgsql.c
felipe Tue Jan 27 14:44:07 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: - Fixed parameter format http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.35&r2=1.331.2.13.2.36&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.35 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.36 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.35 Tue Jan 27 14:40:13 2009 +++ php-src/ext/pgsql/pgsql.c Tue Jan 27 14:44:07 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.35 2009/01/27 14:40:13 felipe Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.36 2009/01/27 14:44:07 felipe Exp $ */ #include @@ -1735,7 +1735,7 @@ char *table_name; zend_rsrc_list_entry *field_table; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b!", &result, &fnum, &return_oid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b", &result, &fnum, &return_oid) == FAILURE) { return; } -- 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/pgsql pgsql.c
felipe Tue Jan 27 14:40:14 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: - Removed wrong '/' in parameter format http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.34&r2=1.331.2.13.2.35&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.34 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.35 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.34 Sun Jan 18 23:51:15 2009 +++ php-src/ext/pgsql/pgsql.c Tue Jan 27 14:40:13 2009 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.34 2009/01/18 23:51:15 felipe Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.35 2009/01/27 14:40:13 felipe Exp $ */ #include @@ -3454,7 +3454,7 @@ ExecStatusType status; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rs/a|ss", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|ss", &pgsql_link, &table_name, &table_name_len, &pg_rows, &pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) { return; -- 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/pgsql pgsql.c
felipe Wed Oct 15 13:34:46 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: - Fixed possible efree(NULL) http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.30&r2=1.331.2.13.2.31&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.30 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.31 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.30 Mon Oct 13 13:46:25 2008 +++ php-src/ext/pgsql/pgsql.c Wed Oct 15 13:34:45 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.30 2008/10/13 13:46:25 felipe Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.31 2008/10/15 13:34:45 felipe Exp $ */ #include @@ -1201,7 +1201,9 @@ if (num_params > 0) { int i; for (i = 0; i < num_params; i++) { - efree(params[i]); + if (params[i]) { + efree(params[i]); + } } efree(params); } -- 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/pgsql pgsql.c /ext/pgsql/tests bug37100.phpt
felipe Mon Oct 13 13:46:25 2008 UTC Added files: (Branch: PHP_5_2) /php-src/ext/pgsql/testsbug37100.phpt Modified files: /php-src/ext/pgsql pgsql.c Log: MFH: - Fixed bug #37100 (data is returned truncated with BINARY CURSOR) Patch by Tony http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.29&r2=1.331.2.13.2.30&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.29 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.30 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.29 Tue Oct 7 14:35:04 2008 +++ php-src/ext/pgsql/pgsql.c Mon Oct 13 13:46:25 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.29 2008/10/07 14:35:04 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.30 2008/10/13 13:46:25 felipe Exp $ */ #include @@ -1983,10 +1983,9 @@ if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) { Z_TYPE_P(return_value) = IS_NULL; } else { - Z_STRVAL_P(return_value) = PQgetvalue(pgsql_result, pgsql_row, field_offset); - Z_STRLEN_P(return_value) = (Z_STRVAL_P(return_value) ? strlen(Z_STRVAL_P(return_value)) : 0); - Z_STRVAL_P(return_value) = safe_estrndup(Z_STRVAL_P(return_value),Z_STRLEN_P(return_value)); - Z_TYPE_P(return_value) = IS_STRING; + char *value = PQgetvalue(pgsql_result, pgsql_row, field_offset); + int value_len = PQgetlength(pgsql_result, pgsql_row, field_offset); + ZVAL_STRINGL(return_value, value, value_len, 1); } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/tests/bug37100.phpt?view=markup&rev=1.1 Index: php-src/ext/pgsql/tests/bug37100.phpt +++ php-src/ext/pgsql/tests/bug37100.phpt --TEST-- Bug #37100 (data is returned truncated with BINARY CURSOR) --SKIPIF-- --FILE-- --EXPECT-- string(24) "\001\003\252\000\010\022" string(12) "0103aa000812" int(6) string(12) "0103aa000812" -- 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/pgsql pgsql.c
iliaa Wed Sep 5 13:03:59 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: MFH: fixed typo in function name http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.23&r2=1.331.2.13.2.24&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.23 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.24 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.23 Mon Sep 3 15:36:04 2007 +++ php-src/ext/pgsql/pgsql.c Wed Sep 5 13:03:59 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.23 2007/09/03 15:36:04 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.24 2007/09/05 13:03:59 iliaa Exp $ */ #include @@ -82,7 +82,7 @@ #define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); } #ifndef HAVE_PQFREEMEM -#define PGfreemem free +#define PQfreemem free #endif ZEND_DECLARE_MODULE_GLOBALS(pgsql) -- 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/pgsql pgsql.c /ext/standard dl.c /ext/sybase php_sybase_db.c /ext/sybase_ct php_sybase_ct.c
iliaa Fri Feb 23 00:37:36 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/sybase php_sybase_db.c /php-src/ext/standard dl.c /php-src/ext/sybase_ct php_sybase_ct.c /php-src/ext/pgsql pgsql.c Log: Simplify code by converting emalloc() + sprintf() to spprintf() http://cvs.php.net/viewvc.cgi/php-src/ext/sybase/php_sybase_db.c?r1=1.66.2.5.2.1&r2=1.66.2.5.2.2&diff_format=u Index: php-src/ext/sybase/php_sybase_db.c diff -u php-src/ext/sybase/php_sybase_db.c:1.66.2.5.2.1 php-src/ext/sybase/php_sybase_db.c:1.66.2.5.2.2 --- php-src/ext/sybase/php_sybase_db.c:1.66.2.5.2.1 Mon Jan 1 09:36:09 2007 +++ php-src/ext/sybase/php_sybase_db.c Fri Feb 23 00:37:35 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_sybase_db.c,v 1.66.2.5.2.1 2007/01/01 09:36:09 sebastian Exp $ */ +/* $Id: php_sybase_db.c,v 1.66.2.5.2.2 2007/02/23 00:37:35 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -327,9 +327,7 @@ } convert_to_string_ex(yyhost); host = Z_STRVAL_PP(yyhost); - hashed_details_length = Z_STRLEN_PP(yyhost)+6+5; - hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s", Z_STRVAL_PP(yyhost)); + hashed_details_length = spprintf(&hashed_details, 0, "sybase_%s", Z_STRVAL_PP(yyhost)); } break; case 2: { @@ -342,9 +340,7 @@ convert_to_string_ex(yyuser); host = Z_STRVAL_PP(yyhost); user = Z_STRVAL_PP(yyuser); - hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+6+5; - hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s___",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser)); + hashed_details_length = sprintf(&hashed_details, 0, "sybase_%s_%s___", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser)); } break; case 3: { @@ -359,9 +355,7 @@ host = Z_STRVAL_PP(yyhost); user = Z_STRVAL_PP(yyuser); passwd = Z_STRVAL_PP(yypasswd); - hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+6+5; - hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s_%s__",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd)); /* SAFE */ + spprintf(&hashed_details, 0, "sybase_%s_%s_%s__", Z_STRVAL_PP(yyhost), Z_STRVAL_PP(yyuser), Z_STRVAL_PP(yypasswd)); } break; case 4: { @@ -378,9 +372,7 @@ user = Z_STRVAL_PP(yyuser); passwd = Z_STRVAL_PP(yypasswd); charset = Z_STRVAL_PP(yycharset); - hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_PP(yycharset)+6+5; - hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"sybase_%s_%s_%s_%s_",Z_STRVAL_PP(yyhost),Z_STRVAL_PP(yyuser),Z_STRVAL_PP(yypasswd),Z_STRVAL_PP(yycharset)); /* SAFE */ + 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: { @@ -399,9 +391,7 @@ passwd = Z_STRVAL_PP(yypasswd); charset = Z_STRVAL_PP(yycharset); appname = Z_STRVAL_PP(yyappname); - hashed_details_length = Z_STRLEN_PP(yyhost)+Z_STRLEN_PP(yyuser)+Z_STRLEN_PP(yypasswd)+Z_STRLEN_PP(yycharset)+Z_STRLEN_PP(yyappname)+6+5; - hashed_details = (char *) emalloc(hashed_details_length+1); - sprintf(hashed_details,"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)); /* SAFE */ + 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
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pgsql pgsql.c
tony2001Thu Jan 11 16:45:37 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.17&r2=1.331.2.13.2.18&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.17 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.18 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.17 Sun Jan 7 04:36:40 2007 +++ php-src/ext/pgsql/pgsql.c Thu Jan 11 16:45:37 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.17 2007/01/07 04:36:40 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.18 2007/01/11 16:45:37 tony2001 Exp $ */ #include @@ -3492,10 +3492,11 @@ #if HAVE_PQPUTCOPYDATA while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_PP(tmp) +2); - strcpy(query, Z_STRVAL_PP(tmp)); - if(*(query+Z_STRLEN_PP(tmp)-1) != '\n') - strcat(query, "\n"); + query = (char *)emalloc(Z_STRLEN_PP(tmp) + 2); + strlcpy(query, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) + 2); + if(Z_STRLEN_PP(tmp) > 0 && *(query + Z_STRLEN_PP(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRLEN_PP(tmp) + 2); + } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); PHP_PQ_ERROR("copy failed: %s", pgsql); @@ -3511,10 +3512,11 @@ #else while (zend_hash_get_current_data_ex(Z_ARRVAL_P(pg_rows), (void **) &tmp, &pos) == SUCCESS) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_PP(tmp) +2); - strcpy(query, Z_STRVAL_PP(tmp)); - if(*(query+Z_STRLEN_PP(tmp)-1) != '\n') - strcat(query, "\n"); + query = (char *)emalloc(Z_STRLEN_PP(tmp) + 2); + strlcpy(query, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp) + 2); + if(Z_STRLEN_PP(tmp) > 0 && *(query + Z_STRLEN_PP(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRLEN_PP(tmp) + 2); + } if (PQputline(pgsql, query)==EOF) { efree(query); PHP_PQ_ERROR("copy failed: %s", pgsql); -- 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/pgsql pgsql.c
iliaa Thu Dec 28 15:21:21 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: Added buffer length checks http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.12&r2=1.331.2.13.2.13&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.12 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.13 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.12 Mon Dec 25 22:36:57 2006 +++ php-src/ext/pgsql/pgsql.c Thu Dec 28 15:21:21 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.12 2006/12/25 22:36:57 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.13 2006/12/28 15:21:21 iliaa Exp $ */ #include @@ -5485,7 +5485,7 @@ smart_str_append_long(querystr, Z_LVAL_PP(val)); break; case IS_DOUBLE: - smart_str_appendl(querystr, buf, sprintf(buf, "%f", Z_DVAL_PP(val))); + smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%f", Z_DVAL_PP(val)), sizeof(buf)-1)); break; default: /* should not happen */ -- 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/pgsql pgsql.c /ext/soap php_encoding.c /ext/spl spl_directory.c /ext/standard math.c /main main.c
iliaa Mon Dec 25 22:36:57 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main main.c /php-src/ext/standard math.c /php-src/ext/soap php_encoding.c /php-src/ext/splspl_directory.c /php-src/ext/pgsql pgsql.c Log: Allocation safety checks http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.24&r2=1.640.2.23.2.25&diff_format=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.640.2.23.2.24 php-src/main/main.c:1.640.2.23.2.25 --- php-src/main/main.c:1.640.2.23.2.24 Thu Dec 21 09:12:42 2006 +++ php-src/main/main.c Mon Dec 25 22:36:57 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.640.2.23.2.24 2006/12/21 09:12:42 dmitry Exp $ */ +/* $Id: main.c,v 1.640.2.23.2.25 2006/12/25 22:36:57 iliaa Exp $ */ /* {{{ includes */ @@ -100,8 +100,13 @@ */ static PHP_INI_MH(OnSetPrecision) { - EG(precision) = atoi(new_value); - return SUCCESS; + int i = atoi(new_value); + if (i >= 0) { + EG(precision) = i; + return SUCCESS; + } else { + return FAILURE; + } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.131.2.2.2.3&r2=1.131.2.2.2.4&diff_format=u Index: php-src/ext/standard/math.c diff -u php-src/ext/standard/math.c:1.131.2.2.2.3 php-src/ext/standard/math.c:1.131.2.2.2.4 --- php-src/ext/standard/math.c:1.131.2.2.2.3 Fri Dec 22 04:03:15 2006 +++ php-src/ext/standard/math.c Mon Dec 25 22:36:57 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: math.c,v 1.131.2.2.2.3 2006/12/22 04:03:15 iliaa Exp $ */ +/* $Id: math.c,v 1.131.2.2.2.4 2006/12/25 22:36:57 iliaa Exp $ */ #include "php.h" #include "php_math.h" @@ -976,7 +976,7 @@ dec = MAX(0, dec); PHP_ROUND_WITH_FUZZ(d, dec); - tmplen = spprintf(&tmpbuf, 0, "%.*f", dec, d); + tmplen = spprintf(&tmpbuf, 0, "%.*F", dec, d); if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { return tmpbuf; http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.103.2.21.2.18&r2=1.103.2.21.2.19&diff_format=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.103.2.21.2.18 php-src/ext/soap/php_encoding.c:1.103.2.21.2.19 --- php-src/ext/soap/php_encoding.c:1.103.2.21.2.18 Tue Dec 19 11:54:38 2006 +++ php-src/ext/soap/php_encoding.c Mon Dec 25 22:36:57 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_encoding.c,v 1.103.2.21.2.18 2006/12/19 11:54:38 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.103.2.21.2.19 2006/12/25 22:36:57 iliaa Exp $ */ #include @@ -974,7 +974,7 @@ convert_to_double(&tmp); } - str = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); + str = (char *) safe_emalloc(EG(precision), 1, MAX_LENGTH_OF_DOUBLE + 1); php_gcvt(Z_DVAL(tmp), EG(precision), '.', 'E', str); xmlNodeSetContentLen(ret, BAD_CAST(str), strlen(str)); efree(str); http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.45.2.27.2.11&r2=1.45.2.27.2.12&diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.45.2.27.2.11 php-src/ext/spl/spl_directory.c:1.45.2.27.2.12 --- php-src/ext/spl/spl_directory.c:1.45.2.27.2.11 Sun Nov 12 17:16:13 2006 +++ php-src/ext/spl/spl_directory.c Mon Dec 25 22:36:57 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.45.2.27.2.11 2006/11/12 17:16:13 bjori Exp $ */ +/* $Id: spl_directory.c,v 1.45.2.27.2.12 2006/12/25 22:36:57 iliaa Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -1367,7 +1367,7 @@ } if (intern->u.file.max_line_len > 0) { - buf = emalloc((intern->u.file.max_line_len + 1) * sizeof(char)); + buf = safe_emalloc((intern->u.file.max_line_len + 1), sizeof(char), 0); if (php_stream_get_line(intern->u.file.stream, buf, intern->u.file.max_line_len, &line_len) == NULL) { efree(buf); buf = NULL; http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.11&r2=1.331.2.13.2.12&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.11 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.12 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.11 Wed Nov 29 15:45:58 2006 +++ php-src/ext/pgsql/pgsql.c Mon Dec 25 22:36:57 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.11 2006/11/29 15:45:58 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/pgsql pgsql.c
bjori Thu Oct 5 16:02:30 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: - nuke unused variable - "prefer" two arguments - only print "wrong parameter count" once http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.7&r2=1.331.2.13.2.8&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.7 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.8 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.7Wed Oct 4 23:27:03 2006 +++ php-src/ext/pgsql/pgsql.c Thu Oct 5 16:02:29 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.7 2006/10/04 23:27:03 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.8 2006/10/05 16:02:29 bjori Exp $ */ #include @@ -3553,18 +3553,18 @@ { char *from = NULL, *to = NULL; zval *pgsql_link; +#ifdef HAVE_PQESCAPE_CONN PGconn *pgsql; +#endif int to_len; int from_len; - int id; + int id = -1; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &from, &from_len) == SUCCESS) { - id = -1; - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &from, &from_len) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &from, &from_len) == SUCCESS) { pgsql_link = NULL; id = PGG(default_link); - } else { - WRONG_PARAM_COUNT; + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &from, &from_len) == FAILURE) { + return; } to = (char *) safe_emalloc(from_len, 2, 1); -- 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/pgsql pgsql.c
bjori Tue Oct 3 15:21:47 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: pg_send_prepare(), pg_send_query_params() & pg_send_execute() do not throw "Wrong parameter count" http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.5&r2=1.331.2.13.2.6&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.5 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.6 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.5Fri Sep 15 19:47:50 2006 +++ php-src/ext/pgsql/pgsql.c Tue Oct 3 15:21:47 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.5 2006/09/15 19:47:50 iliaa Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.6 2006/10/03 15:21:47 bjori Exp $ */ #include @@ -3997,7 +3997,7 @@ int leftover = 0; if (zend_get_parameters_ex(3, &pgsql_link, &query, &pv_param_arr) == FAILURE) { - return; + WRONG_PARAM_COUNT; } if (pgsql_link == NULL && id == -1) { @@ -4087,7 +4087,7 @@ int leftover = 0; if (zend_get_parameters_ex(3, &pgsql_link, &stmtname, &query) == FAILURE) { - return; + WRONG_PARAM_COUNT; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; @@ -4141,7 +4141,7 @@ int leftover = 0; if (zend_get_parameters_ex(3, &pgsql_link, &stmtname, &pv_param_arr)==FAILURE) { - return; + WRONG_PARAM_COUNT; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; -- 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/pgsql pgsql.c
tony2001Wed Sep 6 12:40:57 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: fix leak in pg_copy_to() when invalid resource was passed http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.3&r2=1.331.2.13.2.4&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.3 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.4 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.3Thu Jun 15 18:33:08 2006 +++ php-src/ext/pgsql/pgsql.c Wed Sep 6 12:40:56 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.3 2006/06/15 18:33:08 dmitry Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.4 2006/09/06 12:40:56 tony2001 Exp $ */ #include @@ -3309,12 +3309,13 @@ if (!pg_delim) { pg_delim = "\t"; } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + if (!pg_null_as) { pg_null_as = safe_estrdup("N"); } - ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); - query = (char *)emalloc(strlen(query_template) + strlen(table_name) + strlen(pg_null_as) + 1); sprintf(query, "COPY \"%s\" TO STDOUT DELIMITERS '%c' WITH NULL AS '%s'", table_name, *pg_delim, pg_null_as); -- 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/pgsql pgsql.c
helly Wed May 10 00:00:13 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c Log: - Update after api changes http://cvs.php.net/viewcvs.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13.2.1&r2=1.331.2.13.2.2&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13.2.1 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.2 --- php-src/ext/pgsql/pgsql.c:1.331.2.13.2.1Sun May 7 00:28:32 2006 +++ php-src/ext/pgsql/pgsql.c Wed May 10 00:00:13 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13.2.1 2006/05/07 00:28:32 edink Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.2 2006/05/10 00:00:13 helly Exp $ */ #include @@ -2107,7 +2107,7 @@ * single value is an array. Also we'd have to make that one * argument passed by reference. */ - zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0 TSRMLS_CC); + zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } } else { @@ -2122,7 +2122,7 @@ fcc.object_pp = &return_value; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name); + zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name); } else { if (retval_ptr) { zval_ptr_dtor(&retval_ptr); @@ -2132,7 +2132,7 @@ efree(fci.params); } } else if (ctor_params) { - zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name); + zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name); } } } -- 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/pgsql pgsql.c php_pgsql.h
edink Sun May 7 00:28:33 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pgsql pgsql.c php_pgsql.h Log: MFH: Added pg_field_table() as per req: #36750 http://cvs.php.net/viewcvs.cgi/php-src/ext/pgsql/pgsql.c?r1=1.331.2.13&r2=1.331.2.13.2.1&diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.331.2.13 php-src/ext/pgsql/pgsql.c:1.331.2.13.2.1 --- php-src/ext/pgsql/pgsql.c:1.331.2.13Mon Apr 10 19:51:55 2006 +++ php-src/ext/pgsql/pgsql.c Sun May 7 00:28:32 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.331.2.13 2006/04/10 19:51:55 helly Exp $ */ +/* $Id: pgsql.c,v 1.331.2.13.2.1 2006/05/07 00:28:32 edink Exp $ */ #include @@ -151,6 +151,7 @@ PHP_FE(pg_field_type_oid, NULL) PHP_FE(pg_field_prtlen, NULL) PHP_FE(pg_field_is_null,NULL) + PHP_FE(pg_field_table, NULL) /* async message function */ PHP_FE(pg_get_notify, NULL) PHP_FE(pg_get_pid, NULL) @@ -1694,6 +1695,95 @@ } /* }}} */ +/* {{{ proto mixed pg_field_table(resource result, int field_number[, bool oid_only]) + Returns the name of the table field belongs to, or table's oid if oid_only is true */ +PHP_FUNCTION(pg_field_table) +{ + zval *result; + pgsql_result_handle *pg_result; + long fnum = -1; + zend_bool return_oid = 0; + Oid oid; + smart_str hash_key = {0}; + char *table_name; + zend_rsrc_list_entry *field_table; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b!", &result, &fnum, &return_oid) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result); + + if (fnum < 0 || fnum >= PQnfields(pg_result->result)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset specified"); + RETURN_FALSE; + } + + oid = PQftable(pg_result->result, fnum); + + if (InvalidOid == oid) { + RETURN_FALSE; + } + + + if (return_oid) { + if (oid > LONG_MAX) { + smart_str oidstr = {0}; + smart_str_append_unsigned(&oidstr, oid); + smart_str_0(&oidstr); + RETURN_STRINGL(oidstr.c, oidstr.len, 0); + } else { + RETURN_LONG((long)oid); + } + } + + /* try to lookup the table name in the resource list */ + smart_str_appends(&hash_key, "pgsql_table_oid_"); + smart_str_append_unsigned(&hash_key, oid); + smart_str_0(&hash_key); + + if (zend_hash_find(&EG(regular_list), hash_key.c, hash_key.len+1, (void **) &field_table) == SUCCESS) { + smart_str_free(&hash_key); + RETURN_STRING((char *)field_table->ptr, 1); + } else { /* Not found, lookup by querying PostgreSQL system tables */ + PGresult *tmp_res; + smart_str querystr = {0}; + zend_rsrc_list_entry new_field_table; + + smart_str_appends(&querystr, "select relname from pg_class where oid="); + smart_str_append_unsigned(&querystr, oid); + smart_str_0(&querystr); + + + if ((tmp_res = PQexec(pg_result->conn, querystr.c)) == NULL || PQresultStatus(tmp_res) != PGRES_TUPLES_OK) { + if (tmp_res) { + PQclear(tmp_res); + } + smart_str_free(&querystr); + smart_str_free(&hash_key); + RETURN_FALSE; + } + + smart_str_free(&querystr); + + if ((table_name = PQgetvalue(tmp_res, 0, 0)) == NULL) { + PQclear(tmp_res); + smart_str_free(&hash_key); + RETURN_FALSE; + } + + Z_TYPE(new_field_table) = le_string; + new_field_table.ptr = estrdup(table_name); + zend_hash_update(&EG(regular_list), hash_key.c, hash_key.len+1, (void *) &new_field_table, sizeof(zend_rsrc_list_entry), NULL); + + smart_str_free(&hash_key); + PQclear(tmp_res); + RETURN_STRING(table_name, 1); + } + +} +/* }}} */ + #define PHP_PG_FIELD_NAME 1 #define PHP_PG_FIELD_SIZE 2 #define PHP_PG_FIELD_TYPE 3 http://cvs.php.net/viewcvs.cgi/php-src/ext/pgsql/php_pgsql.h?r1=1.73.2.1&r2=1.73.2.1.2.1&diff_format=u Index: php-src/ext/pgsql/php_pgsql.h diff -u php-src/ext/pgsql/php_pgsql.h:1.73.2.1 php-src/ext/pgsql/php_pgsql.h:1.73.2.1.2.1 --- php-src/ext/pgsql/php_pgsql.h:1.73.2.1 Sun Jan 1 12:50:12 2006 +++ php-src/ext/pgsql/php_pgsql.h Sun May 7 00:28:32 2006 @@ -17,7 +17,7 @@ +