Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-07-04 15:44:27 +0300
committerRemi Collet <remi@php.net>2022-07-18 14:46:10 +0300
commit3cd5ac1e27796a559fea50f0a0eb716030ac9720 (patch)
tree82e74c1d2ca655a2270f7f4562f930ef2bedd8d5
parent3675f442e413bd864c12787c3b383b110ed26963 (diff)
use spl_ce_RuntimeException (exists since 5.6)
-rw-r--r--redis.c10
-rw-r--r--redis_cluster.c10
2 files changed, 4 insertions, 16 deletions
diff --git a/redis.c b/redis.c
index 357405ec..8c4cada6 100644
--- a/redis.c
+++ b/redis.c
@@ -28,6 +28,7 @@
#include "redis_commands.h"
#include "redis_sentinel.h"
#include <standard/php_random.h>
+#include <ext/spl/spl_exceptions.h>
#include <zend_exceptions.h>
#include <ext/standard/info.h>
#include <ext/hash/php_hash.h>
@@ -436,7 +437,6 @@ static PHP_GINIT_FUNCTION(redis)
PHP_MINIT_FUNCTION(redis)
{
struct timeval tv;
- zend_class_entry *exception_ce = NULL;
/* Seed random generator (for RedisCluster failover) */
gettimeofday(&tv, NULL);
@@ -462,14 +462,8 @@ PHP_MINIT_FUNCTION(redis)
"Redis cluster slot cache",
module_number);
- /* Base Exception class */
- exception_ce = zend_hash_str_find_ptr(CG(class_table), "RuntimeException", sizeof("RuntimeException") - 1);
- if (exception_ce == NULL) {
- exception_ce = zend_exception_get_default();
- }
-
/* RedisException class */
- redis_exception_ce = register_class_RedisException(exception_ce);
+ redis_exception_ce = register_class_RedisException(spl_ce_RuntimeException);
/* Add shared class constants to Redis and RedisCluster objects */
add_class_constants(redis_ce, 0);
diff --git a/redis_cluster.c b/redis_cluster.c
index e3451899..f163158a 100644
--- a/redis_cluster.c
+++ b/redis_cluster.c
@@ -25,6 +25,7 @@
#include "crc16.h"
#include "redis_cluster.h"
#include "redis_commands.h"
+#include <ext/spl/spl_exceptions.h>
#include <zend_exceptions.h>
#include "library.h"
#include <php_variables.h>
@@ -44,17 +45,10 @@ zend_class_entry *redis_cluster_exception_ce;
PHP_MINIT_FUNCTION(redis_cluster)
{
- zend_class_entry *exception_ce = NULL;
-
redis_cluster_ce = register_class_RedisCluster();
redis_cluster_ce->create_object = create_cluster_context;
- /* Base Exception class */
- exception_ce = zend_hash_str_find_ptr(CG(class_table), "RuntimeException", sizeof("RuntimeException") - 1);
- if (exception_ce == NULL) {
- exception_ce = zend_exception_get_default();
- }
- redis_cluster_exception_ce = register_class_RedisClusterException(exception_ce);
+ redis_cluster_exception_ce = register_class_RedisClusterException(spl_ce_RuntimeException);
return SUCCESS;
}