php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58559 compile errors with ZTS enabled
Submitted: 2009-02-19 14:47 UTC Modified: 2009-02-19 17:45 UTC
From: jason at xlntads dot com Assigned:
Status: Closed Package: memcached (PECL)
PHP Version: 5.2.5 OS: CENTOS 5
Private report: No CVE-ID: None
 [2009-02-19 14:47 UTC] jason at xlntads dot com
Description:
------------
Patch for compilation on ZTS enabled php builds:



Reproduce code:
---------------
*** memcached-0.1.4/php_memcached.c	2009-02-13 15:58:54.000000000 -0500
--- memcached-0.1.4-zts/php_memcached.c	2009-02-19 14:29:07.000000000 -0500
***************
*** 346,352 ****
  
  		status = memcached_mget_by_key(i_obj->memc, server_key, server_key_len, &key, &key_len, 1);
  
! 		if (php_memc_handle_error(status) < 0) {
  			RETURN_FALSE;
  		}
  
--- 346,352 ----
  
  		status = memcached_mget_by_key(i_obj->memc, server_key, server_key_len, &key, &key_len, 1);
  
! 		if (php_memc_handle_error(status TSRMLS_CC) < 0) {
  			RETURN_FALSE;
  		}
  
***************
*** 365,376 ****
  			 * ourselves.
  			 */
  			if (status == MEMCACHED_NOTFOUND && fci.size != 0) {
! 				status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key, key_len,
! 													return_value TSRMLS_DC);
  				ZVAL_DOUBLE(cas_token, 0);
  			}
  
! 			if (php_memc_handle_error(status) < 0) {
  				memcached_result_free(&result);
  				RETURN_FALSE;
  			}
--- 365,375 ----
  			 * ourselves.
  			 */
  			if (status == MEMCACHED_NOTFOUND && fci.size != 0) {
! 				status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key, key_len,return_value TSRMLS_CC);
  				ZVAL_DOUBLE(cas_token, 0);
  			}
  
! 			if (php_memc_handle_error(status TSRMLS_CC) < 0) {
  				memcached_result_free(&result);
  				RETURN_FALSE;
  			}
***************
*** 423,430 ****
  		 * the value. The callback will take care of storing the value back into memcache.
  		 */
  		if (payload == NULL && status == MEMCACHED_NOTFOUND && fci.size != 0) {
! 			status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key, key_len,
! 												return_value TSRMLS_DC);
  		}
  
  		(void)memcached_fetch(i_obj->memc, NULL, NULL, &dummy_length, &dummy_flags, &dummy_status);
--- 422,428 ----
  		 * the value. The callback will take care of storing the value back into memcache.
  		 */
  		if (payload == NULL && status == MEMCACHED_NOTFOUND && fci.size != 0) {
! 			status = php_memc_do_cache_callback(getThis(), &fci, &fcc, key, key_len,return_value TSRMLS_CC);
  		}
  
  		(void)memcached_fetch(i_obj->memc, NULL, NULL, &dummy_length, &dummy_flags, &dummy_status);
***************
*** 553,559 ****
  
  	efree(mkeys);
  	efree(mkeys_len);
! 	if (php_memc_handle_error(status) < 0) {
  		RETURN_FALSE;
  	}
  
--- 551,557 ----
  
  	efree(mkeys);
  	efree(mkeys_len);
! 	if (php_memc_handle_error(status TSRMLS_CC) < 0) {
  		RETURN_FALSE;
  	}
  
***************
*** 594,600 ****
  
  	memcached_result_free(&result);
  
! 	if (status != MEMCACHED_END && php_memc_handle_error(status) < 0) {
  		zval_dtor(return_value);
  		RETURN_FALSE;
  	}
--- 592,598 ----
  
  	memcached_result_free(&result);
  
! 	if (status != MEMCACHED_END && php_memc_handle_error(status TSRMLS_CC) < 0) {
  		zval_dtor(return_value);
  		RETURN_FALSE;
  	}
***************
*** 702,708 ****
  
  	efree(mkeys);
  	efree(mkeys_len);
! 	if (php_memc_handle_error(status) < 0) {
  		RETURN_FALSE;
  	}
  
--- 700,706 ----
  
  	efree(mkeys);
  	efree(mkeys_len);
! 	if (php_memc_handle_error(status TSRMLS_CC) < 0) {
  		RETURN_FALSE;
  	}
  
***************
*** 726,732 ****
  		if (status == MEMCACHED_END) {
  			status = MEMCACHED_SUCCESS;
  		}
! 		if (php_memc_handle_error(status) < 0) {
  			RETURN_FALSE;
  		}
  	}
--- 724,730 ----
  		if (status == MEMCACHED_END) {
  			status = MEMCACHED_SUCCESS;
  		}
! 		if (php_memc_handle_error(status TSRMLS_CC) < 0) {
  			RETURN_FALSE;
  		}
  	}
***************
*** 841,847 ****
  
  	memcached_result_free(&result);
  
! 	if (status != MEMCACHED_END && php_memc_handle_error(status) < 0) {
  		zval_dtor(return_value);
  		RETURN_FALSE;
  	}
--- 839,845 ----
  
  	memcached_result_free(&result);
  
! 	if (status != MEMCACHED_END && php_memc_handle_error(status TSRMLS_CC) < 0) {
  		zval_dtor(return_value);
  		RETURN_FALSE;
  	}



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-19 14:48 UTC] jason at xlntads dot com
forgot to add the patched .h file:

*** memcached-0.1.4/php_memcached.h	2009-02-13 15:58:54.000000000 -0500
--- memcached-0.1.4-zts/php_memcached.h	2009-02-19 13:46:02.000000000 -0500
***************
*** 53,59 ****
  #define PHP_MEMCACHED_VERSION "0.1.4"
  
  #ifdef ZTS
! #define MEMC_G(v) TSRMG(php_memcached_globals_id, zend_memcache_globals *, v)
  #else
  #define MEMC_G(v) (php_memcached_globals.v)
  #endif
--- 53,59 ----
  #define PHP_MEMCACHED_VERSION "0.1.4"
  
  #ifdef ZTS
! #define MEMC_G(v) TSRMG(php_memcached_globals_id, zend_php_memcached_globals *, v)
  #else
  #define MEMC_G(v) (php_memcached_globals.v)
  #endif
 [2009-02-19 17:45 UTC] andrei@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 06:01:28 2024 UTC