Re: having an exception instance

From: Date: Wed, 16 May 2012 07:29:29 +0000
Subject: Re: having an exception instance
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-60591@lists.php.net to get a copy of this message
On Wed, 16 May 2012 05:45:05 +0200, Yader Hernandez <yader.hernandez@gmail.com> wrote:
I'm calling this function: static zend_class_entry *create_class_entry_runtime_exception(TSRMLS_C) {
    zend_class_entry **pce;
    if (zend_hash_find(CG(class_table), "runtimeexception",
sizeof("RuntimeException"), (void **) &pce) == SUCCESS) {
        return *pce;
    }
} but it's causing a segfault. The function is being called in PHP_MINIT_FUNCTION and assigning the return value to a static zend_class_entry *runtime_exception_ptr My final goal is to be able to easily call zend_throw_exception and pass runtime_exception_ptr pointer.
For the RuntimeException class entry, you can just include <ext/spl/spl_exceptions.h> and use spl_ce_RuntimeException. When the pointer is not exported, you can use zend_lookup_class_ex(). -- Gustavo Lopes

« previous php.internals (#60591) next »