com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/pgsql/pgsql.c
| From: | Yasuo Ohgaki | Date: | Thu, 29 Mar 2012 10:55:06 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68608@lists.php.net to get a copy of this message | ||
Commit: aecf5485e3af6a1e405f29f653353ae1237dbb3e
Author: Yasuo Ohgaki <yohgaki@ohgaki.net> Thu, 29 Mar 2012 19:55:06 +0900
Parents: 1d8664b90b4007b81206d39f3453eb4e7987776d 931831bf75d645bdb9f079793b0224bb4843a7a3
Branches: PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aecf5485e3af6a1e405f29f653353ae1237dbb3e
Log:
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
Fixed bug #60718 Complie problem with libpq (PostgreSQL 7.3 or less)
Bugs:
https://bugs.php.net/60718
Changed paths:
MM ext/pgsql/pgsql.c
Diff:
aecf5485e3af6a1e405f29f653353ae1237dbb3e
diff --combined ext/pgsql/pgsql.c
index 5702fe2,4a92944..d8127af
--- a/ext/pgsql/pgsql..c
+++ b/ext/pgsql/pgsql.c
@@@ -2503,8 -2503,12 +2503,8 @@@ static void php_pgsql_fetch_hash(INTERN
int should_copy=0;
const uint element_len = strlen(element);
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
- } else {
- data = safe_estrndup(element, element_len);
- data_len = element_len;
- }
+ data = safe_estrndup(element, element_len);
+ data_len = element_len;
if (result_type & PGSQL_NUM) {
add_index_stringl(return_value, i, data, data_len, should_copy);
@@@ -2879,7 -2883,7 +2879,7 @@@ PHP_FUNCTION(pg_trace
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link,
le_plink);
- stream = php_stream_open_wrapper(z_filename, mode, ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
+ stream = php_stream_open_wrapper(z_filename, mode, REPORT_ERRORS, NULL);
if (!stream) {
RETURN_FALSE;
@@@ -3169,7 -3173,7 +3169,7 @@@ PHP_FUNCTION(pg_lo_open
} else {
pgsql_lofp->conn = pgsql;
pgsql_lofp->lofd = pgsql_lofd;
- Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp);
+ Z_LVAL_P(return_value) = zend_list_insert(pgsql_lofp, le_lofp TSRMLS_CC);
Z_TYPE_P(return_value) = IS_LONG;
}
}
@@@ -3322,22 -3326,30 +3322,22 @@@ PHP_FUNCTION(pg_lo_import
Oid returned_oid;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rs|z", &pgsql_link, &file_in, &name_len, &oid) == SUCCESS) {
+ "rp|z", &pgsql_link, &file_in, &name_len, &oid) == SUCCESS) {
;
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "s|z", &file_in, &name_len, &oid) == SUCCESS) {
+ "p|z", &file_in, &name_len, &oid) == SUCCESS) {
id = PGG(default_link);
CHECK_DEFAULT_LINK(id);
}
/* old calling convention, deprecated since PHP 4.2 */
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "sr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
+ "pr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used");
}
else {
WRONG_PARAM_COUNT;
}
-
- if (strlen(file_in) != name_len) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(file_in, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
if (php_check_open_basedir(file_in TSRMLS_CC)) {
RETURN_FALSE;
@@@ -3412,7 -3424,7 +3412,7 @@@ PHP_FUNCTION(pg_lo_export
/* allow string to handle large OID value correctly */
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "rls", &pgsql_link, &oid_long, &file_out, &name_len) ==
SUCCESS) {
+ "rlp", &pgsql_link, &oid_long, &file_out, &name_len) ==
SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@@ -3429,7 -3441,7 +3429,7 @@@
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ls", &oid_long, &file_out, &name_len) == SUCCESS) {
+ "lp", &oid_long, &file_out, &name_len) == SUCCESS) {
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
@@@ -3439,7 -3451,7 +3439,7 @@@
CHECK_DEFAULT_LINK(id);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ss", &oid_string, &oid_strlen, &file_out, &name_len) ==
SUCCESS) {
+ "sp", &oid_string, &oid_strlen, &file_out, &name_len) ==
SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
@@@ -3450,7 -3462,7 +3450,7 @@@
CHECK_DEFAULT_LINK(id);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ssr", &oid_string, &oid_strlen, &file_out, &name_len,
&pgsql_link) == SUCCESS) {
+ "spr", &oid_string, &oid_strlen, &file_out, &name_len,
&pgsql_link) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
@@@ -3459,7 -3471,7 +3459,7 @@@
}
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "lsr", &oid_long, &file_out, &name_len, &pgsql_link) ==
SUCCESS) {
+ "lpr", &oid_long, &file_out, &name_len, &pgsql_link) ==
SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used");
if (oid_long <= InvalidOid) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
@@@ -3471,6 -3483,14 +3471,6 @@@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 2 or 3 arguments");
RETURN_FALSE;
}
-
- if (strlen(file_out) != name_len) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(file_out, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
if (php_check_open_basedir(file_out TSRMLS_CC)) {
RETURN_FALSE;
@@@ -4787,7 -4807,9 +4787,9 @@@ PHP_FUNCTION(pg_get_notify
#else
if (atof(PG_VERSION) >= 9.0) {
#endif
+ #if HAVE_PQPARAMETERSTATUS
add_index_string(return_value, 2, pgsql_notify->extra, 1);
+ #endif
}
}
if (result_type & PGSQL_ASSOC) {
@@@ -4798,7 -4820,9 +4800,9 @@@
#else
if (atof(PG_VERSION) >= 9.0) {
#endif
+ #if HAVE_PQPARAMETERSTATUS
add_assoc_string(return_value, "payload", pgsql_notify->extra, 1);
+ #endif
}
}
PQfreemem(pgsql_notify);
@@@ -6213,9 -6237,12 +6217,9 @@@ PHP_PGSQL_API int php_pgsql_result2arra
size_t data_len;
const size_t element_len = strlen(element);
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(element, element_len, &data_len, 0 TSRMLS_CC);
- } else {
- data = safe_estrndup(element, element_len);
- data_len = element_len;
- }
+ data = safe_estrndup(element, element_len);
+ data_len = element_len;
+
field_name = PQfname(pg_result, i);
add_assoc_stringl(row, field_name, data, data_len, 0);
}