php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52389
Patch pgsql-fixed.diff revision 2010-10-18 10:53 UTC by jaromir dot dolecek at skype dot net
Patch pgsql.patch revision 2010-07-21 13:51 UTC by miroslav dot zacek at skype dot net

Patch pgsql.patch for PostgreSQL related Bug #52389

Patch version 2010-07-21 13:51 UTC

Return to Bug #52389 | Download this patch
Patch Revisions:

Developer: miroslav.zacek@skype.net

*** a/ext/pgsql/pgsql.c	2010-01-03 10:23:27.000000000 +0100
--- b/ext/pgsql/pgsql.c	2010-07-21 13:58:20.354669750 +0200
*************** static char * _php_pgsql_trim_message(co
*** 742,748 ****
  	if (len) {
  		*len = i;
  	}
! 	return estrndup(message, i);
  }
  /* }}} */
  
--- 742,752 ----
  	if (len) {
  		*len = i;
  	}
! 	
! 	//return estrndup(message, i);
! 	char *ret_msg = (char *)pemalloc((i+1)*sizeof(char), 1);
! 	memcpy(ret_msg, message, (i+1)*sizeof(char));
! 	return ret_msg;
  }
  /* }}} */
  
*************** static void _php_pgsql_notice_handler(vo
*** 814,820 ****
  	
  	TSRMLS_FETCH();
  	if (! PGG(ignore_notices)) {
! 		notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
  		notice->message = _php_pgsql_trim_message(message, &notice->len);
  		if (PGG(log_notices)) {
  			php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
--- 818,824 ----
  	
  	TSRMLS_FETCH();
  	if (! PGG(ignore_notices)) {
! 		notice = (php_pgsql_notice *)pemalloc(sizeof(php_pgsql_notice), 1);
  		notice->message = _php_pgsql_trim_message(message, &notice->len);
  		if (PGG(log_notices)) {
  			php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
*************** static void _php_pgsql_notice_handler(vo
*** 824,839 ****
  }
  /* }}} */
  
! #define PHP_PGSQL_NOTICE_PTR_DTOR (void (*)(void *))_php_pgsql_notice_ptr_dtor
  
  /* {{{ _php_pgsql_notice_dtor
   */
  static void _php_pgsql_notice_ptr_dtor(void **ptr) 
  {
  	php_pgsql_notice *notice = (php_pgsql_notice *)*ptr;
! 	if (notice) {
!  		efree(notice->message);
!   		efree(notice);
    		notice = NULL;
    	}
  }
--- 828,844 ----
  }
  /* }}} */
  
! #define PHP_PGSQL_NOTICE_PTR_DTOR (void (*)(void **))_php_pgsql_notice_ptr_dtor
  
  /* {{{ _php_pgsql_notice_dtor
   */
  static void _php_pgsql_notice_ptr_dtor(void **ptr) 
  {
  	php_pgsql_notice *notice = (php_pgsql_notice *)*ptr;
! 	int ref_count =  (*(zval*)*ptr).refcount__gc;
! 	if (notice && ref_count) {
!  		pefree(notice->message, 1);
!   		pefree(notice, 1);
    		notice = NULL;
    	}
  }
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 13:01:30 2024 UTC