public
Last active

libxmlcrash PHP extension (source)

  • Download Gist
config.m4
1 2 3 4 5 6 7 8 9 10 11
PHP_ARG_ENABLE(libxmlcrash, whether to enable libxmlcrash support,
[ --enable-libxmlcrash Enable libxmlcrash support])
 
if test "$PHP_LIBXMLCRASH" != "no"; then
PHP_ADD_INCLUDE(/usr/include/libxml2/)
PHP_NEW_EXTENSION(libxmlcrash, libxmlcrash.c, $ext_shared)
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(libxmlcrash, libxml)
])
fi
dummy.xml
XML
1
<?xml version="1.0"?>
libxmlcrash.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
 
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_libxmlcrash.h"
 
#include <libxml/parser.h>
 
const zend_function_entry libxmlcrash_functions[] = {
PHP_FE_END
};
 
/* As of PHP 5.1, interdependencies between extensions can be enforced */
#if ZEND_MODULE_API_NO >= 20050617
static zend_module_dep libxmlcrash_deps[] = {
ZEND_MOD_REQUIRED("libxml")
ZEND_MOD_END
};
#endif
 
zend_module_entry libxmlcrash_module_entry = {
#if ZEND_MODULE_API_NO >= 20050617
STANDARD_MODULE_HEADER_EX,
NULL,
libxmlcrash_deps,
#else
STANDARD_MODULE_HEADER,
#endif
"libxmlcrash",
libxmlcrash_functions,
PHP_MINIT(libxmlcrash),
NULL,
NULL,
NULL,
NULL,
"0.1",
STANDARD_MODULE_PROPERTIES
};
 
#ifdef COMPILE_DL_LIBXMLCRASH
ZEND_GET_MODULE(libxmlcrash)
#endif
 
PHP_MINIT_FUNCTION(libxmlcrash)
{
xmlParseFile("/tmp/dummy.xml");
return SUCCESS;
}
php.ini
INI
1
extension="libxmlcrash.so"
php_libxmlcrash.h
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef PHP_LIBXMLCRASH_H
#define PHP_LIBXMLCRASH_H
 
extern zend_module_entry libxmlcrash_module_entry;
#define phpext_libxmlcrash_ptr &libxmlcrash_module_entry
 
#ifdef ZTS
#include "TSRM.h"
#endif
 
PHP_MINIT_FUNCTION(libxmlcrash);
 
#ifdef ZTS
#define LIBXMLCRASH_G(v) TSRMG(libxmlcrash_globals_id, zend_libxmlcrash_globals *, v)
#else
#define LIBXMLCRASH_G(v) (libxmlcrash_globals.v)
#endif
 
#endif

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.