diff options
author | Xinchen Hui <laruence@php.net> | 2014-08-28 17:04:04 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2014-08-28 17:04:04 +0800 |
commit | 31d6f15b540a264c1ef645e28f2ccdc475787c77 (patch) | |
tree | 34d1829130065513b995a73f1bd116ee497c343c | |
parent | 537344161f9d1528d9c8095883def9519fc8f99e (diff) | |
parent | d2e416a90b0e8a0194afbcd9ab6365ff0a259406 (diff) | |
download | php-git-31d6f15b540a264c1ef645e28f2ccdc475787c77.tar.gz |
Merge branch 'master' of https://git.php.net/repository/php-src
-rw-r--r-- | ext/mysqli/mysqli_api.c | 2 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 15 |
2 files changed, 11 insertions, 6 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 10793060ae..962cab600b 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -37,7 +37,7 @@ #if !defined(MYSQLI_USE_MYSQLND) /* {{{ mysqli_tx_cor_options_to_string */ -static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const unsigned size_t mode) +static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const size_t mode) { if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) { if (str->s && str->s->len) { diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 3ee49b762e..21d02be517 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -877,9 +877,9 @@ static char *php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le #endif /* {{{ _php_pgsql_trim_message */ -static char * _php_pgsql_trim_message(const char *message, int *len) +static char * _php_pgsql_trim_message(const char *message, size_t *len) { - register int i = strlen(message)-1; + register size_t i = strlen(message)-1; if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') { --i; @@ -964,7 +964,7 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message) TSRMLS_FETCH(); if (! PGG(ignore_notices)) { notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice)); - notice->message = _php_pgsql_trim_message(message, (int *)¬ice->len); + notice->message = _php_pgsql_trim_message(message, ¬ice->len); if (PGG(log_notices)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message); } @@ -2305,7 +2305,7 @@ PHP_FUNCTION(pg_affected_rows) Returns the last notice set by the backend */ PHP_FUNCTION(pg_last_notice) { - zval *pgsql_link; + zval *pgsql_link = NULL; PGconn *pg_link; int id = -1; php_pgsql_notice *notice; @@ -2313,10 +2313,15 @@ PHP_FUNCTION(pg_last_notice) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { return; } + + if (pgsql_link == NULL && id == -1) { + RETURN_FALSE; + } + /* Just to check if user passed valid resoruce */ ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - if ((notice = zend_hash_index_find_ptr(&PGG(notices), Z_RES_HANDLE_P(pgsql_link))) == NULL) { + if ((notice = zend_hash_index_find_ptr(&PGG(notices), (zend_ulong)Z_RES_HANDLE_P(pgsql_link))) == NULL) { RETURN_FALSE; } RETURN_STRINGL(notice->message, notice->len); |