@@ -1121,6 +1121,8 @@ PHP_MINIT_FUNCTION(redis)
11211121 zend_class_entry redis_exception_class_entry ;
11221122 zend_class_entry redis_cluster_exception_class_entry ;
11231123
1124+ zend_class_entry * exception_ce = NULL ;
1125+
11241126 /* Seed random generator (for RedisCluster failover) */
11251127 gettimeofday (& tv , NULL );
11261128 srand (tv .tv_usec * tv .tv_sec );
@@ -1142,15 +1144,27 @@ PHP_MINIT_FUNCTION(redis)
11421144 redis_cluster_ce = zend_register_internal_class (& redis_cluster_class_entry TSRMLS_CC );
11431145 redis_cluster_ce -> create_object = create_cluster_context ;
11441146
1147+
1148+ /* Base Exception class */
1149+ #if HAVE_SPL
1150+ exception_ce = zend_hash_str_find_ptr (CG (class_table ), "RuntimeException" , sizeof ("RuntimeException" ) - 1 );
1151+ #endif
1152+ if (exception_ce == NULL ) {
1153+ #if (PHP_MAJOR_VERSION == 5 ) && (PHP_MINOR_VERSION < 2 )
1154+ exception_ce = zend_exception_get_default ();
1155+ #else
1156+ exception_ce = zend_exception_get_default (TSRMLS_C );
1157+ #endif
1158+ }
1159+
11451160 /* RedisException class */
11461161 INIT_CLASS_ENTRY (redis_exception_class_entry , "RedisException" , NULL );
11471162 redis_exception_ce = zend_register_internal_class_ex (
11481163 & redis_exception_class_entry ,
11491164#if (PHP_MAJOR_VERSION < 7 )
1150- redis_get_exception_base (TSRMLS_C ),
1151- NULL TSRMLS_CC
1165+ exception_ce , NULL TSRMLS_CC
11521166#else
1153- redis_get_exception_base ( TSRMLS_C )
1167+ exception_ce
11541168#endif
11551169 );
11561170
@@ -1160,10 +1174,9 @@ PHP_MINIT_FUNCTION(redis)
11601174 redis_cluster_exception_ce = zend_register_internal_class_ex (
11611175 & redis_cluster_exception_class_entry ,
11621176#if (PHP_MAJOR_VERSION < 7 )
1163- redis_get_exception_base (TSRMLS_C ),
1164- NULL TSRMLS_CC
1177+ exception_ce , NULL TSRMLS_CC
11651178#else
1166- redis_get_exception_base ( TSRMLS_C )
1179+ exception_ce
11671180#endif
11681181 );
11691182
0 commit comments