- Improved support for autoconf-2.50+/libtool 1.4b+. (Jan Kneschke, Sascha)
?? ??? 200?, Version 4.0.7
+- Fixed pg_last_notice() (Zeev)
- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of
E_ERROR error's, this allows you to trap errors thrown by DOMXML functions.
(Sterling)
PQfinish(link);
PGG(num_persistent)--;
PGG(num_links)--;
- if(PGG(last_notice) != NULL) {
- efree(PGG(last_notice));
- }
}
/* }}} */
/* {{{ _notice_handler
*/
-static void
-_notice_handler(void *arg, const char *message)
+static void _notice_handler(void *arg, const char *message)
{
TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
php_log_err((char *) message TSRMLS_CC);
- if (PGG(last_notice) != NULL) {
+ if (PGG(last_notice)) {
efree(PGG(last_notice));
}
- PGG(last_notice) = estrdup(message);
+ PGG(last_notice_len) = strlen(message);
+ PGG(last_notice) = estrndup(message, PGG(last_notice_len));
}
}
/* }}} */
{
PGG(num_persistent) = 0;
PGG(ignore_notices) = 0;
- PGG(last_notice) = NULL;
}
/* }}} */
{
PGG(default_link)=-1;
PGG(num_links) = PGG(num_persistent);
+ PGG(last_notice) = NULL;
return SUCCESS;
}
/* }}} */
*/
PHP_RSHUTDOWN_FUNCTION(pgsql)
{
+ if (PGG(last_notice)) {
+ efree(PGG(last_notice));
+ }
zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC);
return SUCCESS;
}
Returns the last notice set by the backend */
PHP_FUNCTION(pg_last_notice)
{
- if (PGG(last_notice) == NULL) {
- RETURN_FALSE;
+ if (PGG(last_notice)) {
+ RETURN_STRINGL(PGG(last_notice), PGG(last_notice_len), 0);
} else {
- RETURN_STRING(PGG(last_notice),0);
+ RETURN_FALSE;
}
}
/* }}} */