@@ -3001,22 +3001,27 @@ PHP_METHOD(Redis, sortDescAlpha)
30013001PHPAPI void generic_expire_cmd (INTERNAL_FUNCTION_PARAMETERS , char * keyword , int keyword_len ) {
30023002 zval * object ;
30033003 RedisSock * redis_sock ;
3004- char * key = NULL , * cmd ;
3005- int key_len , cmd_len , key_free ;
3006- long t ;
3004+ char * key = NULL , * cmd , * t ;
3005+ int key_len , cmd_len , key_free , t_len ;
3006+ int i ;
30073007
3008- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Osl " ,
3008+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Oss " ,
30093009 & object , redis_ce , & key , & key_len ,
3010- & t ) == FAILURE ) {
3010+ & t , & t_len ) == FAILURE ) {
30113011 RETURN_FALSE ;
30123012 }
30133013
30143014 if (redis_sock_get (object , & redis_sock TSRMLS_CC , 0 ) < 0 ) {
30153015 RETURN_FALSE ;
30163016 }
30173017
3018+ /* check that we have a number */
3019+ for (i = 0 ; i < t_len ; ++ i )
3020+ if (t [i ] < '0' || t [i ] > '9' )
3021+ RETURN_FALSE ;
3022+
30183023 key_free = redis_key_prefix (redis_sock , & key , & key_len TSRMLS_CC );
3019- cmd_len = redis_cmd_format_static (& cmd , keyword , "sl " , key , key_len , t );
3024+ cmd_len = redis_cmd_format_static (& cmd , keyword , "ss " , key , key_len , t , t_len );
30203025 if (key_free ) efree (key );
30213026
30223027 REDIS_PROCESS_REQUEST (redis_sock , cmd , cmd_len );
@@ -3278,10 +3283,17 @@ PHPAPI void generic_ttl(INTERNAL_FUNCTION_PARAMETERS, char *keyword) {
32783283 if (key_free ) efree (key );
32793284
32803285 REDIS_PROCESS_REQUEST (redis_sock , cmd , cmd_len );
3286+ #ifdef PHP64
32813287 IF_ATOMIC () {
32823288 redis_long_response (INTERNAL_FUNCTION_PARAM_PASSTHRU , redis_sock , NULL , NULL );
32833289 }
32843290 REDIS_PROCESS_RESPONSE (redis_long_response );
3291+ #else
3292+ IF_ATOMIC () {
3293+ redis_bulk_double_response (INTERNAL_FUNCTION_PARAM_PASSTHRU , redis_sock , NULL , NULL );
3294+ }
3295+ REDIS_PROCESS_RESPONSE (redis_bulk_double_response );
3296+ #endif
32853297}
32863298
32873299/* {{{ proto long Redis::ttl(string key)
0 commit comments