1
0
Fork 0

closes #164: warning/error when xcache.so is loaded incorrectly

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@972 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2012-07-14 02:58:47 +00:00
parent 96ab621853
commit ef18f7a024
1 changed files with 9 additions and 0 deletions

View File

@ -3824,6 +3824,7 @@ static PHP_MINIT_FUNCTION(xcache)
xc_module_gotup = 1;
if (!xc_zend_extension_gotup) {
zend_error(E_WARNING, "XCache is designed to be loaded as zend_extension not extension");
xc_zend_extension_register(&zend_extension_entry, 0);
xc_zend_extension_startup(&zend_extension_entry);
xc_zend_extension_faked = 1;
@ -4039,6 +4040,10 @@ ZEND_GET_MODULE(xcache)
static startup_func_t xc_last_ext_startup;
static int xc_zend_startup_last(zend_extension *extension) /* {{{ */
{
zend_extension *ext = zend_get_extension(XCACHE_NAME);
if (ext) {
zend_error(E_WARNING, "Module '" XCACHE_NAME "' already loaded");
}
/* restore */
extension->startup = xc_last_ext_startup;
if (extension->startup) {
@ -4068,6 +4073,10 @@ ZEND_DLEXPORT int xcache_zend_startup(zend_extension *extension) /* {{{ */
zend_extension *ext;
xc_llist_zend_extension = xc_llist_get_element_by_zend_extension(&zend_extensions, XCACHE_NAME);
if (xc_llist_zend_extension != zend_extensions.head) {
zend_error(E_WARNING, "XCache must be loaded as the first zend_extension for maximum compatibility");
}
/* hide myself */
xc_llist_unlink(&zend_extensions, xc_llist_zend_extension);
ext = (zend_extension *) zend_llist_get_last_ex(&zend_extensions, &lpos);