summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/enchant/CREDITS2
-rwxr-xr-xext/enchant/config.m436
-rw-r--r--ext/enchant/config.w329
-rw-r--r--ext/enchant/docs/examples/example1.php25
-rwxr-xr-xext/enchant/enchant.c721
-rwxr-xr-xext/enchant/package.xml73
-rw-r--r--ext/enchant/php_enchant.h80
-rw-r--r--ext/fileinfo/CREDITS2
-rw-r--r--ext/fileinfo/EXPERIMENTAL0
-rw-r--r--ext/fileinfo/config.m454
-rw-r--r--ext/fileinfo/fileinfo.c425
-rw-r--r--ext/fileinfo/fileinfo.php29
-rw-r--r--ext/fileinfo/package.xml41
-rw-r--r--ext/fileinfo/php_fileinfo.h61
-rw-r--r--ext/imap/imap.h103
-rw-r--r--ext/pcre/config0.m456
-rw-r--r--ext/xmlreader/CREDITS2
-rw-r--r--ext/xmlreader/EXPERIMENTAL4
-rw-r--r--ext/xmlreader/README5
-rw-r--r--ext/xmlreader/TODO6
-rw-r--r--ext/xmlreader/config.m422
-rw-r--r--ext/xmlreader/config.w3214
-rw-r--r--ext/xmlreader/examples/xmlreader.xml10
-rw-r--r--ext/xmlreader/examples/xmlreader_file.php20
-rw-r--r--ext/xmlreader/examples/xmlreader_string.php31
-rw-r--r--ext/xmlreader/php_xmlreader.c879
-rw-r--r--ext/xmlreader/php_xmlreader.h71
-rw-r--r--ext/xmlreader/xmlreader.dsp114
-rw-r--r--main/php_realpath.c285
29 files changed, 0 insertions, 3180 deletions
diff --git a/ext/enchant/CREDITS b/ext/enchant/CREDITS
deleted file mode 100644
index 481febbfc2..0000000000
--- a/ext/enchant/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-enchant
-Pierre-Alain Joye, Ilia Alshanetsky
diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4
deleted file mode 100755
index b59cd8fb3c..0000000000
--- a/ext/enchant/config.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(enchant,for ENCHANT support,
-[ --with-enchant[=DIR] Include enchant support.
- GNU Aspell version 1.1.3 or higher required.])
-
-if test "$PHP_ENCHANT" != "no"; then
- PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
- if test "$PHP_ENCHANT" != "yes"; then
- ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
- else
- ENCHANT_SEARCH_DIRS="/usr/local /usr"
- fi
- for i in $ENCHANT_SEARCH_DIRS; do
- if test -f $i/include/enchant/enchant.h; then
- ENCHANT_DIR=$i
- ENCHANT_INCDIR=$i/include/enchant
- elif test -f $i/include/enchant.h; then
- ENCHANT_DIR=$i
- ENCHANT_INCDIR=$i/include
- fi
- done
-
- if test -z "$ENCHANT_DIR"; then
- AC_MSG_ERROR(Cannot find enchant)
- fi
-
- ENCHANT_LIBDIR=$ENCHANT_DIR/lib
-
- AC_DEFINE(HAVE_ENCHANT,1,[ ])
- PHP_SUBST(ENCHANT_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
- PHP_ADD_INCLUDE($ENCHANT_INCDIR)
-fi
diff --git a/ext/enchant/config.w32 b/ext/enchant/config.w32
deleted file mode 100644
index 5be9572057..0000000000
--- a/ext/enchant/config.w32
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("enchant", "Enchant Support", "no");
-
-if (PHP_ENCHANT == "yes") {
- EXTENSION("enchant", "enchant.c");
- AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
-}
diff --git a/ext/enchant/docs/examples/example1.php b/ext/enchant/docs/examples/example1.php
deleted file mode 100644
index 9d503f74e6..0000000000
--- a/ext/enchant/docs/examples/example1.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$tag = 'en_US';
-$r = enchant_broker_init();
-$bprovides = enchant_broker_describe($r);
-echo "Current broker provides the following backend(s):\n";
-print_r($bprovides);
-
-
-if (enchant_broker_dict_exists($r,$tag)) {
- $d = enchant_broker_request_dict($r, $tag);
- $dprovides = enchant_dict_describe($d);
- echo "dictionary $tag provides:\n";
- $spellerrors = enchant_dict_check($d, "soong");
- print_r($dprovides);
- echo "found $spellerrors spell errors\n";
- if ($spellerrors) {
- $suggs = enchant_dict_suggest($d, "soong");
- echo "Suggestions for 'soong':";
- print_r($suggs);
- }
- enchant_broker_free_dict($d);
-} else {
-}
-enchant_broker_free($r);
-?>
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
deleted file mode 100755
index 1946e50fbc..0000000000
--- a/ext/enchant/enchant.c
+++ /dev/null
@@ -1,721 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Pierre-Alain Joye <paj@pearfr.org> |
- | Ilia Alshanetsky <ilia@prohost.org> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "enchant.h"
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_enchant.h"
-
-
-typedef EnchantBroker * EnchantBrokerPtr;
-typedef struct _broker_struct enchant_broker;
-typedef struct _dict_struct enchant_dict;
-
-typedef enchant_broker * enchant_brokerPtr;
-typedef enchant_dict * enchant_dictPtr;
-
-typedef struct _broker_struct {
- EnchantBroker *pbroker;
- enchant_dict **dict;
- unsigned int dictcnt;
- zval *rsrc_id;
-} _enchant_broker;
-
-typedef struct _dict_struct {
- unsigned int id;
- EnchantDict *pdict;
- enchant_broker *pbroker;
- zval *rsrc_id;
- enchant_dict *next;
- enchant_dict *prev;
-} _enchant_dict;
-
-
-/* True global resources - no need for thread safety here */
-static int le_enchant_broker;
-static int le_enchant_dict;
-
-/* If you declare any globals in php_enchant.h uncomment this:*/
-/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
-
-/* {{{ enchant_functions[]
- *
- * Every user visible function must have an entry in enchant_functions[].
- */
-function_entry enchant_functions[] = {
- PHP_FE(enchant_broker_init, NULL)
- PHP_FE(enchant_broker_free, NULL)
- PHP_FE(enchant_broker_get_error, NULL)
- PHP_FE(enchant_broker_request_dict, NULL)
- PHP_FE(enchant_broker_request_pwl_dict, NULL)
- PHP_FE(enchant_broker_free_dict, NULL)
- PHP_FE(enchant_broker_dict_exists, NULL)
- PHP_FE(enchant_broker_set_ordering, NULL)
- PHP_FE(enchant_broker_describe, NULL)
- PHP_FE(enchant_dict_check, NULL)
- PHP_FE(enchant_dict_suggest, NULL)
- PHP_FE(enchant_dict_add_to_personal, NULL)
- PHP_FE(enchant_dict_add_to_session, NULL)
- PHP_FE(enchant_dict_is_in_session, NULL)
- PHP_FE(enchant_dict_store_replacement, NULL)
- PHP_FE(enchant_dict_get_error, NULL)
- PHP_FE(enchant_dict_describe, NULL)
- PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
-
- {NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
-};
-/* }}} */
-
-/* {{{ enchant_module_entry
- */
-zend_module_entry enchant_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "enchant",
- enchant_functions,
- PHP_MINIT(enchant),
- PHP_MSHUTDOWN(enchant),
- NULL, /* Replace with NULL if there's nothing to do at request start */
- NULL, /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(enchant),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ENCHANT
-ZEND_GET_MODULE(enchant)
-#endif
-
-static void
-enumerate_providers_fn (const char * const name,
- const char * const desc,
- const char * const file,
- void * ud)
-{
- zval *zdesc = (zval *) ud;
- zval *tmp_array;
-
- MAKE_STD_ZVAL(tmp_array);
- array_init(tmp_array);
-
- add_assoc_string(tmp_array, "name", (char *)name, 1);
- add_assoc_string(tmp_array, "desc", (char *)desc, 1);
- add_assoc_string(tmp_array, "file", (char *)file, 1);
-
- if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
- array_init(zdesc);
- }
-
- add_next_index_zval(zdesc, tmp_array);
-}
-
-static void
-describe_dict_fn (const char * const lang,
- const char * const name,
- const char * const desc,
- const char * const file,
- void * ud)
-{
- zval *zdesc = (zval *) ud;
- array_init(zdesc);
- add_assoc_string(zdesc, "lang", (char *)lang, 1);
- add_assoc_string(zdesc, "name", (char *)name, 1);
- add_assoc_string(zdesc, "desc", (char *)desc, 1);
- add_assoc_string(zdesc, "file", (char *)file, 1);
-}
-
-static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- if (rsrc->ptr) {
- enchant_broker *broker = (enchant_broker *)rsrc->ptr;
- if (broker) {
- if (broker->pbroker) {
- if (broker->dictcnt && broker->dict) {
- if (broker->dict) {
- int total, tofree;
- tofree = total = broker->dictcnt-1;
- do {
- zend_list_delete(Z_RESVAL_P(broker->dict[total]->rsrc_id));
- efree(broker->dict[total]);
- total--;
- } while (total>=0);
- }
- efree(broker->dict);
- broker->dict = NULL;
- }
- enchant_broker_free(broker->pbroker);
- }
- efree(broker);
- }
- }
-}
-
-static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- if (rsrc->ptr) {
- enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
- if (pdict) {
- if (pdict->pdict && pdict->pbroker) {
- enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
- }
- if (pdict->id) {
- pdict->pbroker->dict[pdict->id-1]->next = NULL;
- }
- }
- }
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(enchant)
-{
- le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant broker", module_number);
- le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant dict", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(enchant)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-static void __enumerate_providers_fn (const char * const name,
- const char * const desc,
- const char * const file,
- void * ud)
-{
- php_info_print_table_row(3, name, desc, file);
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(enchant)
-{
- EnchantBroker *pbroker;
-
- pbroker = enchant_broker_init();
- php_info_print_table_start();
- php_info_print_table_header(2, "enchant support", "enabled");
- php_info_print_table_row(2, "Version", "@version@");
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-
- php_info_print_table_start();
- enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
- php_info_print_table_end();
-}
-/* }}} */
-
-#define PHP_ENCHANT_GET_BROKER \
- ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
- if (!pbroker || !pbroker->pbroker) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
- RETURN_FALSE; \
- }
-
-#define PHP_ENCHANT_GET_DICT \
- ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant dict", le_enchant_dict); \
- if (!pdict || !pdict->pdict) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
- RETURN_FALSE; \
- }
-
-/* {{{ proto resource enchant_broker_init()
- create a new broker object capable of requesting */
-PHP_FUNCTION(enchant_broker_init)
-{
- enchant_broker *broker;
- EnchantBroker *pbroker;
-
- if (ZEND_NUM_ARGS()) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- pbroker = enchant_broker_init();
-
- if (pbroker) {
- broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
- broker->pbroker = pbroker;
- broker->dict = NULL;
- broker->dictcnt = 0;
- ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
- broker->rsrc_id = return_value;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto boolean enchant_free(resource broker)
- Destroys the broker object and its dictionnaries */
-PHP_FUNCTION(enchant_broker_free)
-{
- zval *broker;
- enchant_broker *pbroker;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
- RETURN_FALSE;
- }
- PHP_ENCHANT_GET_BROKER;
-
- zend_list_delete(Z_RESVAL_P(broker));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string enchant_broker_get_error(resource broker)
- Returns the last error of the broker */
-PHP_FUNCTION(enchant_broker_get_error)
-{
- zval *broker;
- enchant_broker *pbroker;
- char *msg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- msg = enchant_broker_get_error(pbroker->pbroker);
- if (msg) {
- RETURN_STRING((char *)msg, 1);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
- create a new dictionary using tag, the non-empty language tag you wish to request
- a dictionary for ("en_US", "de_DE", ...) */
-PHP_FUNCTION(enchant_broker_request_dict)
-{
- zval *broker;
- enchant_broker *pbroker;
- enchant_dict *dict;
- EnchantDict *d;
- char *tag;
- int taglen;
- int pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
- if (d) {
- if (pbroker->dictcnt) {
- pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
- pos = pbroker->dictcnt++;
- } else {
- pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
- pos = 0;
- pbroker->dictcnt++;
- }
-
- dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
- dict->id = pos;
- dict->pbroker = pbroker;
- dict->pdict = d;
- dict->rsrc_id = return_value;
- dict->prev = pos ? pbroker->dict[pos-1] : NULL;
- dict->next = NULL;
- pbroker->dict[pos] = dict;
-
- if (pos) {
- pbroker->dict[pos-1]->next = dict;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string tag)
- creates a dictionary using a PWL file. A PWL file is personal word file one word per line.
- It must exist before the call.*/
-PHP_FUNCTION(enchant_broker_request_pwl_dict)
-{
- zval *broker;
- enchant_broker *pbroker;
- enchant_dict *dict;
- EnchantDict *d;
- char *pwl;
- int pwllen;
- int pos;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
- if (d) {
- if (pbroker->dictcnt) {
- pos = pbroker->dictcnt++;
- pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
- } else {
- pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
- pos = 0;
- pbroker->dictcnt++;
- }
- dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
- dict->id = pos;
- dict->pbroker = pbroker;
- dict->pdict = d;
- dict->rsrc_id = return_value;
- dict->prev = pos?pbroker->dict[pos-1]:NULL;
- dict->next = NULL;
- pbroker->dict[pos] = dict;
- if (pos) {
- pbroker->dict[pos-1]->next = dict;
- }
- ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource enchant_broker_free_dict(resource dict)
- Free the dictionary resource */
-PHP_FUNCTION(enchant_broker_free_dict)
-{
- zval *dict;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- zend_list_delete(Z_RESVAL_P(dict));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
- Wether a dictionary exists or not. Using non-empty tag */
-PHP_FUNCTION(enchant_broker_dict_exists)
-{
- zval *broker;
- char *tag;
- int taglen;
- enchant_broker * pbroker;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
-}
-/* }}} */
-
-
-/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
- Declares a preference of dictionaries to use for the language
- described/referred to by 'tag'. The ordering is a comma delimited
- list of provider names. As a special exception, the "*" tag can
- be used as a language tag to declare a default ordering for any
- language that does not explictly declare an ordering. */
-
-PHP_FUNCTION(enchant_broker_set_ordering)
-{
- zval *broker;
- char *pordering;
- int porderinglen;
- char *ptag;
- int ptaglen;
- enchant_broker * pbroker;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array enchant_broker_describe(resource broker)
- Enumerates the Enchant providers and tells
- you some rudimentary information about them. The same info is provided through phpinfo() */
-PHP_FUNCTION(enchant_broker_describe)
-{
- EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
- zval *broker;
- enchant_broker * pbroker;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_BROKER;
-
- enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
-}
-/* }}} */
-
-PHP_FUNCTION(enchant_dict_quick_check)
-{
- zval *dict, *sugg = NULL;
- char *word;
- int wordlen;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (sugg) {
- zval_dtor(sugg);
- }
-
- PHP_ENCHANT_GET_DICT;
-
- if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
- if (!sugg && ZEND_NUM_ARGS() == 2) {
- RETURN_FALSE;
- }
-
- int n_sugg;
- char **suggs;
-
- array_init(sugg);
-
- suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
- if (suggs && n_sugg) {
- int i;
- for (i = 0; i < n_sugg; i++) {
- add_next_index_string(sugg, suggs[i], 1);
- }
- enchant_dict_free_suggestions(pdict->pdict, suggs);
- }
-
-
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* {{{ proto long enchant_dict_check(resource broker)
- If the word is correctly spelled return true, otherwise return false */
-PHP_FUNCTION(enchant_dict_check)
-{
- zval *dict;
- char *word;
- int wordlen;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
-}
-/* }}} */
-
-/* {{{ proto array enchant_dict_suggest(resource broker, string word)
- Will return a list of values if any of those pre-conditions are not met.*/
-PHP_FUNCTION(enchant_dict_suggest)
-{
- zval *dict;
- char *word;
- int wordlen;
- char **suggs;
- enchant_dict *pdict;
- int n_sugg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
- if (suggs && n_sugg) {
- int i;
-
- array_init(return_value);
- for (i = 0; i < n_sugg; i++) {
- add_next_index_string(return_value, suggs[i], 1);
- }
- }
- enchant_dict_free_suggestions(pdict->pdict, suggs);
-}
-/* }}} */
-
-/* {{{ proto void enchant_dict_add_to_personal(resource broker)
- A list of UTF-8 encoded suggestions, or false */
-PHP_FUNCTION(enchant_dict_add_to_personal)
-{
- zval *dict;
- char *word;
- int wordlen;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
-}
-/* }}} */
-
-/* {{{ proto void enchant_dict_add_to_session(resource broker, string word)
- add 'word' to this spell-checking session */
-PHP_FUNCTION(enchant_dict_add_to_session)
-{
- zval *dict;
- char *word;
- int wordlen;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- enchant_dict_add_to_session(pdict->pdict, word, wordlen);
-}
-/* }}} */
-
-/* {{{ proto bool enchant_dict_is_in_session(resource broker)
- whether or not 'word' exists in this spelling-session */
-PHP_FUNCTION(enchant_dict_is_in_session)
-{
- zval *dict;
- char *word;
- int wordlen;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
-}
-/* }}} */
-
-/* {{{ proto void enchant_dict_store_replacement(resource broker, string mis, string cor)
- add a correction for 'mis' using 'cor'.
- Notes that you replaced @mis with @cor, so it's possibly more likely
- that future occurrences of @mis will be replaced with @cor. So it might
- bump @cor up in the suggestion list.*/
-PHP_FUNCTION(enchant_dict_store_replacement)
-{
- zval *dict;
- char *mis, *cor;
- int mislen, corlen;
-
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
-}
-/* }}} */
-
-/* {{{ proto string enchant_dict_get_error(resource dict)
- Returns the last error of the current spelling-session */
-PHP_FUNCTION(enchant_dict_get_error)
-{
- zval *dict;
- enchant_dict *pdict;
- char *msg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- msg = enchant_dict_get_error(pdict->pdict);
- if (msg) {
- RETURN_STRING((char *)msg, 1);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array enchant_dict_describe(resource dict)
- Describes an individual dictionary 'dict' */
-PHP_FUNCTION(enchant_dict_describe)
-{
- zval *dict;
- enchant_dict *pdict;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
- RETURN_FALSE;
- }
-
- PHP_ENCHANT_GET_DICT;
-
- enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/enchant/package.xml b/ext/enchant/package.xml
deleted file mode 100755
index 0c4e50207b..0000000000
--- a/ext/enchant/package.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package>
- <name>enchant</name>
- <summary>libenchant binder, support near all spelling tools</summary>
- <maintainers>
- <maintainer>
- <user>pajoye</user>
- <name>Pierre-Alain Joye</name>
- <email>paj@pearfr.org</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>iliaa</user>
- <name>Ilia Alshanetsky</name>
- <email>ilia@php.net</email>
- <role>developer</role>
- </maintainer>
- </maintainers>
- <description>Enchant is a binder for libenchant. Libenchant provides a common
-API for many spell libraries:
-- aspell/pspell (intended to replace ispell)
-- hspell (hebrew)
-- ispell
-- myspell (OpenOffice project, mozilla)
-- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
-A plugin system allows to add custom spell support.
-see www.abisource.com/enchant/</description>
- <license>PHP</license>
- <release>
- <state>beta</state>
- <version>0.2.1</version>
- <date>2004-03-11</date>
- <notes>- Fix possible leak in suggestions result
-- Move to beta status</notes>
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="enchant.c"/>
- <file role="src" name="php_enchant.h"/>
- <file role="doc" name="CREDITS"/>
- <dir name="docs" role="doc">
- <dir name="examples">
- <file name="example1.php"/>
- </dir>
- </dir>
- </filelist>
- <configureoptions>
- <configureoption name="with-enchant" default="shared" prompt="libenchant prefix?"/>
- </configureoptions>
- <deps>
- <dep type="php" rel="ge" version="5" />
- </deps>
- </release>
- <changelog>
- <release>
- <state>alpha</state>
- <version>0.2.0</version>
- <notes>- Add Ilia Alshanetsky as maintainer
-- Cleanup sources codes (ilia)
-- Add enchant_dict_quick_check (ilia)</notes>
- </release>
- <release>
- <version>0.1</version>
- <state>alpha</state>
- <date>2003-03-08</date>
- <notes>Initial release</notes>
- </release>
- </changelog>
-</package>
-<!--
-vim:et:ts=1:sw=1
--->
diff --git a/ext/enchant/php_enchant.h b/ext/enchant/php_enchant.h
deleted file mode 100644
index e0d98730ca..0000000000
--- a/ext/enchant/php_enchant.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 4 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Pierre-Alain Joye <paj@pearfr.org> |
- +----------------------------------------------------------------------+
-
- $Id$
-*/
-
-#ifndef PHP_ENCHANT_H
-#define PHP_ENCHANT_H
-
-extern zend_module_entry enchant_module_entry;
-#define phpext_enchant_ptr &enchant_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_ENCHANT_API __declspec(dllexport)
-#else
-#define PHP_ENCHANT_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
-
-PHP_MINIT_FUNCTION(enchant);
-PHP_MSHUTDOWN_FUNCTION(enchant);
-PHP_MINFO_FUNCTION(enchant);
-
-PHP_FUNCTION(enchant_broker_init);
-PHP_FUNCTION(enchant_broker_free);
-PHP_FUNCTION(enchant_broker_get_error);
-PHP_FUNCTION(enchant_broker_request_dict);
-PHP_FUNCTION(enchant_broker_request_pwl_dict);
-PHP_FUNCTION(enchant_broker_free_dict);
-PHP_FUNCTION(enchant_broker_dict_exists);
-PHP_FUNCTION(enchant_broker_set_ordering);
-PHP_FUNCTION(enchant_broker_describe);
-
-PHP_FUNCTION(enchant_dict_check);
-PHP_FUNCTION(enchant_dict_suggest);
-PHP_FUNCTION(enchant_dict_add_to_personal);
-PHP_FUNCTION(enchant_dict_add_to_session);
-PHP_FUNCTION(enchant_dict_is_in_session);
-PHP_FUNCTION(enchant_dict_store_replacement);
-PHP_FUNCTION(enchant_dict_get_error);
-PHP_FUNCTION(enchant_dict_describe);
-PHP_FUNCTION(enchant_dict_quick_check);
-
-#ifdef ZTS
-#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
-#else
-#define ENCHANT_G(v) (enchant_globals.v)
-#endif
-
-#endif /* PHP_ENCHANT_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
-
diff --git a/ext/fileinfo/CREDITS b/ext/fileinfo/CREDITS
deleted file mode 100644
index 6251d1b110..0000000000
--- a/ext/fileinfo/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-fileinfo
-Ilia Alshanetsky
diff --git a/ext/fileinfo/EXPERIMENTAL b/ext/fileinfo/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/fileinfo/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/fileinfo/config.m4 b/ext/fileinfo/config.m4
deleted file mode 100644
index 4aba3745db..0000000000
--- a/ext/fileinfo/config.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension fileinfo
-
-PHP_ARG_WITH(fileinfo, for fileinfo support,
-[ --with-fileinfo=DIR Include fileinfo support])
-
-if test "$PHP_FILEINFO" != "no"; then
- SEARCH_PATH="/usr/local /usr"
- SEARCH_FOR="/include/magic.h"
- if test -r $PHP_FILEINFO/$SEARCH_FOR; then
- FILEINFO_DIR=$PHP_FILEINFO
- else
- AC_MSG_CHECKING([for magic files in default path])
- for i in $SEARCH_PATH ; do
- if test -r $i/$SEARCH_FOR; then
- FILEINFO_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$FILEINFO_DIR"; then
- AC_MSG_RESULT([not found])
- AC_MSG_ERROR([Please reinstall the libmagic distribution])
- fi
-
- PHP_ADD_INCLUDE($FILEINFO_DIR/include)
-
- LIBNAME=magic
- LIBSYMBOL=magic_open
-
- PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
- [
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FILEINFO_DIR/lib, FILEINFO_SHARED_LIBADD)
- AC_DEFINE(HAVE_FILEINFOLIB,1,[ ])
- ],[
- AC_MSG_ERROR([wrong magic lib version or lib not found])
- ],[
- -L$FILEINFO_DIR/lib -lm -ldl
- ])
-
- MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /etc/magic"
- for i in $MAGIC_MIME_LOCATIONS; do
- if test -f $i; then
- PHP_DEFAULT_MAGIC_FILE=$i
- break
- fi
- done
- AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
-
- PHP_SUBST(FILEINFO_SHARED_LIBADD)
-
- PHP_NEW_EXTENSION(fileinfo, fileinfo.c, $ext_shared)
-fi
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
deleted file mode 100644
index e42985012e..0000000000
--- a/ext/fileinfo/fileinfo.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Ilia Alshanetsky <ilia@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <magic.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h" /* needed for context stuff */
-#include "php_fileinfo.h"
-#include "fopen_wrappers.h" /* needed for is_url */
-
-struct php_fileinfo {
- long options;
- struct magic_set *magic;
-};
-
-#ifndef PHP_DEFAULT_MAGIC_FILE
-#define PHP_DEFAULT_MAGIC_FILE NULL
-#endif
-
-#ifdef ZEND_ENGINE_2
-
-static zend_object_handlers finfo_object_handlers;
-zend_class_entry *finfo_class_entry;
-
-struct finfo_object {
- zend_object zo;
- struct php_fileinfo *ptr;
-};
-
-#define FILEINFO_DECLARE_INIT_OBJECT(object) \
- zval *object = getThis();
-
-#define FILEINFO_REGISTER_OBJECT(_object, _ptr) \
-{ \
- struct finfo_object *obj; \
- obj = (struct finfo_object*)zend_object_store_get_object(_object TSRMLS_CC); \
- obj->ptr = _ptr; \
-}
-
-#define FILEINFO_FROM_OBJECT(finfo, object) \
-{ \
- struct finfo_object *obj = zend_object_store_get_object(object TSRMLS_CC); \
- finfo = obj->ptr; \
- if (!finfo) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The invalid fileinfo object."); \
- RETURN_FALSE; \
- } \
-}
-
-/* {{{ finfo_objects_dtor
- */
-static void finfo_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
-{
- struct finfo_object *intern = (struct finfo_object *) object;
-
- if (intern->ptr) {
- magic_close(intern->ptr->magic);
- efree(intern->ptr);
- }
-
- efree(intern);
-}
-/* }}} */
-
-/* {{{ finfo_objects_new
- */
-PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- struct finfo_object *intern;
-
- intern = emalloc(sizeof(struct finfo_object));
- intern->zo.ce = class_type;
- intern->zo.in_get = 0;
- intern->zo.in_set = 0;
- intern->zo.properties = NULL;
- intern->ptr = NULL;
-
- retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);
- retval.handlers = (zend_object_handlers *) &finfo_object_handlers;
-
- return retval;
-}
-/* }}} */
-
-/* {{{ finfo_class_functions
- */
-function_entry finfo_class_functions[] = {
- ZEND_ME_MAPPING(finfo, finfo_open, NULL)
- ZEND_ME_MAPPING(set_flags, finfo_set_flags,NULL)
- ZEND_ME_MAPPING(file, finfo_file, NULL)
- ZEND_ME_MAPPING(buffer, finfo_buffer, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-#else
-
-#define FILEINFO_REGISTER_OBJECT(_object, _ptr) {}
-#define FILEINFO_FROM_OBJECT(socket_id, object) {}
-
-#define FILEINFO_DECLARE_INIT_OBJECT(object)
-#define object 0
-
-#endif
-
-#define FINFO_SET_OPTION(magic, options) \
- if (magic_setflags(magic, options) == -1) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
- options, magic_errno(magic), magic_error(magic)); \
- RETURN_FALSE; \
- }
-
-/* True global resources - no need for thread safety here */
-static int le_fileinfo;
-
-void finfo_resource_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-{
- if (rsrc->ptr) {
- struct php_fileinfo *finfo = (struct php_fileinfo *) rsrc->ptr;
- magic_close(finfo->magic);
- efree(rsrc->ptr);
- rsrc->ptr = NULL;
- }
-}
-
-/* {{{ fileinfo_functions[]
- */
-function_entry fileinfo_functions[] = {
- PHP_FE(finfo_open, NULL)
- PHP_FE(finfo_close, NULL)
- PHP_FE(finfo_set_flags, NULL)
- PHP_FE(finfo_file, NULL)
- PHP_FE(finfo_buffer, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(finfo)
-{
-#ifdef ZEND_ENGINE_2
- zend_class_entry _finfo_class_entry;
- INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
- _finfo_class_entry.create_object = finfo_objects_new;
- finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC);
-
- /* copy the standard object handlers to you handler table */
- memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
-#endif /* ZEND_ENGINE_2 */
-
- le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
-
- REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ fileinfo_module_entry
- */
-zend_module_entry fileinfo_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "fileinfo",
- fileinfo_functions,
- PHP_MINIT(finfo),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(fileinfo),
-#if ZEND_MODULE_API_NO >= 20010901
- "0.1", /* Replace with version number for your extension */
-#endif
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_FILENINFO
-ZEND_GET_MODULE(fileinfo)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(fileinfo)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "fileinfo support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource finfo_open([int options [, string arg]])
- Create a new fileinfo resource. */
-PHP_FUNCTION(finfo_open)
-{
- long options = MAGIC_NONE;
- char *file = PHP_DEFAULT_MAGIC_FILE;
- int file_len = 0;
- struct php_fileinfo *finfo;
- FILEINFO_DECLARE_INIT_OBJECT(object)
- char resolved_path[MAXPATHLEN];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &options, &file, &file_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (file_len) { /* user specified filed, perform open_basedir checks */
- if (!VCWD_REALPATH(file, resolved_path)) {
- RETURN_FALSE;
- }
- file = resolved_path;
-
- if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
- RETURN_FALSE;
- }
- }
-
- finfo = emalloc(sizeof(struct php_fileinfo));
-
- finfo->options = options;
- finfo->magic = magic_open(options);
-
- if (finfo->magic == NULL) {
- efree(finfo);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
- RETURN_FALSE;
- }
-
- if (magic_load(finfo->magic, file) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database at '%s'.", file);
- efree(finfo);
- magic_close(finfo->magic);
- RETURN_FALSE;
- }
-
- if (object) {
- FILEINFO_REGISTER_OBJECT(object, finfo);
- } else {
- ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
- }
-}
-/* }}} */
-
-/* {{{ proto resource finfo_close(resource finfo)
- Close fileinfo resource. */
-PHP_FUNCTION(finfo_close)
-{
- struct php_fileinfo *finfo;
- zval *zfinfo;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zfinfo) == FAILURE) {
- RETURN_FALSE;
- }
- ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
-
- zend_list_delete(Z_RESVAL_P(zfinfo));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool finfo_set_flags(resource finfo, int options)
- Set libmagic configuration options. */
-PHP_FUNCTION(finfo_set_flags)
-{
- long options;
- struct php_fileinfo *finfo;
- zval *zfinfo;
- FILEINFO_DECLARE_INIT_OBJECT(object)
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
- RETURN_FALSE;
- }
- FILEINFO_FROM_OBJECT(finfo, object);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zfinfo, &options) == FAILURE) {
- RETURN_FALSE;
- }
- ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
- }
-
- FINFO_SET_OPTION(finfo->magic, options)
- finfo->options = options;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- long options = 0;
- char *buffer, *tmp, *ret_val;
- int buffer_len;
- struct php_fileinfo *finfo;
- zval *zfinfo, *zcontext = NULL;
- FILEINFO_DECLARE_INIT_OBJECT(object)
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbz", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
- FILEINFO_FROM_OBJECT(finfo, object);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|lbz", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
- }
- ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
- }
-
- /* Set options for the current file/buffer. */
- if (options) {
- FINFO_SET_OPTION(finfo->magic, options)
- }
-
- if (mode) { /* file */
- /* determine if the file is a local file or remote URL */
- char *tmp2;
- php_stream_wrapper *wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_DC);
- if (wrap && wrap->is_url) {
-#ifdef ZEND_ENGINE_2
- php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
-#else
- php_stream_context *context = NULL;
-#endif
- php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb",
- ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
- if (!stream) {
- RETURN_FALSE;
- }
- buffer_len = php_stream_copy_to_mem(stream, &tmp, PHP_STREAM_COPY_ALL, 0);
- php_stream_close(stream);
-
- if (buffer_len == 0) {
- RETURN_FALSE;
- }
- } else { /* local file */
- char resolved_path[MAXPATHLEN];
- if (!VCWD_REALPATH(buffer, resolved_path)) {
- RETURN_FALSE;
- }
-
- ret_val = (char *) magic_file(finfo->magic, buffer);
- goto common;
- }
- } else { /* buffer */
- tmp = buffer;
- }
-
- ret_val = (char *) magic_buffer(finfo->magic, tmp, buffer_len);
- if (mode) {
- efree(tmp);
- }
-common:
- /* Restore options */
- if (options) {
- FINFO_SET_OPTION(finfo->magic, finfo->options)
- }
-
- if (!ret_val) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify data %d:%s",
- magic_errno(finfo->magic), magic_error(finfo->magic));
- RETURN_FALSE;
- } else {
- RETURN_STRING(ret_val, 1);
- }
-}
-
-/* {{{ proto string finfo_file(resource finfo, char *file_name [, int options [, resource context]])
- Return information about a file. */
-PHP_FUNCTION(finfo_file)
-{
- _php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto string finfo_buffer(resource finfo, char *string [, int options])
- Return infromation about a string buffer. */
-PHP_FUNCTION(finfo_buffer)
-{
- _php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/fileinfo/fileinfo.php b/ext/fileinfo/fileinfo.php
deleted file mode 100644
index 1ee9efbeb8..0000000000
--- a/ext/fileinfo/fileinfo.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-if(!extension_loaded('fileinfo')) {
- dl('fileinfo.' . PHP_SHLIB_SUFFIX);
-}
-if(!extension_loaded('fileinfo')) {
- die("fileinfo extension is not avaliable, please compile it.\n");
-}
-
-// normal operation
-$res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
-$files = glob("*");
-foreach ($files as $file) {
- echo finfo_file($res, $file) . "\n";
-}
-finfo_close($res);
-
-// OO mode
-/*
- * FILEINFO_PRESERVE_ATIME - if possible preserve the original access time
- * FILEINFO_SYMLINK - follow symlinks
- * FILEINFO_DEVICES - look at the contents of blocks or character special devices
- * FILEINFO_COMPRESS - decompress compressed files
- */
-$fi = new finfo(FILEINFO_PRESERVE_ATIME|FILEINFO_SYMLINK|FILEINFO_DEVICES|FILEINFO_COMPRESS);
-$files = glob("*");
-foreach ($files as $file) {
- echo $fi->buffer(file_get_contents($file)) . "\n";
-}
-?>
diff --git a/ext/fileinfo/package.xml b/ext/fileinfo/package.xml
deleted file mode 100644
index 50f125c85f..0000000000
--- a/ext/fileinfo/package.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package>
- <name>Fileinfo</name>
- <summary>libmagic bindings</summary>
- <maintainers>
- <maintainer>
- <user>iliaa</user>
- <name>Ilia Alshanetsky</name>
- <email>ilia@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <description>
-This extension allows retrieval of information regarding vast majority of file.
-This information may include dimensions, quality, length etc...
-
-Additionally it can also be used to retrieve the mime type for a particular
-file and for text files proper language encoding.
- </description>
- <license>PHP</license>
- <release>
- <state>beta</state>
- <version>0.1</version>
- <date>2004-02-12</date>
- <notes>Initial release</notes>
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="fileinfo.c"/>
- <file role="src" name="php_fileinfo.h"/>
- <file role="doc" name="CREDITS"/>
- <file role="doc" name="EXPERIMENTAL"/>
- <file role="doc" name="fileinfo.php"/>
- </filelist>
- <deps>
- </deps>
- </release>
-</package>
-<!--
-vim:et:ts=1:sw=1
--->
diff --git a/ext/fileinfo/php_fileinfo.h b/ext/fileinfo/php_fileinfo.h
deleted file mode 100644
index 51e3ff3426..0000000000
--- a/ext/fileinfo/php_fileinfo.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Ilia Alshanetsky <ilia@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FILENINFO_H
-#define PHP_FILENINFO_H
-
-extern zend_module_entry fileinfo_module_entry;
-#define phpext_fileinfo_ptr &fileinfo_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_FILEINFO_API __declspec(dllexport)
-#else
-#define PHP_FILEINFO_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINFO_FUNCTION(fileinfo);
-
-PHP_FUNCTION(finfo_open);
-PHP_FUNCTION(finfo_close);
-PHP_FUNCTION(finfo_set_flags);
-PHP_FUNCTION(finfo_file);
-PHP_FUNCTION(finfo_buffer);
-
-#ifdef ZTS
-#define FILEINFO_G(v) TSRMG(fileinfo_globals_id, zend_fileinfo_globals *, v)
-#else
-#define FILEINFO_G(v) (fileinfo_globals.v)
-#endif
-
-#endif /* PHP_FILEINFO_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/imap/imap.h b/ext/imap/imap.h
deleted file mode 100644
index 914d128316..0000000000
--- a/ext/imap/imap.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef _INCLUDED_IMAP_H
-#define _INCLUDED_IMAP_H
-
-#if COMPILE_DL
-#undef HAVE_IMAP
-#define HAVE_IMAP 1
-#endif
-
-#if HAVE_IMAP
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-/* Functions accessable to PHP */
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-extern PHP_MINIT_FUNCTION(imap);
-extern PHP_RINIT_FUNCTION(imap);
-extern PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-#else
-#define imap_module_ptr NULL
-#endif /* HAVE_IMAP */
-
-#endif
-
-
-
-
-
-
-#define phpext_imap_ptr imap_module_ptr
-
-
-
-
-
-
-
-
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
deleted file mode 100644
index 02e71bd25b..0000000000
--- a/ext/pcre/config0.m4
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,for PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -I@ext_srcdir@/pcrelib)
- PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- else
- for i in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/include $PHP_PCRE_REGEX/include/pcre; do
- test -f $i/pcre.h && PCRE_INCDIR=$i
- done
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_ERROR([Could not find pcre.h in $PHP_PCRE_REGEX])
- fi
-
- for j in $PHP_PCRE_REGEX $PHP_PCRE_REGEX/lib; do
- test -f $j/libpcre.a -o -f $j/libpcre.$SHLIB_SUFFIX_NAME && PCRE_LIBDIR=$j
- done
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) in $PHP_PCRE_REGEX])
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR([The PCRE extension requires PCRE library version >= 2.08])
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10)
- fi
- PHP_SUBST(PCRE_SHARED_LIBADD)
-fi
diff --git a/ext/xmlreader/CREDITS b/ext/xmlreader/CREDITS
deleted file mode 100644
index 35f3af1933..0000000000
--- a/ext/xmlreader/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-XMLReader
-Rob Richards
diff --git a/ext/xmlreader/EXPERIMENTAL b/ext/xmlreader/EXPERIMENTAL
deleted file mode 100644
index dfa49ae496..0000000000
--- a/ext/xmlreader/EXPERIMENTAL
+++ /dev/null
@@ -1,4 +0,0 @@
-this module is experimental,
-its functions may change their names
-so do not rely to much on them
-you have been warned!
diff --git a/ext/xmlreader/README b/ext/xmlreader/README
deleted file mode 100644
index 0d946f62da..0000000000
--- a/ext/xmlreader/README
+++ /dev/null
@@ -1,5 +0,0 @@
-XMLReader represents a reader that provides non-cached,
-forward-only access to XML data. It is based upon the
-xmlTextReader api from libxml
-
-This extension is designed to only work under PHP 5.
diff --git a/ext/xmlreader/TODO b/ext/xmlreader/TODO
deleted file mode 100644
index 5bf20edcc3..0000000000
--- a/ext/xmlreader/TODO
+++ /dev/null
@@ -1,6 +0,0 @@
-- Refactor internals once libxml 2.6.x is minimum requirement for PHP 5
- use new api for creating the xmlTextReaderPtr
-
-- Add Custom Error Handling
-
-
diff --git a/ext/xmlreader/config.m4 b/ext/xmlreader/config.m4
deleted file mode 100644
index 2de9292ca8..0000000000
--- a/ext/xmlreader/config.m4
+++ /dev/null
@@ -1,22 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(xmlreader, for XMLReader support,
-[ --with-xmlreader Include XMLReader support.])
-
-if test -z "$PHP_LIBXML_DIR"; then
- PHP_ARG_WITH(libxml-dir, libxml2 install dir,
- [ --with-libxml-dir=DIR XMLReader: libxml2 install prefix], no, no)
-fi
-
-if test "$PHP_XMLREADER" != "no" && test "$PHP_LIBXML" != "no"; then
-
- PHP_SETUP_LIBXML(XMLREADER_SHARED_LIBADD, [
- AC_DEFINE(HAVE_XMLREADER,1,[ ])
- PHP_NEW_EXTENSION(xmlreader, php_xmlreader.c, $ext_shared)
- PHP_SUBST(XMLREADER_SHARED_LIBADD)
- ], [
- AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
- ])
-fi
diff --git a/ext/xmlreader/config.w32 b/ext/xmlreader/config.w32
deleted file mode 100644
index 1788356c9e..0000000000
--- a/ext/xmlreader/config.w32
+++ /dev/null
@@ -1,14 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_WITH("xmlreader", "XMLReader support", "yes");
-
-if (PHP_XMLREADER == "yes" && PHP_LIBXML == "yes") {
- EXTENSION("xmlreader", "php_xmlreader.c");
- AC_DEFINE("HAVE_XMLREADER", 1, "XMLReader support");
- if (!PHP_XMLREADER_SHARED) {
- ADD_FLAG("CFLAGS_XMLREADER", "/D LIBXML_STATIC");
- }
- ADD_EXTENSION_DEP('xmlreader', 'libxml');
-}
-
diff --git a/ext/xmlreader/examples/xmlreader.xml b/ext/xmlreader/examples/xmlreader.xml
deleted file mode 100644
index 4c53743de6..0000000000
--- a/ext/xmlreader/examples/xmlreader.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<books>
- <book num="1">
- <title>The Grapes of Wrath</title>
- <author>John Steinbeck</author>
- </book>
- <book num="2">
- <title>The Pearl</title>
- <author>John Steinbeck</author>
- </book>
-</books>
diff --git a/ext/xmlreader/examples/xmlreader_file.php b/ext/xmlreader/examples/xmlreader_file.php
deleted file mode 100644
index 480b152d7e..0000000000
--- a/ext/xmlreader/examples/xmlreader_file.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-$reader = new XMLReader();
-$reader->open('xmlreader.xml');
-while ($reader->read()) {
- if ($reader->nodeType != XMLREADER_END_ELEMENT) {
- print "Node Name: ".$reader->name."\n";
- print "Node Value: ".$reader->value."\n";
- print "Node Depth: ".$reader->depth."\n";
- if ($reader->nodeType==XMLREADER_ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- while ($attr) {
- print " Attribute Name: ".$reader->name."\n";
- print " Attribute Value: ".$reader->value."\n";
- $attr = $reader->moveToNextAttribute();
- }
- }
- print "\n";
- }
-}
-?>
diff --git a/ext/xmlreader/examples/xmlreader_string.php b/ext/xmlreader/examples/xmlreader_string.php
deleted file mode 100644
index d545c22c8b..0000000000
--- a/ext/xmlreader/examples/xmlreader_string.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-$xmlstring = '<books>
- <book num="1">
- <title>The Grapes of Wrath</title>
- <author>John Steinbeck</author>
- </book>
- <book num="2">
- <title>The Pearl</title>
- <author>John Steinbeck</author>
- </book>
-</books>';
-
-$reader = new XMLReader();
-$reader->XML($xmlstring);
-while ($reader->read()) {
- if ($reader->nodeType != XMLREADER_END_ELEMENT) {
- print "Node Name: ".$reader->name."\n";
- print "Node Value: ".$reader->value."\n";
- print "Node Depth: ".$reader->depth."\n";
- if ($reader->nodeType==XMLREADER_ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- while ($attr) {
- print " Attribute Name: ".$reader->name."\n";
- print " Attribute Value: ".$reader->value."\n";
- $attr = $reader->moveToNextAttribute();
- }
- }
- print "\n";
- }
-}
-?>
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
deleted file mode 100644
index 351da498d5..0000000000
--- a/ext/xmlreader/php_xmlreader.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_xmlreader.h"
-#include <libxml/uri.h>
-
-zend_class_entry *xmlreader_class_entry;
-
-static zend_object_handlers xmlreader_object_handlers;
-
-static HashTable xmlreader_prop_handlers;
-
-typedef int (*xmlreader_read_int_t)(xmlTextReaderPtr reader);
-typedef unsigned char *(*xmlreader_read_char_t)(xmlTextReaderPtr reader);
-typedef int (*xmlreader_write_t)(xmlreader_object *obj, zval *newval TSRMLS_DC);
-
-typedef unsigned char *(*xmlreader_read_one_char_t)(xmlTextReaderPtr reader, const unsigned char *);
-
-typedef struct _xmlreader_prop_handler {
- xmlreader_read_int_t read_int_func;
- xmlreader_read_char_t read_char_func;
- xmlreader_write_t write_func;
- int type;
-} xmlreader_prop_handler;
-
-static void xmlreader_register_prop_handler(HashTable *prop_handler, char *name, xmlreader_read_int_t read_int_func, xmlreader_read_char_t read_char_func, int rettype TSRMLS_DC)
-{
- xmlreader_prop_handler hnd;
-
- hnd.read_char_func = read_char_func;
- hnd.read_int_func = read_int_func;
- hnd.type = rettype;
- zend_hash_add(prop_handler, name, strlen(name)+1, &hnd, sizeof(xmlreader_prop_handler), NULL);
-}
-
-static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handler *hnd, zval **retval TSRMLS_DC)
-{
- char *retchar = NULL;
- int retint = 0;
-
- if (obj->ptr != NULL) {
- if (hnd->read_char_func) {
- retchar = hnd->read_char_func(obj->ptr);
- } else {
- if (hnd->read_int_func) {
- retint = hnd->read_int_func(obj->ptr);
- if (retint == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal libxml error returned");
- return FAILURE;
- }
- }
- }
- }
-
- ALLOC_ZVAL(*retval);
-
- switch (hnd->type) {
- case IS_STRING:
- if (retchar) {
- ZVAL_STRING(*retval, retchar, 1);
- xmlFree(retchar);
- } else {
- ZVAL_EMPTY_STRING(*retval);
- }
- break;
- case IS_BOOL:
- ZVAL_BOOL(*retval, retint);
- break;
- case IS_LONG:
- ZVAL_LONG(*retval, retint);
- break;
- default:
- ZVAL_NULL(*retval);
- }
-
- return SUCCESS;
-}
-
-/* {{{ xmlreader_read_property */
-zval *xmlreader_read_property(zval *object, zval *member, int type TSRMLS_DC)
-{
- xmlreader_object *obj;
- zval tmp_member;
- zval *retval;
- xmlreader_prop_handler *hnd;
- zend_object_handlers *std_hnd;
- int ret;
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- ret = FAILURE;
- obj = (xmlreader_object *)zend_objects_get_address(object TSRMLS_CC);
-
- if (obj->prop_handler != NULL) {
- ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
- }
- if (ret == SUCCESS) {
- ret = xmlreader_property_reader(obj, hnd, &retval TSRMLS_CC);
- if (ret == SUCCESS) {
- /* ensure we're creating a temporary variable */
- retval->refcount = 0;
- } else {
- retval = EG(uninitialized_zval_ptr);
- }
- } else {
- std_hnd = zend_get_std_object_handlers();
- retval = std_hnd->read_property(object, member, type TSRMLS_CC);
- }
-
- if (member == &tmp_member) {
- zval_dtor(member);
- }
- return retval;
-}
-/* }}} */
-
-/* {{{ xmlreader_write_property */
-void xmlreader_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- xmlreader_object *obj;
- zval tmp_member;
- xmlreader_prop_handler *hnd;
- zend_object_handlers *std_hnd;
- int ret;
-
- if (member->type != IS_STRING) {
- tmp_member = *member;
- zval_copy_ctor(&tmp_member);
- convert_to_string(&tmp_member);
- member = &tmp_member;
- }
-
- ret = FAILURE;
- obj = (xmlreader_object *)zend_objects_get_address(object TSRMLS_CC);
-
- if (obj->prop_handler != NULL) {
- ret = zend_hash_find((HashTable *)obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
- }
- if (ret == SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write to read-only property");
- } else {
- std_hnd = zend_get_std_object_handlers();
- std_hnd->write_property(object, member, value TSRMLS_CC);
- }
-
- if (member == &tmp_member) {
- zval_dtor(member);
- }
-}
-/* }}} */
-
-/* {{{ xmlreader_module_entry
- */
-zend_module_entry xmlreader_module_entry = {
- STANDARD_MODULE_HEADER,
- "xmlreader",
- NULL,
- PHP_MINIT(xmlreader),
- PHP_MSHUTDOWN(xmlreader),
- NULL,
- NULL,
- PHP_MINFO(xmlreader),
- "0.1", /* Replace with version number for your extension */
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_XMLREADER
-ZEND_GET_MODULE(xmlreader)
-#endif
-
-/* {{{ xmlreader_objects_clone */
-void xmlreader_objects_clone(void *object, void **object_clone TSRMLS_DC)
-{
- /* TODO */
-}
-/* }}} */
-
-static void xmlreader_free_resources(xmlreader_object *intern) {
- if (intern) {
- if (intern->input) {
- xmlFreeParserInputBuffer(intern->input);
- intern->input = NULL;
- }
-
- if (intern->ptr) {
- xmlFreeTextReader(intern->ptr);
- intern->ptr = NULL;
- }
- }
-}
-
-/* {{{ xmlreader_objects_free_storage */
-void xmlreader_objects_free_storage(void *object TSRMLS_DC)
-{
- xmlreader_object *intern = (xmlreader_object *)object;
-
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
-
- xmlreader_free_resources(intern);
-
- efree(object);
-}
-/* }}} */
-
-/* {{{ xmlreader_objects_new */
-zend_object_value xmlreader_objects_new(zend_class_entry *class_type TSRMLS_DC)
-{
- zend_object_value retval;
- xmlreader_object *intern;
- zval *tmp;
-
- intern = emalloc(sizeof(xmlreader_object));
- intern->std.ce = class_type;
- intern->std.in_get = 0;
- intern->std.in_set = 0;
- intern->ptr = NULL;
- intern->input = NULL;
- intern->prop_handler = &xmlreader_prop_handlers;
-
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) xmlreader_objects_free_storage, xmlreader_objects_clone TSRMLS_CC);
- intern->handle = retval.handle;
- retval.handlers = &xmlreader_object_handlers;
- return retval;
-}
-/* }}} */
-
-static void php_xmlreader_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_one_char_t internal_function) {
- zval *id;
- int name_len = 0;
- char *retchar = NULL;
- xmlreader_object *intern;
- char *name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- if (!name_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument cannot be an empty string");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retchar = internal_function(intern->ptr, name);
- }
- if (retchar) {
- RETVAL_STRING(retchar, 1);
- xmlFree(retchar);
- return;
- } else {
- RETVAL_EMPTY_STRING();
- }
-}
-
-static void php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_int_t internal_function) {
- zval *id;
- int retval;
- xmlreader_object *intern;
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = internal_function(intern->ptr);
- if (retval == 1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-
-/* This function not yet needed until some additional functions are implemented in libxml
-static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_char_t internal_function) {
- zval *id;
- char *retchar = NULL;
- xmlreader_object *intern;
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retchar = xmlTextReaderReadString(intern->ptr);
- }
- if (retchar) {
- RETVAL_STRING(retchar, 1);
- xmlFree(retchar);
- return;
- } else {
- RETVAL_EMPTY_STRING();
- }
-}
-*/
-
-/* {{{ proto boolean close()
-Closes xmlreader - current frees resources until xmlTextReaderClose is fixed in libxml */
-PHP_METHOD(xmlreader, close)
-{
- zval *id;
- xmlreader_object *intern;
-
- id = getThis();
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- /* libxml is segfaulting in versions up to 2.6.8 using xmlTextReaderClose so for
- now we will free the whole reader when close is called as it would get rebuilt on
- a new load anyways */
- xmlreader_free_resources(intern);
-
- RETURN_TRUE;
-}
-
-/* {{{ proto string getAttribute(string name)
-Get value of an attribute from current element */
-PHP_METHOD(xmlreader, getAttribute)
-{
- php_xmlreader_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderGetAttribute);
-}
-/* }}} */
-
-/* {{{ proto string getAttributeNo(int index)
-Get value of an attribute at index from current element */
-PHP_METHOD(xmlreader, getAttributeNo)
-{
- zval *id;
- int attr_pos;
- char *retchar = NULL;
- xmlreader_object *intern;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
- return;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retchar = xmlTextReaderGetAttributeNo(intern->ptr,attr_pos);
- }
- if (retchar) {
- RETVAL_STRING(retchar, 1);
- xmlFree(retchar);
- return;
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto string getAttributeNs(string name, string namespaceURI)
-Get value of a attribute via name and namespace from current element */
-PHP_METHOD(xmlreader, getAttributeNs)
-{
- zval *id;
- int name_len = 0, ns_uri_len = 0;
- xmlreader_object *intern;
- char *name, *ns_uri, *retchar = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
- }
-
- if (name_len == 0 || ns_uri_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name and Namespace URI cannot be empty");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retchar = xmlTextReaderGetAttributeNs(intern->ptr, name, ns_uri);
- }
- if (retchar) {
- RETVAL_STRING(retchar, 1);
- xmlFree(retchar);
- return;
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto boolean getParserProperty(int property)
-Indicates wether given property (one of the parser option constants) is set or not on parser */
-PHP_METHOD(xmlreader, getParserProperty)
-{
- zval *id;
- int property, retval = -1;
- xmlreader_object *intern;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) {
- return;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = xmlTextReaderGetParserProp(intern->ptr,property);
- }
- if (retval == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parser property");
- RETURN_FALSE;
- }
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-/* {{{ proto boolean isValid()
-Returns boolean indicating if parsed document is valid or not.
-Must set XMLREADER_LOADDTD or XMLREADER_VALIDATE parser option prior to the first call to read
-or this method will always return FALSE */
-PHP_METHOD(xmlreader, isValid)
-{
- php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderIsValid);
-}
-/* }}} */
-
-/* {{{ proto string lookupNamespace(string prefix)
-Return namespaceURI for associated prefix on current node */
-PHP_METHOD(xmlreader, lookupNamespace)
-{
- php_xmlreader_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderLookupNamespace);
-}
-/* }}} */
-
-/* {{{ proto boolean moveToAttribute(string name)
-Positions reader at specified attribute - Returns TRUE on success and FALSE on failure */
-PHP_METHOD(xmlreader, moveToAttribute)
-{
- zval *id;
- int name_len = 0, retval;
- xmlreader_object *intern;
- char *name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
- return;
- }
-
- if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name is required");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = xmlTextReaderMoveToAttribute(intern->ptr, name);
- if (retval == 1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto boolean moveToAttributeNo(int index)
-Positions reader at attribute at spcecified index.
-Returns TRUE on success and FALSE on failure */
-PHP_METHOD(xmlreader, moveToAttributeNo)
-{
- zval *id;
- int attr_pos, retval;
- xmlreader_object *intern;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) {
- return;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = xmlTextReaderMoveToAttributeNo(intern->ptr, attr_pos);
- if (retval == 1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto boolean moveToAttributeNs(string name, string namespaceURI)
-Positions reader at attribute spcified by name and namespaceURI.
-Returns TRUE on success and FALSE on failure */
-PHP_METHOD(xmlreader, moveToAttributeNs)
-{
- zval *id;
- int name_len=0, ns_uri_len=0, retval;
- xmlreader_object *intern;
- char *name, *ns_uri;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
- }
-
- if (name_len == 0 || ns_uri_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name and Namespace URI cannot be empty");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = xmlTextReaderMoveToAttributeNs(intern->ptr, name, ns_uri);
- if (retval == 1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto boolean moveToElement()
-Moves the position of the current instance to the node that contains the current Attribute node. */
-PHP_METHOD(xmlreader, moveToElement)
-{
- php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderMoveToElement);
-}
-/* }}} */
-
-/* {{{ proto boolean moveToFirstAttribute()
-Moves the position of the current instance to the first attribute associated with the current node. */
-PHP_METHOD(xmlreader, moveToFirstAttribute)
-{
- php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderMoveToFirstAttribute);
-}
-/* }}} */
-
-/* {{{ proto boolean moveToNextAttribute()
-Moves the position of the current instance to the next attribute associated with the current node. */
-PHP_METHOD(xmlreader, moveToNextAttribute)
-{
- php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderMoveToNextAttribute);
-}
-/* }}} */
-
-/* {{{ proto boolean read()
-Moves the position of the current instance to the next node in the stream. */
-PHP_METHOD(xmlreader, read)
-{
- zval *id;
- int retval;
- xmlreader_object *intern;
-
- id = getThis();
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern != NULL && intern->ptr != NULL) {
- retval = xmlTextReaderRead(intern->ptr);
- if (retval == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "An Error Occured while reading");
- RETURN_FALSE;
- } else {
- RETURN_BOOL(retval);
- }
- }
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Load Data before trying to read");
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto boolean open(string URI)
-Sets the URI that the the XMLReader will parse. */
-PHP_METHOD(xmlreader, open)
-{
- zval *id;
- int source_len = 0;
- xmlreader_object *intern;
- char *source;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
- return;
- }
-
- if (!source_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
-
- xmlreader_free_resources(intern);
-
- intern->ptr = xmlNewTextReaderFilename(source);
-
- if (intern->ptr == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open source data");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* Not Yet Implemented in libxml - functions exist just not coded
-PHP_METHOD(xmlreader, readInnerXml)
-{
- php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderReadInnerXml);
-}
-
-PHP_METHOD(xmlreader, readOuterXml)
-{
- php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderReadInnerXml);
-}
-
-PHP_METHOD(xmlreader, readString)
-{
- php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextReaderReadString);
-}
-
-PHP_METHOD(xmlreader, resetState)
-{
-
-}
-*/
-
-/* {{{ proto boolean setParserProperty(int property, boolean value)
-Sets parser property (one of the parser option constants).
-Properties must be set after open() or XML() and before the first read() is called */
-PHP_METHOD(xmlreader, setParserProperty)
-{
- zval *id;
- int property, value, retval = -1;
- xmlreader_object *intern;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) {
- return;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
- if (intern && intern->ptr) {
- retval = xmlTextReaderSetParserProp(intern->ptr,property, value);
- }
- if (retval == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parser property");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto boolean XML(string source)
-Sets the string that the the XMLReader will parse. */
-PHP_METHOD(xmlreader, XML)
-{
- zval *id;
- int source_len = 0;
- xmlreader_object *intern;
- char *source, *uri = NULL;
- int resolved_path_len;
- char *directory=NULL, resolved_path[MAXPATHLEN];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
- return;
- }
-
- if (!source_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input");
- RETURN_FALSE;
- }
-
- id = getThis();
-
- intern = (xmlreader_object *)zend_object_store_get_object(id TSRMLS_CC);
-
- xmlreader_free_resources(intern);
-
- intern->input = xmlParserInputBufferCreateMem(source, source_len, XML_CHAR_ENCODING_NONE);
-
- if (intern->input != NULL) {
-/* Get the URI of the current script so that we can set the base directory in libxml */
-#if HAVE_GETCWD
- directory = VCWD_GETCWD(resolved_path, MAXPATHLEN);
-#elif HAVE_GETWD
- directory = VCWD_GETWD(resolved_path);
-#endif
- if (directory) {
- resolved_path_len = strlen(resolved_path);
- if (resolved_path[resolved_path_len - 1] != DEFAULT_SLASH) {
- resolved_path[resolved_path_len] = DEFAULT_SLASH;
- resolved_path[++resolved_path_len] = '\0';
- }
- uri = (char *) xmlCanonicPath((const xmlChar *) resolved_path);
- }
- intern->ptr = xmlNewTextReader(intern->input, uri);
- if (uri) {
- xmlFree(uri);
- }
- if (intern->ptr != NULL) {
- RETURN_TRUE;
- }
- }
-
- xmlreader_free_resources(intern);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to load source data");
- RETURN_FALSE;
-}
-/* }}} */
-
-static zend_function_entry xmlreader_functions[] = {
- PHP_ME(xmlreader, close, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNs, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getParserProperty, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, isValid, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, lookupNamespace, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNs, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToElement, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToFirstAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToNextAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, open, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, read, NULL, ZEND_ACC_PUBLIC)
-/* Not Yet Implemented though defined in libxml as of 2.6.9dev
- PHP_ME(xmlreader, readInnerXml, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readOuterXml, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readString, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, resetState, NULL, ZEND_ACC_PUBLIC)
-*/
- PHP_ME(xmlreader, setParserProperty, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, XML, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(xmlreader)
-{
-
- zend_class_entry ce;
-
- memcpy(&xmlreader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- xmlreader_object_handlers.read_property = xmlreader_read_property;
- xmlreader_object_handlers.write_property = xmlreader_write_property;
- xmlreader_object_handlers.get_property_ptr_ptr = NULL;
-
- INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
- ce.create_object = xmlreader_objects_new;
- xmlreader_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- zend_hash_init(&xmlreader_prop_handlers, 0, NULL, NULL, 1);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderBaseUri, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_LONG TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasAttributes", xmlTextReaderHasAttributes, NULL, IS_BOOL TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasValue", xmlTextReaderHasValue, NULL, IS_BOOL TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isDefault", xmlTextReaderIsDefault, NULL, IS_BOOL TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isEmptyElement", xmlTextReaderIsEmptyElement, NULL, IS_BOOL TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "localName", NULL, xmlTextReaderLocalName, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "name", NULL, xmlTextReaderName, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "namespaceURI", NULL, xmlTextReaderNamespaceUri, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_LONG TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "prefix", NULL, xmlTextReaderPrefix, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "value", NULL, xmlTextReaderValue, IS_STRING TSRMLS_CC);
- xmlreader_register_prop_handler(&xmlreader_prop_handlers, "xmlLang", NULL, xmlTextReaderXmlLang, IS_STRING TSRMLS_CC);
-
- /* Constants for NodeType - cannot define common types to share with dom as there are differences in these types */
- REGISTER_LONG_CONSTANT("XMLREADER_NONE", XML_READER_TYPE_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_ELEMENT", XML_READER_TYPE_ELEMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_TEXT", XML_READER_TYPE_TEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_CDATA", XML_READER_TYPE_CDATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_ENTITY", XML_READER_TYPE_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_PI", XML_READER_TYPE_PROCESSING_INSTRUCTION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_COMMENT", XML_READER_TYPE_COMMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_DOC", XML_READER_TYPE_DOCUMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_NOTATION", XML_READER_TYPE_NOTATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_WHITESPACE", XML_READER_TYPE_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_END_ELEMENT", XML_READER_TYPE_END_ELEMENT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_END_ENTITY", XML_READER_TYPE_END_ENTITY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION, CONST_CS | CONST_PERSISTENT);
-
- /* Constants for Parser options */
- REGISTER_LONG_CONSTANT("XMLREADER_LOADDTD", XML_PARSER_LOADDTD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_DEFAULTATTRS", XML_PARSER_DEFAULTATTRS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_VALIDATE", XML_PARSER_VALIDATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES, CONST_CS | CONST_PERSISTENT);
-
- /* Constants for Errors when loading - not yet used until we implement custom error handling
- REGISTER_LONG_CONSTANT("XMLREADER_VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XMLREADER_ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT);
- */
-
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(xmlreader)
-{
- zend_hash_destroy(&xmlreader_prop_handlers);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(xmlreader)
-{
- php_info_print_table_start();
- {
- php_info_print_table_row(2, "XMLReader", "enabled");
- }
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h
deleted file mode 100644
index 8040e0b37f..0000000000
--- a/ext/xmlreader/php_xmlreader.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_XMLREADER_H
-#define PHP_XMLREADER_H
-
-extern zend_module_entry xmlreader_module_entry;
-#define phpext_xmlreader_ptr &xmlreader_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XMLREADER_API __declspec(dllexport)
-#else
-#define PHP_XMLREADER_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "ext/libxml/php_libxml.h"
-#include <libxml/xmlreader.h>
-
-typedef struct _xmlreader_object {
- zend_object std;
- xmlTextReaderPtr ptr;
- /* input is used to allow strings to be loaded under libxml 2.5.x
- must manually allocate and de-allocate these - can be refactored when
- libxml 2.6.x becomes minimum version */
- xmlParserInputBufferPtr input;
- HashTable *prop_handler;
- zend_object_handle handle;
-} xmlreader_object;
-
-PHP_MINIT_FUNCTION(xmlreader);
-PHP_MSHUTDOWN_FUNCTION(xmlreader);
-PHP_MINFO_FUNCTION(xmlreader);
-
-
-#ifdef ZTS
-#define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v)
-#else
-#define XMLREADER_G(v) (xmlreader_globals.v)
-#endif
-
-#endif /* PHP_XMLREADER_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/xmlreader/xmlreader.dsp b/ext/xmlreader/xmlreader.dsp
deleted file mode 100644
index 7b21518ba3..0000000000
--- a/ext/xmlreader/xmlreader.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlreader" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xmlreader - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlreader.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlreader.mak" CFG="xmlreader - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlreader - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xmlreader - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlreader - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "xmlreader___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "xmlreader___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XMLREADER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php5ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-
-!ELSEIF "$(CFG)" == "xmlreader - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "xmlreader___Win32_Release_TS0"
-# PROP BASE Intermediate_Dir "xmlreader___Win32_Release_TS0"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XMLREADER_EXPORTS" /D "COMPILE_DL_XSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "LIBXML_THREAD_ENABLED" /YX /FD /GZ /c
-# SUBTRACT CPP /Fr
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php5ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-# ADD LINK32 php5ts.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib /nologo /dll /incremental:no /machine:I386 /out:"..\..\Release_TS/php_xmlreader.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release"
-# SUBTRACT LINK32 /debug
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlreader - Win32 Debug_TS"
-# Name "xmlreader - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_xmlreader.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_xmlreader.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 0607e91cc4..0000000000
--- a/main/php_realpath.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *php_realpath(char *path, char resolved_path[]);
-
-#ifdef PHP_WIN32
-#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
-#else
-#define IS_SLASH(p) ((p) == '/')
-#endif
-
-char *php_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !defined(PHP_WIN32)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#ifdef PHP_WIN32
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#ifdef PHP_WIN32
- /* Find out where we start - Windows version */
- if (IS_SLASH(*workpos)) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
- while(IS_SLASH(*workpos)) workpos++;
-
-#ifdef PHP_WIN32
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- writepos--;
- while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
- }
- workpos++;
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (IS_SLASH(*workpos)) {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* defined(PHP_WIN32) */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* defined(PHP_WIN32) */
- }
-
- /* Check if the resolved path is a directory */
- if (V_STAT(path_construction, &filestat) != 0) {
- if (errno != ENOENT) return NULL;
- } else {
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) {
- return NULL;
- }
- *writepos++ = '/';
- *writepos = 0;
- }
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */