Skip to content

Instantly share code, notes, and snippets.

@rsky
Last active December 16, 2015 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsky/5458167 to your computer and use it in GitHub Desktop.
Save rsky/5458167 to your computer and use it in GitHub Desktop.
no globals
PHP_ARG_ENABLE(noglobals, for noglobals support,
[ --enable-noglobals Include noglobals support],
yes, yes)
PHP_NEW_EXTENSION(noglobals, noglobals.c, $ext_shared)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#define NOGLOBALS_VERSION "0.0.1-dev"
#define DELETE_AUTO_GLOBALS(name) zend_hash_del(CG(auto_globals), name, sizeof(name))
static PHP_MINIT_FUNCTION(noglobals);
static PHP_RINIT_FUNCTION(noglobals);
static PHP_MINFO_FUNCTION(noglobals);
static zend_function_entry noglobals_functions[] = {
PHP_FE_END
};
static zend_module_entry noglobals_module_entry = {
STANDARD_MODULE_HEADER,
"noglobals",
noglobals_functions,
PHP_MINIT(noglobals),
NULL,
PHP_RINIT(noglobals),
NULL,
PHP_MINFO(noglobals),
NOGLOBALS_VERSION,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_NOGLOBALS
ZEND_GET_MODULE(noglobals)
#endif
static PHP_MINIT_FUNCTION(noglobals)
{
return SUCCESS;
}
static PHP_RINIT_FUNCTION(noglobals)
{
DELETE_AUTO_GLOBALS("GLOBALS");
DELETE_AUTO_GLOBALS("_REQUEST");
return SUCCESS;
}
static PHP_MINFO_FUNCTION(noglobals)
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment