8000 Fix inconsistent dll linkage, improve get exception base · jrtkcoder/phpredis@314a2c3 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 314a2c3

Browse files
Jan-ESean-Der
authored andcommitted
Fix inconsistent dll linkage, improve get exception base
1 parent f2711e3 commit 314a2c3

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

redis_cluster.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "redis_cluster.h"
2929
#include "redis_commands.h"
3030
#include <zend_exceptions.h>
31+
#include <ext/spl/spl_exceptions.h>
3132
#include "library.h"
3233
#include <php_variables.h>
3334
#include <SAPI.h>
@@ -234,27 +235,22 @@ static void ht_free_node(zval *data) {
234235
}
235236

236237
/* Initialize/Register our RedisCluster exceptions */
237-
PHPAPI zend_class_entry *rediscluster_get_exception_base(int root TSRMLS_DC) {
238-
#if HAVE_SPL
239-
if(!root) {
240-
if(!spl_rte_ce) {
241-
zend_class_entry *pce;
242-
243-
if((pce = zend_hash_str_find_ptr(CG(class_table), "runtimeexception", sizeof("runtimeexception") - 1)) != NULL)
244-
{
245-
spl_rte_ce = pce;
246-
return pce;
247-
}
248-
} else {
249-
return spl_rte_ce;
250-
}
251-
}
252-
#endif
253-
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 2)
254-
return zend_exception_get_default();
255-
#else
256-
return zend_exception_get_default(TSRMLS_C);
238+
PHP_REDIS_API zend_class_entry *rediscluster_get_exception_base(int root) {
239+
#if defined(HAVE_SPL)
240+
if (!root) {
241+
if (!spl_ce_RuntimeException) {
242+
zend_class_entry *pce;
243+
244+
if ((pce = zend_hash_str_find_ptr(CG(class_table), "runtimeexception", sizeof("RuntimeException") - 1))) {
245+
spl_ce_RuntimeException = pce;
246+
return pce;
247+
}
248+
} else {
249+
return spl_ce_RuntimeException;
250+
}
251+
}
257252
#endif
253+
return zend_ce_exception;
258254
}
259255

260256
/* Create redisCluster context */

redis_cluster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static inline redisCluster *php_redis_fetch_object(zend_object *obj) {
101101
resp_func(INTERNAL_FUNCTION_PARAM_PASSTHRU, c, ctx);
102102

103103
/* For the creation of RedisCluster specific exceptions */
104-
PHP_REDIS_API zend_class_entry *rediscluster_get_exception_base(int root TSRMLS_DC);
104+
PHP_REDIS_API zend_class_entry *rediscluster_get_exception_base(int root);
105105

106106
/* Create cluster context */
107107
zend_object *create_cluster_context(zend_class_entry *class_type

0 commit comments

Comments
 (0)
0