summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2005-06-23 03:56:38 +0000
committerSVN Migration <svn@php.net>2005-06-23 03:56:38 +0000
commitabf24cfa1f9acfe17ab0629e237095fad5218623 (patch)
tree585ccbd58b932ea8c50f8274b49b2fd4a5de6783
parentfe238490f9f0e95f613220f45fcab99188601177 (diff)
downloadphp-git-abf24cfa1f9acfe17ab0629e237095fad5218623.tar.gz
This commit was manufactured by cvs2svn to create tag 'php_5_1_0b2'.php-5.1.0b2
-rw-r--r--ext/enchant/CREDITS2
-rwxr-xr-xext/enchant/config.m436
-rw-r--r--ext/enchant/config.w3213
-rw-r--r--ext/enchant/docs/examples/example1.php25
-rwxr-xr-xext/enchant/enchant.c731
-rwxr-xr-xext/enchant/package.xml83
-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.c433
-rw-r--r--ext/fileinfo/fileinfo.php29
-rw-r--r--ext/fileinfo/package.xml43
-rw-r--r--ext/fileinfo/php_fileinfo.h61
-rw-r--r--ext/filter/README2
-rw-r--r--ext/filter/config.m411
-rw-r--r--ext/filter/filter.c544
-rw-r--r--ext/filter/filter.h58
-rw-r--r--ext/filter/tests/001.phpt9
-rw-r--r--ext/filter/tests/002.phpt12
-rw-r--r--ext/filter/tests/003.phpt22
-rw-r--r--ext/filter/tests/004.phpt24
-rw-r--r--ext/filter/tests/005.phpt22
-rw-r--r--ext/filter/tests/006.phpt11
-rw-r--r--ext/imap/imap.h103
-rw-r--r--ext/pcre/config0.m456
-rw-r--r--ext/standard/parsedate.y1161
-rw-r--r--ext/standard/php_parsedate.h28
-rwxr-xr-xext/standard/tests/array/bug29992.phpt44
-rw-r--r--ext/standard/tests/time/002-win32.phpt66
-rw-r--r--ext/standard/tests/time/002.phpt96
-rw-r--r--ext/standard/tests/time/bug13142.phpt20
-rw-r--r--ext/standard/tests/time/bug17988.phpt33
-rw-r--r--ext/standard/tests/time/bug20382.phpt16
-rw-r--r--ext/standard/tests/time/bug26198.phpt10
-rw-r--r--ext/standard/tests/time/bug26317.phpt17
-rw-r--r--ext/standard/tests/time/bug26320.phpt15
-rw-r--r--ext/standard/tests/time/bug27780.phpt113
-rw-r--r--ext/standard/tests/time/bug28599.phpt8
-rw-r--r--ext/xmlwriter/CREDITS3
-rw-r--r--ext/xmlwriter/TODO4
-rw-r--r--ext/xmlwriter/config.m461
-rw-r--r--ext/xmlwriter/config.w3218
-rw-r--r--ext/xmlwriter/examples/xmlwriter_file.php44
-rw-r--r--ext/xmlwriter/examples/xmlwriter_mem.php39
-rw-r--r--ext/xmlwriter/examples/xmlwriter_mem_ns.php30
-rw-r--r--ext/xmlwriter/package.xml65
-rw-r--r--ext/xmlwriter/php_xmlwriter.c1493
-rw-r--r--ext/xmlwriter/php_xmlwriter.h98
-rw-r--r--main/php_realpath.c285
-rw-r--r--tests/lang/bug21800.phpt19
51 files changed, 1646 insertions, 4606 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 f9ba6beafc..0000000000
--- a/ext/enchant/config.w32
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("enchant", "Enchant Support", "no");
-
-if (PHP_ENCHANT == "yes") {
- if (CHECK_HEADER_ADD_INCLUDE("enchant.h", "CFLAGS_ENCHANT", PHP_ENCHANT)) {
- EXTENSION("enchant", "enchant.c");
- AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
- } else {
- WARNING('Could not find enchant.h; skipping');
- }
-}
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 b92fa9d468..0000000000
--- a/ext/enchant/enchant.c
+++ /dev/null
@@ -1,731 +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();
- enchant_broker_free(pbroker);
-}
-/* }}} */
-
-#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 filename)
- 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;
- }
-
- if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
- 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);
-}
-/* }}} */
-
-/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
- If the word is correctly spelled return true, otherwise return false, if suggestions variable
- is provided, fill it with spelling alternatives. */
-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 bool enchant_dict_check(resource dict, string word)
- 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 dict, 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 dict, string word)
- add 'word' to personal word list */
-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 dict, 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 dict, string word)
- 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 dict, 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 6bc17c7a9b..0000000000
--- a/ext/enchant/package.xml
+++ /dev/null
@@ -1,83 +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>lead</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>stable</state>
- <version>1.0</version>
- <date>2004-08-11</date>
- <notes>- Fixed leak inside MINFO function.
-- Fixed crash inside enchant_dict_suggest() when there are no suggestions.
-- Added missing safe_mode/open_basedir check inside enchant_broker_request_pwl_dict().
-- Fixed various function prototypes.
-- Fixed possible leak in suggestions result.</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>beta</state>
- <version>0.2.1</version>
- <date>2004-03-11</date>
- <notes>- Fix possible leak in suggestions result
-- Move to beta status</notes>
- </release>
- <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 72cc3aabbf..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/include /usr/include /usr/share/file"
- SEARCH_FOR="/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 -lz -ldl
- ])
-
- MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
- 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 92e70419d9..0000000000
--- a/ext/fileinfo/fileinfo.c
+++ /dev/null
@@ -1,433 +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>
-/*
- * HOWMANY specifies the maximum offset libmagic will look at
- * this is currently hardcoded in the libmagic source but not exported
- */
-#ifndef HOWMANY
-#define HOWMANY 65536
-#endif
-
-
-#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_FILEINFO
-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);
- magic_close(finfo->magic);
- efree(finfo);
- 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_CC);
- 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, HOWMANY, 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 4b4b085c10..0000000000
--- a/ext/fileinfo/package.xml
+++ /dev/null
@@ -1,43 +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.2</version>
- <date>2004-05-26</date>
- <notes>
- Fixed bug that caused PHP to refuse to recognize fileinfo.so.
- </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 66c562172d..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_FILEINFO_H
-#define PHP_FILEINFO_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/filter/README b/ext/filter/README
deleted file mode 100644
index b04648c4a4..0000000000
--- a/ext/filter/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This doesn't work yet. There are no actual filters as of yet, just the
-framework code to call the filters and store the original data.
diff --git a/ext/filter/config.m4 b/ext/filter/config.m4
deleted file mode 100644
index e27e30abd2..0000000000
--- a/ext/filter/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl $Id$
-dnl config.m4 for input filtering extension
-
-PHP_ARG_ENABLE(filter, whether to enable input filter support,
-[ --enable-filter Enable input filter support])
-
-if test "$PHP_FILTER" != "no"; then
- PHP_SUBST(FILTER_SHARED_LIBADD)
- PHP_NEW_EXTENSION(filter, filter.c, $ext_shared)
- CPPFLAGS="$CPPFLAGS -Wall"
-fi
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
deleted file mode 100644
index b68885ac44..0000000000
--- a/ext/filter/filter.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- $Id$
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_variables.h"
-
-#include "filter.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(filter)
-
-#ifndef PARSE_ENV
-#define PARSE_ENV 4
-#endif
-
-#ifndef PARSE_SERVER
-#define PARSE_SERVER 5
-#endif
-
-/* {{{ filter_functions[]
- */
-function_entry filter_functions[] = {
- PHP_FE(filter, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ filter_module_entry
- */
-zend_module_entry filter_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
- STANDARD_MODULE_HEADER,
-#endif
- "filter",
- filter_functions,
- PHP_MINIT(filter),
- PHP_MSHUTDOWN(filter),
- NULL,
- PHP_RSHUTDOWN(filter),
- PHP_MINFO(filter),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_FILTER
-ZEND_GET_MODULE(filter)
-#endif
-
-/* {{{ UpdateDefaultFilter
- */
-static PHP_INI_MH(UpdateDefaultFilter) {
- if(!strcasecmp(new_value, "notags")) {
- IF_G(default_filter) = NOTAGS;
- }
- else
- if(!strcasecmp(new_value, "raw")) {
- IF_G(default_filter) = F_UNSAFE_RAW;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("filter.default", "notags", PHP_INI_ALL, UpdateDefaultFilter, default_filter, zend_filter_globals, filter_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_filter_init_globals
- */
-static void php_filter_init_globals(zend_filter_globals *filter_globals)
-{
- filter_globals->post_array = NULL;
- filter_globals->get_array = NULL;
- filter_globals->cookie_array = NULL;
- filter_globals->env_array = NULL;
- filter_globals->server_array = NULL;
- filter_globals->default_filter = NOTAGS;
-}
-/* }}} */
-
-#define PARSE_REQUEST 99
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(filter)
-{
- ZEND_INIT_MODULE_GLOBALS(filter, php_filter_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- REGISTER_LONG_CONSTANT("FILTER_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_COOK_LOW", FILTER_FLAG_COOK_LOW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_COOK_HIGH", FILTER_FLAG_COOK_HIGH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SIGN", FILTER_FLAG_ALLOW_SIGN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_HTML_NO_TAGS", FILTER_HTML_NO_TAGS, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILTER_UNSAFE_RAW", F_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_STRIPPED", F_STRIPPED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_COOKED", F_COOKED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_HTML", F_HTML, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_EMAIL", F_EMAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_URL", F_URL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_NUMBER", F_NUMBER, CONST_CS | CONST_PERSISTENT);
-
- sapi_register_input_filter(php_sapi_filter);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(filter)
-{
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(filter)
-{
- if(IF_G(get_array)) {
- zval_ptr_dtor(&IF_G(get_array));
- IF_G(get_array) = NULL;
- }
- if(IF_G(post_array)) {
- zval_ptr_dtor(&IF_G(post_array));
- IF_G(post_array) = NULL;
- }
- if(IF_G(cookie_array)) {
- zval_ptr_dtor(&IF_G(cookie_array));
- IF_G(cookie_array) = NULL;
- }
- if(IF_G(env_array)) {
- zval_ptr_dtor(&IF_G(env_array));
- IF_G(env_array) = NULL;
- }
- if(IF_G(server_array)) {
- zval_ptr_dtor(&IF_G(server_array));
- IF_G(server_array) = NULL;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(filter)
-{
- char tmp[256];
-
- php_info_print_table_start();
- php_info_print_table_row( 2, "PHP extension for Input Validation and Filtering", "enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision$");
- sprintf(tmp, "%d",IF_G(default_filter));
- php_info_print_table_row( 2, "default_filter", tmp);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned *new_val_len)
- */
-unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC)
-{
- zval new_var;
- zval *array_ptr = NULL;
- char *raw_var, *out;
- int var_len, res, ol, out_len;
-
- assert(*val != NULL);
-
-#if PHP_API_VERSION > 20041224
- if(IF_G(default_filter)==F_UNSAFE_RAW) {
- if(new_val_len) *new_val_len = val_len;
- return 1;
- }
-#else
- if(IF_G(default_filter)==F_UNSAFE_RAW) return(val_len);
-#endif
-
- switch(arg) {
- case PARSE_GET:
- if(!IF_G(get_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- IF_G(get_array) = array_ptr;
- }
- else {
- array_ptr = IF_G(get_array);
- }
- break;
- case PARSE_POST:
- if(!IF_G(post_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- IF_G(post_array) = array_ptr;
- }
- else {
- array_ptr = IF_G(post_array);
- }
- break;
- case PARSE_COOKIE:
- if(!IF_G(cookie_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- IF_G(cookie_array) = array_ptr;
- }
- else {
- array_ptr = IF_G(cookie_array);
- }
- break;
- case PARSE_ENV:
- if(!IF_G(env_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- IF_G(env_array) = array_ptr;
- }
- else {
- array_ptr = IF_G(env_array);
- }
- break;
- case PARSE_SERVER:
- if(!IF_G(server_array)) {
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- IF_G(server_array) = array_ptr;
- }
- else {
- array_ptr = IF_G(server_array);
- }
- break;
- }
-
- Z_STRLEN(new_var) = val_len;
- Z_STRVAL(new_var) = estrndup(*val, val_len);
- Z_TYPE(new_var) = IS_STRING;
-
- var_len = strlen(var);
- raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
- strcpy(raw_var, "RAW_");
- strlcat(raw_var,var,var_len+5);
-
- php_register_variable_ex(raw_var, &new_var, array_ptr TSRMLS_DC);
-
- ol = 0;
- out_len = val_len * 2;
- if(!out_len) out = estrdup("");
- else out = emalloc(out_len);
- while((res = php_filter_get_html(*val, val_len, out, &out_len, FILTER_HTML_NO_TAGS, FILTER_FLAG_ENCODE_AMP, NULL)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol; /* Just in case we don't actually get the right out_len for some reason */
- out = emalloc(out_len);
- }
- *val = out;
-#if PHP_API_VERSION > 20041224
- if(new_val_len) *new_val_len = out_len?out_len-1:0;
- return 1;
-#else
- return(out_len?out_len-1:0);
-#endif
-}
-/* }}} */
-
-/* {{{ static void filter_recursive(zval *array, long filter, long flags, char *charset TSRMLS_DC)
- */
-static void filter_recursive(zval *array, long filter, long flags, char *charset TSRMLS_DC)
-{
- zval **element;
- HashPosition pos;
- int out_len, res, ol=0; /* Yes, ol should start at 0 here because the filter returns the right length */
- char *out;
-
- if (Z_TYPE_P(array) == IS_ARRAY) {
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos)) {
- filter_recursive(*element, filter, flags, charset TSRMLS_CC);
- }
- } else if(Z_STRLEN_P(array)) {
- switch(filter) {
- case F_STRIPPED:
- out_len = Z_STRLEN_P(array) + 1;
- out = emalloc(out_len);
- while((res = php_filter_get_stripped(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- break;
-
- case F_COOKED:
- out_len = Z_STRLEN_P(array) * 2;
- out = emalloc(out_len);
- while((res = php_filter_get_cooked(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- break;
-
- case F_EMAIL:
- out_len = Z_STRLEN_P(array) + 1;
- out = emalloc(out_len);
- while((res = php_filter_get_email(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- if(res==FILTER_RESULT_BAD_IN) { Z_TYPE_P(array) = IS_BOOL; Z_LVAL_P(array) = 0; }
- else {
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- }
- break;
-
- case F_URL:
- out_len = Z_STRLEN_P(array) + 1;
- out = emalloc(out_len);
- while((res = php_filter_get_url(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- if(res==FILTER_RESULT_BAD_IN) { Z_TYPE_P(array) = IS_BOOL; Z_LVAL_P(array) = 0; }
- else {
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- }
- break;
-
- case F_NUMBER:
- out_len = Z_STRLEN_P(array) + 1;
- out = emalloc(out_len);
- while((res = php_filter_get_number(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- if(res==FILTER_RESULT_BAD_IN) { Z_TYPE_P(array) = IS_BOOL; Z_LVAL_P(array) = 0; }
- else {
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- }
- break;
-
- case F_NOTAGS:
- default:
- out_len = Z_STRLEN_P(array) + 1;
- out = emalloc(out_len);
- while((res = php_filter_get_html(Z_STRVAL_P(array), Z_STRLEN_P(array), out, &out_len, FILTER_HTML_NO_TAGS, flags, charset)) == FILTER_RESULT_OUTLEN_SMALL) {
- efree(out);
- ol++;
- out_len *= ol;
- out = emalloc(out_len);
- }
- efree(Z_STRVAL_P(array));
- Z_STRVAL_P(array) = out;
- Z_STRLEN_P(array) = out_len - 1;
- }
- }
-}
-/* }}} */
-
-/* {{{ filter(constant type, string variable_name [, int filter [, int flags [, string charset]]])
- */
-PHP_FUNCTION(filter)
-{
- long arg, filter = F_NOTAGS, flags = 0;
- char *var;
- int var_len, charset_len, found = 0;
- int argc = ZEND_NUM_ARGS();
- zval **tmp;
- zval *array_ptr = NULL, *array_ptr2 = NULL, *array_ptr3 = NULL;
- HashTable *hash_ptr;
- char *raw_var, *charset = NULL;
-
- if(zend_parse_parameters(argc TSRMLS_CC, "ls|lls", &arg, &var, &var_len, &filter, &flags, &charset, &charset_len) == FAILURE) {
- return;
- }
-
- switch(arg) {
- case PARSE_GET:
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(get_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_GET];
- break;
- case PARSE_POST:
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(post_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_POST];
- break;
- case PARSE_COOKIE:
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(cookie_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_COOKIE];
- break;
- case PARSE_ENV:
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(env_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_ENV];
- break;
- case PARSE_SERVER:
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(server_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_SERVER];
- break;
- case PARSE_REQUEST:
- if (PG(variables_order)) {
- zval **a_ptr = &array_ptr;
- char *p, *variables_order = PG(variables_order);
- for (p=variables_order; p && *p; p++) {
- switch(*p) {
- case 'p':
- case 'P':
- if(IF_G(default_filter)!=F_UNSAFE_RAW) *a_ptr = IF_G(post_array);
- else *a_ptr = PG(http_globals)[TRACK_VARS_POST];
- break;
- case 'g':
- case 'G':
- if(IF_G(default_filter)!=F_UNSAFE_RAW) *a_ptr = IF_G(get_array);
- else *a_ptr = PG(http_globals)[TRACK_VARS_GET];
- break;
- case 'c':
- case 'C':
- if(IF_G(default_filter)!=F_UNSAFE_RAW) *a_ptr = IF_G(cookie_array);
- else *a_ptr = PG(http_globals)[TRACK_VARS_COOKIE];
- break;
- }
- if(array_ptr && !array_ptr2) { a_ptr = &array_ptr2; continue; }
- if(array_ptr2 && !array_ptr3) { a_ptr = &array_ptr3; }
- }
- } else {
- if(IF_G(default_filter)!=F_UNSAFE_RAW) array_ptr = IF_G(get_array);
- else array_ptr = PG(http_globals)[TRACK_VARS_GET];
- break;
- }
-
- }
-
- if(!array_ptr) RETURN_FALSE;
-
- if(IF_G(default_filter)!=F_UNSAFE_RAW) {
- /*
- * I'm changing the variable name here because when running with register_globals on,
- * the variable will end up in the global symbol table and I am using that var name
- * in the internal raw storage arrays as well.
- */
- var_len += 5;
- raw_var = emalloc(var_len); /* RAW_ and a \0 */
- strcpy(raw_var, "RAW_");
- strlcat(raw_var,var,var_len);
- } else {
- raw_var = var;
- var_len++;
- }
-
- if(array_ptr3) {
- hash_ptr = HASH_OF(array_ptr3);
- if(hash_ptr && zend_hash_find(hash_ptr, raw_var, var_len, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- found = 1;
- }
- }
-
- if(array_ptr2 && !found) {
- hash_ptr = HASH_OF(array_ptr2);
- if(hash_ptr && zend_hash_find(hash_ptr, raw_var, var_len, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- found = 1;
- }
- }
-
- if(!found) {
- hash_ptr = HASH_OF(array_ptr);
-
- if(hash_ptr && zend_hash_find(hash_ptr, raw_var, var_len, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- found = 1;
- }
- }
-
- if(found) {
- zval_copy_ctor(return_value); /* Watch out for empty strings */
- if(filter != F_UNSAFE_RAW) {
- filter_recursive(return_value, filter, flags, charset);
- }
- } else {
- RETVAL_FALSE;
- }
-
- if(IF_G(default_filter)!=F_UNSAFE_RAW) {
- efree(raw_var);
- }
-}
-/* }}} */
-
-/*
- * 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/filter/filter.h b/ext/filter/filter.h
deleted file mode 100644
index 4c14e7bc81..0000000000
--- a/ext/filter/filter.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- $Id$
-*/
-
-#ifndef PHP_FILTER_H
-#define PHP_FILTER_H
-
-extern zend_module_entry filter_module_entry;
-#define phpext_filter_ptr &filter_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_FILTER_API __declspec(dllexport)
-#else
-#define PHP_FILTER_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#if PHP_API_VERSION > 20041224
-unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len);
-#else
-unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len);
-#endif
-
-PHP_MINIT_FUNCTION(filter);
-PHP_MSHUTDOWN_FUNCTION(filter);
-PHP_RINIT_FUNCTION(filter);
-PHP_RSHUTDOWN_FUNCTION(filter);
-PHP_MINFO_FUNCTION(filter);
-
-PHP_FUNCTION(filter);
-
-ZEND_BEGIN_MODULE_GLOBALS(filter)
- zval *post_array;
- zval *get_array;
- zval *cookie_array;
- zval *env_array;
- zval *server_array;
- int default_filter;
-ZEND_END_MODULE_GLOBALS(filter)
-
-#ifdef ZTS
-#define IF_G(v) TSRMG(filter_globals_id, zend_filter_globals *, v)
-#else
-#define IF_G(v) (filter_globals.v)
-#endif
-
-#endif /* FILTER_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/filter/tests/001.phpt b/ext/filter/tests/001.phpt
deleted file mode 100644
index 9fa9d40c74..0000000000
--- a/ext/filter/tests/001.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Simple GET test
---POST--
---GET--
-a=1
---FILE--
-<?php echo $_GET['a']; ?>
---EXPECT--
-1
diff --git a/ext/filter/tests/002.phpt b/ext/filter/tests/002.phpt
deleted file mode 100644
index 8c20bf95f6..0000000000
--- a/ext/filter/tests/002.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-GET test with 2 values and an empty one
---POST--
---GET--
-a=1&b=&c=3
---FILE--
-<?php echo $_GET['a'];
-echo $_GET['b'];
-echo $_GET['c'];
-?>
---EXPECT--
-13
diff --git a/ext/filter/tests/003.phpt b/ext/filter/tests/003.phpt
deleted file mode 100644
index 43e6cd9b03..0000000000
--- a/ext/filter/tests/003.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-GET/POST/REQUEST Test
---POST--
-d=4&e=5
---GET--
-a=1&b=&c=3
---FILE--
-<?php echo $_GET['a'];
-echo $_GET['b'];
-echo $_GET['c'];
-echo $_POST['d'];
-echo $_POST['e'];
-echo "\n";
-echo $_REQUEST['a'];
-echo $_REQUEST['b'];
-echo $_REQUEST['c'];
-echo $_REQUEST['d'];
-echo $_REQUEST['e'];
-?>
---EXPECT--
-1345
-1345
diff --git a/ext/filter/tests/004.phpt b/ext/filter/tests/004.phpt
deleted file mode 100644
index afadd2639f..0000000000
--- a/ext/filter/tests/004.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-GET/POST/REQUEST Test with filtered data
---INI--
-filter.default=notags
---POST--
-d="quotes"&e=\slash
---GET--
-a=O'Henry&b=&c=<b>Bold</b>
---FILE--
-<?php echo $_GET['a'];
-echo $_GET['b'];
-echo $_GET['c'];
-echo $_POST['d'];
-echo $_POST['e'];
-echo "\n";
-echo $_REQUEST['a'];
-echo $_REQUEST['b'];
-echo $_REQUEST['c'];
-echo $_REQUEST['d'];
-echo $_REQUEST['e'];
-?>
---EXPECT--
-O&#39;HenryBold&quot;quotes&quot;\slash
-O&#39;HenryBold&quot;quotes&quot;\slash
diff --git a/ext/filter/tests/005.phpt b/ext/filter/tests/005.phpt
deleted file mode 100644
index 07f7c5945c..0000000000
--- a/ext/filter/tests/005.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-GET/REQUEST Test with fifa example data
---INI--
-filter.default=notags
---POST--
---GET--
-id=f03_photos&pgurl=http%3A//fifaworldcup.yahoo.com/03/en/photozone/index.html
---FILE--
-<?php
-echo $_GET['id'];
-echo "\n";
-echo $_GET['pgurl'];
-echo "\n";
-echo $_REQUEST['id'];
-echo "\n";
-echo $_REQUEST['pgurl'];
-?>
---EXPECT--
-f03_photos
-http://fifaworldcup.yahoo.com/03/en/photozone/index.html
-f03_photos
-http://fifaworldcup.yahoo.com/03/en/photozone/index.html
diff --git a/ext/filter/tests/006.phpt b/ext/filter/tests/006.phpt
deleted file mode 100644
index 5ad6c12c33..0000000000
--- a/ext/filter/tests/006.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-filter() test
---POST--
-foo=<b>abc</b>
---GET--
---FILE--
-<?php
-echo filter(FILTER_POST, 'foo', FILTER_HTML);
-?>
---EXPECT--
-abc
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 2585426f81..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 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000 -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/$PHP_LIBDIR; 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 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000)
- fi
- PHP_SUBST(PCRE_SHARED_LIBADD)
-fi
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
new file mode 100644
index 0000000000..c5b4dbc42f
--- /dev/null
+++ b/ext/standard/parsedate.y
@@ -0,0 +1,1161 @@
+%{
+/*
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
+**
+** This code is in the public domain and has no copyright.
+*/
+
+/* $Id$ */
+
+#include "php.h"
+
+#ifdef PHP_WIN32
+#include <malloc.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <time.h>
+#include <ctype.h>
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef PHP_WIN32
+# include "win32/time.h"
+#endif
+
+#include "php_parsedate.h"
+
+#if HAVE_STDLIB_H
+# include <stdlib.h> /* for `free'; used by Bison 1.27 */
+#endif
+
+#if defined(_HPUX_SOURCE)
+#include <alloca.h>
+#endif
+
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
+#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+
+/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
+ - Its arg may be any int or unsigned int; it need not be an unsigned char.
+ - It's guaranteed to evaluate its argument exactly once.
+ - It's typically faster.
+ Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
+ only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
+ it's important to use the locale's definition of `digit' even when the
+ host does not conform to Posix. */
+#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+
+#if defined (STDC_HEADERS) || defined (USG)
+# include <string.h>
+#endif
+
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+/* Some old versions of bison generate parsers that use bcopy.
+ That loses on systems that don't provide the function, so we have
+ to redefine it here. */
+#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
+# define bcopy(from, to, len) memcpy ((to), (from), (len))
+#endif
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in the same program. Note that these are only
+ the variables produced by yacc. If other parser generators (bison,
+ byacc, etc) produce additional global names that conflict at link time,
+ then those parser generators need to be fixed instead of adding those
+ names to this list. */
+
+#define yyparse php_gd_parse
+#define yylex php_gd_lex
+
+static int yyerror ();
+
+#define EPOCH 1970
+#define HOUR(x) ((x) * 60)
+
+#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
+
+/*
+** An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+ const char *name;
+ int type;
+ int value;
+} TABLE;
+
+
+/*
+** Meridian: am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+ MERam, MERpm, MER24
+} MERIDIAN;
+
+struct date_yy {
+ const char *yyInput;
+ int yyDayOrdinal;
+ int yyDayNumber;
+ int yyHaveDate;
+ int yyHaveDay;
+ int yyHaveRel;
+ int yyHaveTime;
+ int yyHaveZone;
+ int yyTimezone;
+ int yyDay;
+ int yyHour;
+ int yyMinutes;
+ int yyMonth;
+ int yySeconds;
+ int yyYear;
+ MERIDIAN yyMeridian;
+ int yyRelDay;
+ int yyRelHour;
+ int yyRelMinutes;
+ int yyRelMonth;
+ int yyRelSeconds;
+ int yyRelYear;
+};
+
+typedef union _date_ll {
+ int Number;
+ enum _MERIDIAN Meridian;
+} date_ll;
+
+#define YYPARSE_PARAM parm
+#define YYLEX_PARAM parm
+#define YYSTYPE date_ll
+#define YYLTYPE void
+
+static int yylex (YYSTYPE *lvalp, void *parm);
+%}
+
+/* This grammar has 56 shift/reduce conflicts. */
+%expect 56
+%pure_parser
+
+%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID tTZONE tWZONE tZZONE
+%token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
+%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+
+%type <Number> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
+%type <Number> tMONTH tMONTH_UNIT
+%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE tTZONE tWZONE tZZONE
+%type <Meridian> tMERIDIAN
+
+%%
+
+spec : /* NULL */
+ | spec item
+ ;
+
+item : time {
+ ((struct date_yy *)parm)->yyHaveTime++;
+ }
+ | zone {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ }
+ | date {
+ ((struct date_yy *)parm)->yyHaveDate++;
+ }
+ | day {
+ ((struct date_yy *)parm)->yyHaveDay++;
+ }
+ | rel {
+ ((struct date_yy *)parm)->yyHaveRel++;
+ }
+ | number
+ | o_merid
+ ;
+
+time : tUNUMBER tMERIDIAN {
+ ((struct date_yy *)parm)->yyHour = $1;
+ ((struct date_yy *)parm)->yyMinutes = 0;
+ ((struct date_yy *)parm)->yySeconds = 0;
+ ((struct date_yy *)parm)->yyMeridian = $2;
+ }
+ | iso8601time_colon
+ /* | pgsqltime ... shares a common spec with ISO8601 */
+ ;
+
+iso8601time_colon: HMStime_with_colon sec_fraction_part rel {
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ }
+ | HMtime_with_colon sec_fraction_part rel {
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ ((struct date_yy *)parm)->yySeconds = 0;
+ }
+ | HMStime_with_colon sec_fraction_part iso8601zonepart {
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ }
+ | HMtime_with_colon sec_fraction_part iso8601zonepart {
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ ((struct date_yy *)parm)->yySeconds = 0;
+ }
+ ;
+
+iso8601zonepart: zonepart_numeric_without_colon {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ }
+ | zonepart_numeric_with_colon {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ }
+ | zone {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ }
+ | /* empty */
+ ;
+
+sec_fraction_part: '.' tUNUMBER {
+ }
+ | /* empty */
+ ;
+
+zonepart_numeric_without_colon: tSNUMBER {
+ /* format: [+-]hhmm */
+ if ($1 <= -100 || $1 >= 100) {
+ ((struct date_yy *)parm)->yyTimezone = (-$1 / 100) * 60 + (-$1 % 100);
+ } else if ($1 >= -99 || $1 <= 99) {
+ ((struct date_yy *)parm)->yyTimezone = -$1 * 60;
+ }
+ }
+ ;
+
+zonepart_numeric_with_colon: tSNUMBER ':' tUNUMBER {
+ /* format: [+-]hh:mm */
+ ((struct date_yy *)parm)->yyTimezone = -$1 * 60 + ($1 > 0 ? -$3: $3);
+ }
+ ;
+
+HMStime_with_colon: HMtime_with_colon ':' tUNUMBER {
+ /* format: hh:mm:ss */
+ ((struct date_yy *)parm)->yySeconds = $3;
+ }
+ ;
+
+HMtime_with_colon: tUNUMBER ':' tUNUMBER {
+ /* format: hh:mm */
+ ((struct date_yy *)parm)->yyHour = $1;
+ ((struct date_yy *)parm)->yyMinutes = $3;
+ }
+ ;
+
+
+ /* we have to deal with a special case for the datetime format
+ of XML Schema here: '2003-11-18T22:40:00Z'
+ the combination of a 'T' timezone specifier later followed
+ by a 'Z' is now recognized and allowed
+ TODO: change the grammer so that the exact positions are checked
+ right now '2003-11-18 22:40:00 TZ' is also accepted (hartmut)
+ */
+
+zone : tTZONE {
+ ((struct date_yy *)parm)->yyTimezone = $1;
+ }
+ | tWZONE {
+ ((struct date_yy *)parm)->yyTimezone = $1;
+ }
+ | tZZONE {
+ ((struct date_yy *)parm)->yyTimezone = $1;
+ }
+ | tZONE {
+ ((struct date_yy *)parm)->yyTimezone = $1;
+ }
+ | tDAYZONE {
+ ((struct date_yy *)parm)->yyTimezone = $1 - 60;
+ }
+ | tZONE tDST {
+ ((struct date_yy *)parm)->yyTimezone = $1 - 60;
+ }
+ ;
+
+day : tDAY {
+ ((struct date_yy *)parm)->yyDayOrdinal = 1;
+ ((struct date_yy *)parm)->yyDayNumber = $1;
+ }
+ | tDAY ',' {
+ ((struct date_yy *)parm)->yyDayOrdinal = 1;
+ ((struct date_yy *)parm)->yyDayNumber = $1;
+ }
+ | tUNUMBER tDAY {
+ ((struct date_yy *)parm)->yyDayOrdinal = $1;
+ ((struct date_yy *)parm)->yyDayNumber = $2;
+ }
+ ;
+
+date : tUNUMBER '/' tUNUMBER {
+ ((struct date_yy *)parm)->yyMonth = $1;
+ ((struct date_yy *)parm)->yyDay = $3;
+ }
+ | tMONTH tUNUMBER tUNUMBER ':' tUNUMBER ':' tUNUMBER tUNUMBER {
+ ((struct date_yy *)parm)->yyYear = $8;
+ ((struct date_yy *)parm)->yyMonth = $1;
+ ((struct date_yy *)parm)->yyDay = $2;
+
+ ((struct date_yy *)parm)->yyHour = $3;
+ ((struct date_yy *)parm)->yyMinutes = $5;
+ ((struct date_yy *)parm)->yySeconds = $7;
+
+ ((struct date_yy *)parm)->yyHaveTime = 1;
+ }
+ | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
+ /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
+ The goal in recognizing YYYY/MM/DD is solely to support legacy
+ machine-generated dates like those in an RCS log listing. If
+ you want portability, use the ISO 8601 format. */
+ if ($1 >= 1000)
+ {
+ ((struct date_yy *)parm)->yyYear = $1;
+ ((struct date_yy *)parm)->yyMonth = $3;
+ ((struct date_yy *)parm)->yyDay = $5;
+ }
+ else
+ {
+ ((struct date_yy *)parm)->yyMonth = $1;
+ ((struct date_yy *)parm)->yyDay = $3;
+ ((struct date_yy *)parm)->yyYear = $5;
+ }
+ }
+ | iso8601date
+ | iso8601datetime {
+ ((struct date_yy *)parm)->yyHaveTime++;
+ }
+ | tUNUMBER tMONTH tSNUMBER {
+ /* e.g. 17-JUN-1992. */
+ ((struct date_yy *)parm)->yyDay = $1;
+ ((struct date_yy *)parm)->yyMonth = $2;
+ ((struct date_yy *)parm)->yyYear = -$3;
+ }
+ | tMONTH tUNUMBER tUNUMBER {
+ ((struct date_yy *)parm)->yyMonth = $1;
+ ((struct date_yy *)parm)->yyDay = $2;
+ ((struct date_yy *)parm)->yyYear = $3;
+ }
+ | tMONTH tUNUMBER {
+ ((struct date_yy *)parm)->yyMonth = $1;
+ if ($2 > 1000) {
+ ((struct date_yy *)parm)->yyYear = $2;
+ } else {
+ ((struct date_yy *)parm)->yyDay = $2;
+ }
+ }
+ | tMONTH tUNUMBER ',' tUNUMBER {
+ ((struct date_yy *)parm)->yyMonth = $1;
+ ((struct date_yy *)parm)->yyDay = $2;
+ ((struct date_yy *)parm)->yyYear = $4;
+ }
+ | tUNUMBER tMONTH {
+ ((struct date_yy *)parm)->yyMonth = $2;
+ if ($1 > 1000) {
+ ((struct date_yy *)parm)->yyYear = $1;
+ } else {
+ ((struct date_yy *)parm)->yyDay = $1;
+ }
+ }
+ | tUNUMBER tMONTH tUNUMBER {
+ ((struct date_yy *)parm)->yyMonth = $2;
+ ((struct date_yy *)parm)->yyDay = $1;
+ ((struct date_yy *)parm)->yyYear = $3;
+ }
+ ;
+
+iso8601datetime: iso8601date tTZONE iso8601time
+ | tUNUMBER tTZONE iso8601time {
+ int i = $1;
+
+ if (i >= 10000) {
+ /* format: yyyymmdd */
+ ((struct date_yy *)parm)->yyYear = i / 10000;
+ i %= 10000;
+ ((struct date_yy *)parm)->yyMonth = i / 100;
+ i %= 100;
+ ((struct date_yy *)parm)->yyDay = i;
+ } else if (i >= 1000 && i <= 9999) {
+ /* format: yyyy */
+ ((struct date_yy *)parm)->yyYear = i;
+ ((struct date_yy *)parm)->yyDay= 1;
+ ((struct date_yy *)parm)->yyMonth = 1;
+ }
+ }
+ ;
+
+iso8601date: tUNUMBER tSNUMBER tSNUMBER {
+ /* ISO 8601 format. yyyy-mm-dd. */
+ ((struct date_yy *)parm)->yyYear = $1;
+ ((struct date_yy *)parm)->yyMonth = -$2;
+ ((struct date_yy *)parm)->yyDay = -$3;
+ }
+ | tUNUMBER tSNUMBER {
+ /* ISO 8601 format yyyy-mm */
+ ((struct date_yy *)parm)->yyYear = $1;
+ ((struct date_yy *)parm)->yyMonth = -$2;
+ ((struct date_yy *)parm)->yyDay = 1;
+ }
+ | tUNUMBER iso8601weekspec {
+ const int om = (1 + 9) % 12; /* offset month */
+ const int oy = $1 - 1; /* offset year */
+
+ ((struct date_yy *)parm)->yyYear = $1;
+ ((struct date_yy *)parm)->yyMonth = 1;
+ /* Zeller's formula */
+ ((struct date_yy *)parm)->yyDay -= ((13 * om + 12) / 5 +
+ oy + oy / 4 + oy / 400 - oy / 100) % 7 - 1;
+ }
+ ;
+
+iso8601weekspec: tWZONE tUNUMBER {
+ ((struct date_yy *)parm)->yyDay = ($2 / 10) * 7 + ($2 % 10) - 8;
+ }
+ | tWZONE tUNUMBER tSNUMBER {
+ ((struct date_yy *)parm)->yyDay = $2 * 7 - $3 - 8;
+ }
+ ;
+
+iso8601time:
+ iso8601time_colon
+ | tUNUMBER sec_fraction_part iso8601zonepart {
+ int i = $1;
+
+ if (i <= -100000 || i >= 100000) {
+ ((struct date_yy *)parm)->yyHour = i / 10000;
+ i %= 10000;
+ ((struct date_yy *)parm)->yyMinutes = i / 100;
+ i %= 100;
+ ((struct date_yy *)parm)->yySeconds = i;
+ } else if (i <= -1000 || i >= 1000) {
+ ((struct date_yy *)parm)->yyHour = i / 100;
+ i %= 100;
+ ((struct date_yy *)parm)->yyMinutes = i;
+ ((struct date_yy *)parm)->yySeconds = 0;
+ } else if (i >= -99 || i <= 99) {
+ ((struct date_yy *)parm)->yyHour = $1;
+ ((struct date_yy *)parm)->yyMinutes = 0;
+ ((struct date_yy *)parm)->yySeconds = 0;
+ } else {
+ ((struct date_yy *)parm)->yyHaveTime = 0;
+ }
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ }
+ ;
+
+rel : relunit tAGO {
+ ((struct date_yy *)parm)->yyRelSeconds =
+ -((struct date_yy *)parm)->yyRelSeconds;
+ ((struct date_yy *)parm)->yyRelMinutes =
+ -((struct date_yy *)parm)->yyRelMinutes;
+ ((struct date_yy *)parm)->yyRelHour =
+ -((struct date_yy *)parm)->yyRelHour;
+ ((struct date_yy *)parm)->yyRelDay =
+ -((struct date_yy *)parm)->yyRelDay;
+ ((struct date_yy *)parm)->yyRelMonth =
+ -((struct date_yy *)parm)->yyRelMonth;
+ ((struct date_yy *)parm)->yyRelYear =
+ -((struct date_yy *)parm)->yyRelYear;
+ }
+ | relunit
+ ;
+
+relunit : tUNUMBER tYEAR_UNIT {
+ ((struct date_yy *)parm)->yyRelYear += $1 * $2;
+ }
+ | tSNUMBER tYEAR_UNIT {
+ ((struct date_yy *)parm)->yyRelYear += $1 * $2;
+ }
+ | tYEAR_UNIT {
+ ((struct date_yy *)parm)->yyRelYear += $1;
+ }
+ | tUNUMBER tMONTH_UNIT {
+ ((struct date_yy *)parm)->yyRelMonth += $1 * $2;
+ }
+ | tSNUMBER tMONTH_UNIT {
+ ((struct date_yy *)parm)->yyRelMonth += $1 * $2;
+ }
+ | tMONTH_UNIT {
+ ((struct date_yy *)parm)->yyRelMonth += $1;
+ }
+ | tUNUMBER tDAY_UNIT {
+ ((struct date_yy *)parm)->yyRelDay += $1 * $2;
+ }
+ | tSNUMBER tDAY_UNIT {
+ ((struct date_yy *)parm)->yyRelDay += $1 * $2;
+ }
+ | tDAY_UNIT {
+ ((struct date_yy *)parm)->yyRelDay += $1;
+ }
+ | tUNUMBER tHOUR_UNIT {
+ ((struct date_yy *)parm)->yyRelHour += $1 * $2;
+ }
+ | tSNUMBER tHOUR_UNIT {
+ ((struct date_yy *)parm)->yyRelHour += $1 * $2;
+ }
+ | tHOUR_UNIT {
+ ((struct date_yy *)parm)->yyRelHour += $1;
+ }
+ | tUNUMBER tMINUTE_UNIT {
+ ((struct date_yy *)parm)->yyRelMinutes += $1 * $2;
+ }
+ | tSNUMBER tMINUTE_UNIT {
+ ((struct date_yy *)parm)->yyRelMinutes += $1 * $2;
+ }
+ | tMINUTE_UNIT {
+ ((struct date_yy *)parm)->yyRelMinutes += $1;
+ }
+ | tUNUMBER tSEC_UNIT {
+ ((struct date_yy *)parm)->yyRelSeconds += $1 * $2;
+ }
+ | tSNUMBER tSEC_UNIT {
+ ((struct date_yy *)parm)->yyRelSeconds += $1 * $2;
+ }
+ | tSEC_UNIT {
+ ((struct date_yy *)parm)->yyRelSeconds += $1;
+ }
+ ;
+
+number : tUNUMBER
+ {
+ if (((struct date_yy *)parm)->yyHaveTime &&
+ ((struct date_yy *)parm)->yyHaveDate &&
+ !((struct date_yy *)parm)->yyHaveRel)
+ ((struct date_yy *)parm)->yyYear = $1;
+ else
+ {
+ if ($1>10000)
+ {
+ ((struct date_yy *)parm)->yyHaveDate++;
+ ((struct date_yy *)parm)->yyDay= ($1)%100;
+ ((struct date_yy *)parm)->yyMonth= ($1/100)%100;
+ ((struct date_yy *)parm)->yyYear = $1/10000;
+ }
+ else
+ {
+ ((struct date_yy *)parm)->yyHaveTime++;
+ if ($1 < 100)
+ {
+ ((struct date_yy *)parm)->yyHour = $1;
+ ((struct date_yy *)parm)->yyMinutes = 0;
+ }
+ else
+ {
+ ((struct date_yy *)parm)->yyHour = $1 / 100;
+ ((struct date_yy *)parm)->yyMinutes = $1 % 100;
+ }
+ ((struct date_yy *)parm)->yySeconds = 0;
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ }
+ }
+ }
+ ;
+
+o_merid : tMERIDIAN
+ {
+ ((struct date_yy *)parm)->yyMeridian = $1;
+ }
+ ;
+
+%%
+
+time_t get_date (char *p, time_t *now);
+
+#ifndef PHP_WIN32
+extern struct tm *gmtime();
+extern struct tm *localtime();
+extern time_t mktime();
+#endif
+
+/* Month and day table. */
+static TABLE const MonthDayTable[] = {
+ { "january", tMONTH, 1 },
+ { "february", tMONTH, 2 },
+ { "march", tMONTH, 3 },
+ { "april", tMONTH, 4 },
+ { "may", tMONTH, 5 },
+ { "june", tMONTH, 6 },
+ { "july", tMONTH, 7 },
+ { "august", tMONTH, 8 },
+ { "september", tMONTH, 9 },
+ { "sept", tMONTH, 9 },
+ { "october", tMONTH, 10 },
+ { "november", tMONTH, 11 },
+ { "december", tMONTH, 12 },
+ { "sunday", tDAY, 0 },
+ { "monday", tDAY, 1 },
+ { "tuesday", tDAY, 2 },
+ { "tues", tDAY, 2 },
+ { "wednesday", tDAY, 3 },
+ { "wednes", tDAY, 3 },
+ { "thursday", tDAY, 4 },
+ { "thur", tDAY, 4 },
+ { "thurs", tDAY, 4 },
+ { "friday", tDAY, 5 },
+ { "saturday", tDAY, 6 },
+ { NULL, 0, 0 }
+};
+
+/* Time units table. */
+static TABLE const UnitsTable[] = {
+ { "year", tYEAR_UNIT, 1 },
+ { "month", tMONTH_UNIT, 1 },
+ { "fortnight", tDAY_UNIT, 14 },
+ { "week", tDAY_UNIT, 7 },
+ { "day", tDAY_UNIT, 1 },
+ { "hour", tHOUR_UNIT, 1 },
+ { "minute", tMINUTE_UNIT, 1 },
+ { "min", tMINUTE_UNIT, 1 },
+ { "second", tSEC_UNIT, 1 },
+ { "sec", tSEC_UNIT, 1 },
+ { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words. */
+static TABLE const OtherTable[] = {
+ { "tomorrow", tDAY_UNIT, 1 },
+ { "yesterday", tDAY_UNIT, -1 },
+ { "today", tDAY_UNIT, 0 },
+ { "now", tDAY_UNIT, 0 },
+ { "last", tUNUMBER, -1 },
+ { "this", tUNUMBER, 0 },
+ { "next", tUNUMBER, 2 },
+ { "first", tUNUMBER, 1 },
+/* { "second", tUNUMBER, 2 }, */
+ { "third", tUNUMBER, 3 },
+ { "fourth", tUNUMBER, 4 },
+ { "fifth", tUNUMBER, 5 },
+ { "sixth", tUNUMBER, 6 },
+ { "seventh", tUNUMBER, 7 },
+ { "eighth", tUNUMBER, 8 },
+ { "ninth", tUNUMBER, 9 },
+ { "tenth", tUNUMBER, 10 },
+ { "eleventh", tUNUMBER, 11 },
+ { "twelfth", tUNUMBER, 12 },
+ { "ago", tAGO, 1 },
+ { NULL, 0, 0 }
+};
+
+/* The timezone table. */
+static TABLE const TimezoneTable[] = {
+ { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
+ { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
+ { "utc", tZONE, HOUR ( 0) },
+ { "wet", tZONE, HOUR ( 0) }, /* Western European */
+ { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
+ { "wat", tZONE, HOUR ( 1) }, /* West Africa */
+ { "at", tZONE, HOUR ( 2) }, /* Azores */
+#if 0
+ /* For completeness. BST is also British Summer, and GST is
+ * also Guam Standard. */
+ { "bst", tZONE, HOUR ( 3) }, /* Brazil Standard */
+ { "gst", tZONE, HOUR ( 3) }, /* Greenland Standard */
+#endif
+#if 0
+ { "nft", tZONE, HOUR (3.5) }, /* Newfoundland */
+ { "nst", tZONE, HOUR (3.5) }, /* Newfoundland Standard */
+ { "ndt", tDAYZONE, HOUR (3.5) }, /* Newfoundland Daylight */
+#endif
+ { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
+ { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
+ { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
+ { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
+ { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
+ { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
+ { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
+ { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
+ { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
+ { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
+ { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
+ { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
+ { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
+ { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
+ { "cat", tZONE, HOUR (10) }, /* Central Alaska */
+ { "akst", tZONE, HOUR (10) }, /* Alaska Standard */
+ { "akdt", tZONE, HOUR (10) }, /* Alaska Daylight */
+ { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
+ { "nt", tZONE, HOUR (11) }, /* Nome */
+ { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
+ { "cet", tZONE, -HOUR (1) }, /* Central European */
+ { "cest", tDAYZONE, -HOUR (1) }, /* Central European Summer */
+ { "met", tZONE, -HOUR (1) }, /* Middle European */
+ { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
+ { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
+ { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
+ { "fwt", tZONE, -HOUR (1) }, /* French Winter */
+ { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
+ { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
+ { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
+#if 0
+ { "it", tZONE, -HOUR (3.5) },/* Iran */
+#endif
+ { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
+ { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
+#if 0
+ { "ist", tZONE, -HOUR (5.5) },/* Indian Standard */
+#endif
+ { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
+#if 0
+ /* For completeness. NST is also Newfoundland Standard, and SST is
+ * also Swedish Summer. */
+ { "nst", tZONE, -HOUR (6.5) },/* North Sumatra */
+ { "sst", tZONE, -HOUR (7) }, /* South Sumatra, USSR Zone 6 */
+#endif /* 0 */
+ { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
+ { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
+#if 0
+ { "jt", tZONE, -HOUR (7.5) },/* Java (3pm in Cronusland!) */
+#endif
+ { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
+ { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
+#if 0
+ { "cast", tZONE, -HOUR (9.5) },/* Central Australian Standard */
+ { "cadt", tDAYZONE, -HOUR (9.5) },/* Central Australian Daylight */
+#endif
+ { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
+ { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
+ { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
+ { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
+ { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
+ { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
+ { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
+ { NULL, 0, 0 }
+};
+
+/* Military timezone table. */
+static TABLE const MilitaryTable[] = {
+ { "a", tZONE, HOUR (- 1) },
+ { "b", tZONE, HOUR (- 2) },
+ { "c", tZONE, HOUR (- 3) },
+ { "d", tZONE, HOUR (- 4) },
+ { "e", tZONE, HOUR (- 5) },
+ { "f", tZONE, HOUR (- 6) },
+ { "g", tZONE, HOUR (- 7) },
+ { "h", tZONE, HOUR (- 8) },
+ { "i", tZONE, HOUR (- 9) },
+ { "k", tZONE, HOUR (-10) },
+ { "l", tZONE, HOUR (-11) },
+ { "m", tZONE, HOUR (-12) },
+ { "n", tZONE, HOUR ( 1) },
+ { "o", tZONE, HOUR ( 2) },
+ { "p", tZONE, HOUR ( 3) },
+ { "q", tZONE, HOUR ( 4) },
+ { "r", tZONE, HOUR ( 5) },
+ { "s", tZONE, HOUR ( 6) },
+ { "t", tTZONE, HOUR ( 7) },
+ { "u", tZONE, HOUR ( 8) },
+ { "v", tZONE, HOUR ( 9) },
+ { "w", tWZONE, HOUR ( 10) },
+ { "x", tZONE, HOUR ( 11) },
+ { "y", tZONE, HOUR ( 12) },
+ { "z", tZZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
+
+
+
+/* ARGSUSED */
+static int
+yyerror (s)
+ char *s ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
+static int
+ToHour (Hours, Meridian)
+ int Hours;
+ MERIDIAN Meridian;
+{
+ switch (Meridian)
+ {
+ case MER24:
+ if (Hours < 0 || Hours > 23)
+ return -1;
+ return Hours;
+ case MERam:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours;
+ case MERpm:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours + 12;
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
+static int
+ToYear (Year)
+ int Year;
+{
+ if (Year < 0)
+ Year = -Year;
+
+ /* XPG4 suggests that years 00-68 map to 2000-2068, and
+ years 69-99 map to 1969-1999. */
+ if (Year < 69)
+ Year += 2000;
+ else if (Year < 100)
+ Year += 1900;
+
+ return Year;
+}
+
+static int
+LookupWord (lvalp,buff)
+ YYSTYPE *lvalp;
+ char *buff;
+{
+ register char *p;
+ register char *q;
+ register const TABLE *tp;
+ int i;
+ int abbrev;
+
+ /* Make it lowercase. */
+ for (p = buff; *p; p++)
+ if (ISUPPER ((unsigned char) *p))
+ *p = tolower (*p);
+
+ if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
+ {
+ lvalp->Meridian = MERam;
+ return tMERIDIAN;
+ }
+ if (strcmp (buff, "pm") == 0 || strcmp (buff, "p.m.") == 0)
+ {
+ lvalp->Meridian = MERpm;
+ return tMERIDIAN;
+ }
+
+ /* See if we have an abbreviation for a month. */
+ if (strlen (buff) == 3)
+ abbrev = 1;
+ else if (strlen (buff) == 4 && buff[3] == '.')
+ {
+ abbrev = 1;
+ buff[3] = '\0';
+ }
+ else
+ abbrev = 0;
+
+ for (tp = MonthDayTable; tp->name; tp++)
+ {
+ if (abbrev)
+ {
+ if (strncmp (buff, tp->name, 3) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+ }
+ else if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+
+ if (strcmp (buff, "dst") == 0)
+ return tDST;
+
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+
+ /* Strip off any plural and try the units table again. */
+ i = strlen (buff) - 1;
+ if (buff[i] == 's')
+ {
+ buff[i] = '\0';
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+ buff[i] = 's'; /* Put back for "this" in OtherTable. */
+ }
+
+ for (tp = OtherTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+
+ /* Military timezones. */
+ if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
+ {
+ for (tp = MilitaryTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ /* Drop out any periods and try the timezone table again. */
+ for (i = 0, p = q = buff; *q; q++)
+ if (*q != '.')
+ *p++ = *q;
+ else
+ i++;
+ *p = '\0';
+ if (i)
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ lvalp->Number = tp->value;
+ return tp->type;
+ }
+
+ return tID;
+}
+
+int yylex (YYSTYPE *lvalp, void *parm)
+{
+ register unsigned char c;
+ register char *p;
+ char buff[20];
+ int Count;
+ int sign;
+ struct date_yy * date = (struct date_yy *)parm;
+
+ for (;;)
+ {
+ while (ISSPACE ((unsigned char) *date->yyInput))
+ date->yyInput++;
+
+ if (ISDIGIT (c = *date->yyInput) || c == '-' || c == '+')
+ {
+ if (c == '-' || c == '+')
+ {
+ sign = c == '-' ? -1 : 1;
+ if (!ISDIGIT (*++date->yyInput))
+ /* skip the '-' sign */
+ continue;
+ }
+ else
+ sign = 0;
+ for (lvalp->Number = 0; ISDIGIT (c = *date->yyInput++);)
+ lvalp->Number = 10 * lvalp->Number + c - '0';
+ date->yyInput--;
+ if (sign < 0)
+ lvalp->Number = -lvalp->Number;
+ /* Ignore ordinal suffixes on numbers */
+ c = *date->yyInput;
+ if (c == 's' || c == 'n' || c == 'r' || c == 't') {
+ c = *++date->yyInput;
+ if (c == 't' || c == 'd' || c == 'h') {
+ date->yyInput++;
+ } else {
+ date->yyInput--;
+ }
+ }
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+ if (ISALPHA (c))
+ {
+ for (p = buff; (c = *date->yyInput++, ISALPHA (c)) || c == '.';)
+ if (p < &buff[sizeof buff - 1])
+ *p++ = c;
+ *p = '\0';
+ date->yyInput--;
+ return LookupWord (lvalp, buff);
+ }
+ if (c != '(')
+ return *date->yyInput++;
+ Count = 0;
+ do
+ {
+ c = *date->yyInput++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ Count++;
+ else if (c == ')')
+ Count--;
+ }
+ while (Count > 0);
+ }
+}
+
+#define TM_YEAR_ORIGIN 1900
+
+/* Yield A - B, measured in seconds. */
+static long
+difftm (struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ long days = (
+ /* difference in day of year */
+ a->tm_yday - b->tm_yday
+ /* + intervening leap days */
+ + ((ay >> 2) - (by >> 2))
+ - (ay / 100 - by / 100)
+ + ((ay / 100 >> 2) - (by / 100 >> 2))
+ /* + difference in years * 365 */
+ + (long) (ay - by) * 365
+ );
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+
+PHPAPI time_t php_parse_date(char *p, time_t *now)
+{
+ struct tm tm, tm0, *tmp;
+ time_t Start;
+ struct date_yy date;
+
+ date.yyInput = p;
+ Start = now ? *now : time ((time_t *) NULL);
+ tmp = localtime (&Start);
+ if (!tmp)
+ return -1;
+ date.yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
+ date.yyMonth = tmp->tm_mon + 1;
+ date.yyDay = tmp->tm_mday;
+ date.yyHour = tmp->tm_hour;
+ date.yyMinutes = tmp->tm_min;
+ date.yySeconds = tmp->tm_sec;
+ tm.tm_isdst = tmp->tm_isdst;
+ date.yyMeridian = MER24;
+ date.yyRelSeconds = 0;
+ date.yyRelMinutes = 0;
+ date.yyRelHour = 0;
+ date.yyRelDay = 0;
+ date.yyRelMonth = 0;
+ date.yyRelYear = 0;
+ date.yyHaveDate = 0;
+ date.yyHaveDay = 0;
+ date.yyHaveRel = 0;
+ date.yyHaveTime = 0;
+ date.yyHaveZone = 0;
+
+ if (yyparse ((void *)&date)
+ || date.yyHaveTime > 1 || date.yyHaveZone > 1
+ || date.yyHaveDate > 1 || date.yyHaveDay > 1) {
+ return -1;
+ }
+ tm.tm_year = ToYear (date.yyYear) - TM_YEAR_ORIGIN + date.yyRelYear;
+ tm.tm_mon = date.yyMonth - 1 + date.yyRelMonth;
+ tm.tm_mday = date.yyDay + date.yyRelDay;
+ if (date.yyHaveTime || (date.yyHaveRel && !date.yyHaveDate && !date.yyHaveDay))
+ {
+ tm.tm_hour = ToHour (date.yyHour, date.yyMeridian);
+ if (tm.tm_hour < 0)
+ return -1;
+ tm.tm_min = date.yyMinutes;
+ tm.tm_sec = date.yySeconds;
+ }
+ else
+ {
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+ }
+ tm.tm_hour += date.yyRelHour;
+ tm.tm_min += date.yyRelMinutes;
+ tm.tm_sec += date.yyRelSeconds;
+
+ /* Let mktime deduce tm_isdst if we have an absolute timestamp,
+ or if the relative timestamp mentions days, months, or years. */
+ if (date.yyHaveDate | date.yyHaveDay | date.yyHaveTime | date.yyRelDay | date.yyRelMonth | date.yyRelYear)
+ tm.tm_isdst = -1;
+
+ tm0 = tm;
+
+ Start = mktime (&tm);
+
+ if (Start == (time_t) -1)
+ {
+
+ /* Guard against falsely reporting errors near the time_t boundaries
+ when parsing times in other time zones. For example, if the min
+ time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
+ of UTC, then the min localtime value is 1970-01-01 08:00:00; if
+ we apply mktime to 1970-01-01 00:00:00 we will get an error, so
+ we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
+ zone by 24 hours to compensate. This algorithm assumes that
+ there is no DST transition within a day of the time_t boundaries. */
+ if (date.yyHaveZone)
+ {
+ tm = tm0;
+ if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
+ {
+ tm.tm_mday++;
+ date.yyTimezone -= 24 * 60;
+ }
+ else
+ {
+ tm.tm_mday--;
+ date.yyTimezone += 24 * 60;
+ }
+ Start = mktime (&tm);
+ }
+
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (date.yyHaveDay && !date.yyHaveDate)
+ {
+ tm.tm_mday += ((date.yyDayNumber - tm.tm_wday + 7) % 7
+ + 7 * (date.yyDayOrdinal - (0 < date.yyDayOrdinal)));
+ Start = mktime (&tm);
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (date.yyHaveZone)
+ {
+ long delta;
+ struct tm *gmt = gmtime (&Start);
+ if (!gmt)
+ return -1;
+ delta = date.yyTimezone * 60L + difftm (&tm, gmt);
+
+ if ((Start + delta < Start) != (delta < 0))
+ return -1; /* time_t overflow */
+ Start += delta;
+ }
+
+ return Start;
+}
diff --git a/ext/standard/php_parsedate.h b/ext/standard/php_parsedate.h
new file mode 100644
index 0000000000..6ba4017009
--- /dev/null
+++ b/ext/standard/php_parsedate.h
@@ -0,0 +1,28 @@
+/*
+ +----------------------------------------------------------------------+
+ | 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: Sascha Schumann <sascha@schumann.cx> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#ifndef PHP_PARSEDATE_H
+#define PHP_PARSEDATE_H
+
+#include <time.h>
+
+PHPAPI time_t php_parse_date(char *p, time_t *now);
+
+#endif
diff --git a/ext/standard/tests/array/bug29992.phpt b/ext/standard/tests/array/bug29992.phpt
new file mode 100755
index 0000000000..74be291891
--- /dev/null
+++ b/ext/standard/tests/array/bug29992.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #29992 (foreach by reference corrupts the array)
+--FILE--
+<?php
+
+$array = array(1,2,3);
+
+print_r($array);
+
+foreach($array as $item) var_dump($item);
+foreach($array as &$item) var_dump($item);
+foreach($array as &$item) var_dump($item);
+foreach($array as $item) var_dump($item);
+
+print_r($array);
+
+?>
+===DONE===
+--EXPECT--
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+int(1)
+int(2)
+int(3)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+===DONE===
diff --git a/ext/standard/tests/time/002-win32.phpt b/ext/standard/tests/time/002-win32.phpt
new file mode 100644
index 0000000000..1d7ef57153
--- /dev/null
+++ b/ext/standard/tests/time/002-win32.phpt
@@ -0,0 +1,66 @@
+--TEST--
+strtotime() function
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ print 'skip test for win32 only';
+}
+if (!@putenv("TZ=GST-1GDT") || getenv("TZ") != 'GST-1GDT') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+?>
+--FILE--
+<?php
+ $dates = array (
+ "1999-10-13",
+ "Oct 13 1999",
+ "2000-01-19",
+ "Jan 19 2000",
+ "2001-12-21",
+ "Dec 21 2001",
+ "2001-12-21 12:16",
+ "Dec 21 2001 12:16",
+ "2001-10-22 21:19:58",
+ "2001-10-22 21:19:58-02",
+ "2001-10-22 21:19:58-0213",
+ "2001-10-22 21:19:58+02",
+ "2001-10-22 21:19:58+0213"
+ );
+
+ putenv ("TZ=GMT");
+ foreach ($dates as $date) {
+ echo date("Y-m-d H:i:s\n", strtotime ($date));
+ }
+
+ putenv ("TZ=GST-1GDT");
+ foreach ($dates as $date) {
+ echo date("Y-m-d H:i:s\n", strtotime ($date));
+ }
+?>
+--EXPECT--
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+2001-10-22 21:19:58
+2001-10-22 23:19:58
+2001-10-22 23:32:58
+2001-10-22 19:19:58
+2001-10-22 19:06:58
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+2001-10-22 21:19:58
+2001-10-23 01:19:58
+2001-10-23 01:32:58
+2001-10-22 21:19:58
+2001-10-22 21:06:58
diff --git a/ext/standard/tests/time/002.phpt b/ext/standard/tests/time/002.phpt
new file mode 100644
index 0000000000..78cfad9fbc
--- /dev/null
+++ b/ext/standard/tests/time/002.phpt
@@ -0,0 +1,96 @@
+--TEST--
+strtotime() function
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ die('skip Windows does not support dates prior to midnight (00:00:00), January 1, 1970');
+}
+if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+?>
+--FILE--
+<?php
+ $dates = array (
+ "1999-10-13",
+ "Oct 13 1999",
+ "2000-01-19",
+ "Jan 19 2000",
+ "2001-12-21",
+ "Dec 21 2001",
+ "2001-12-21 12:16",
+ "Dec 21 2001 12:16",
+ "Dec 21 12:16",
+ "2001-10-22 21:19:58",
+ "2001-10-22 21:19:58-02",
+ "2001-10-22 21:19:58-0213",
+ "2001-10-22 21:19:58+02",
+ "2001-10-22 21:19:58+0213",
+ "2001-10-22T21:20:58-03:40",
+ "2001-10-22T211958-2",
+ "20011022T211958+0213",
+ "20011022T21:20+0215",
+ "1997W011",
+ "2004W101T05:00+0",
+ );
+
+ echo "*** GMT0\n";
+ putenv ("TZ=GMT0");
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
+
+ echo "*** US/Eastern\n";
+ putenv("TZ=US/Eastern");
+ if( date("T") == "GMT" ) {
+ // POSIX style
+ putenv ("TZ=EST5EDT4,M4.1.0,M10.5.0");
+ }
+
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
+?>
+--EXPECT--
+*** GMT0
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+1969-12-31 23:59:59
+2001-10-22 21:19:58
+2001-10-22 23:19:58
+2001-10-22 23:32:58
+2001-10-22 19:19:58
+2001-10-22 19:06:58
+2001-10-23 01:00:58
+2001-10-22 23:19:58
+2001-10-22 19:06:58
+2001-10-22 19:05:00
+1996-12-30 00:00:00
+2004-03-01 05:00:00
+*** US/Eastern
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+1969-12-31 18:59:59
+2001-10-22 21:19:58
+2001-10-22 19:19:58
+2001-10-22 19:32:58
+2001-10-22 15:19:58
+2001-10-22 15:06:58
+2001-10-22 21:00:58
+2001-10-22 19:19:58
+2001-10-22 15:06:58
+2001-10-22 15:05:00
+1996-12-30 00:00:00
+2004-03-01 00:00:00
diff --git a/ext/standard/tests/time/bug13142.phpt b/ext/standard/tests/time/bug13142.phpt
new file mode 100644
index 0000000000..25bf11589f
--- /dev/null
+++ b/ext/standard/tests/time/bug13142.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #13142 strtotime handling of "M d H:i:s Y" format
+--SKIPIF--
+<?php
+if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+?>
+--FILE--
+<?php
+putenv("TZ=US/Eastern");
+if (date('T') == 'GMT') {
+ putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
+}
+echo date("r\n", strtotime("Sep 04 16:39:45 2001"));
+echo date("r\n", strtotime("Sep 04 2001 16:39:45"));
+?>
+--EXPECT--
+Tue, 04 Sep 2001 16:39:45 -0400
+Tue, 04 Sep 2001 16:39:45 -0400
diff --git a/ext/standard/tests/time/bug17988.phpt b/ext/standard/tests/time/bug17988.phpt
new file mode 100644
index 0000000000..5fbc3c845f
--- /dev/null
+++ b/ext/standard/tests/time/bug17988.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #17988 strtotime handling of postgresql timestamps
+--FILE--
+<?php
+putenv("TZ=GMT");
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-04"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+04"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0300"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0300"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0330"))."\n";
+echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
+?>
+--EXPECT--
+2002-06-25 14:18:48
+2002-06-25 14:18:48
+2002-06-25 13:18:48
+2002-06-25 12:18:48
+2002-06-25 18:18:48
+2002-06-25 14:18:48
+2002-06-25 14:18:48
+2002-06-25 18:18:48
+2002-06-25 10:18:48
+2002-06-25 17:18:48
+2002-06-25 11:18:48
+2002-06-25 17:48:48
+2002-06-25 10:48:48
diff --git a/ext/standard/tests/time/bug20382.phpt b/ext/standard/tests/time/bug20382.phpt
new file mode 100644
index 0000000000..4da8c21105
--- /dev/null
+++ b/ext/standard/tests/time/bug20382.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #20382 (strtotime ("Monday", $date) produces wrong result on DST changeover)
+--FILE--
+<?php
+ putenv("TZ=Europe/Amsterdam");
+ $tStamp = mktime (17, 17, 17, 10, 27, 2004);
+ echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
+
+ $strtotime_timestamp = strtotime ("Monday", $tStamp);
+ echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n";
+ echo "wanted=Monday 2004-11-01 00:00:00 CET\n";
+?>
+--EXPECT--
+tStamp=Wednesday 2004-10-27 17:17:17 CEST
+result=Monday 2004-11-01 00:00:00 CET
+wanted=Monday 2004-11-01 00:00:00 CET
diff --git a/ext/standard/tests/time/bug26198.phpt b/ext/standard/tests/time/bug26198.phpt
new file mode 100644
index 0000000000..318108da78
--- /dev/null
+++ b/ext/standard/tests/time/bug26198.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #26198 (strtotime handling of "M Y" and "Y M" format)
+--FILE--
+<?php
+ echo date("F Y\n", strtotime("Oct 2001"));
+ echo date("M Y\n", strtotime("2001 Oct"));
+?>
+--EXPECT--
+October 2001
+Oct 2001
diff --git a/ext/standard/tests/time/bug26317.phpt b/ext/standard/tests/time/bug26317.phpt
new file mode 100644
index 0000000000..c889666dc9
--- /dev/null
+++ b/ext/standard/tests/time/bug26317.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #26317 (military timezone offset signedness)
+--SKIP--
+if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+--FILE--
+<?php
+ putenv("TZ=GMT0");
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
+?>
+--EXPECT--
+2003-11-19 16:20:42
+2003-11-19 16:20:42
+2003-11-19 16:20:42
diff --git a/ext/standard/tests/time/bug26320.phpt b/ext/standard/tests/time/bug26320.phpt
new file mode 100644
index 0000000000..b57712009f
--- /dev/null
+++ b/ext/standard/tests/time/bug26320.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
+--SKIP--
+if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
+ die("skip unable to change TZ enviroment variable\n");
+}
+--FILE--
+<?php
+ putenv("TZ=GMT0");
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
+?>
+--EXPECT--
+2003-11-19 12:30:42
+2003-11-19 12:30:42 \ No newline at end of file
diff --git a/ext/standard/tests/time/bug27780.phpt b/ext/standard/tests/time/bug27780.phpt
new file mode 100644
index 0000000000..1c10340d47
--- /dev/null
+++ b/ext/standard/tests/time/bug27780.phpt
@@ -0,0 +1,113 @@
+--TEST--
+Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
+--FILE--
+<?php
+$timezones = array (
+ "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
+ "Asia/Singapore", "America/Sao_Paulo"
+);
+
+$timestrings = array (
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds",
+ "2004-04-07 00:00:00 -21 days",
+ "2004-04-07 00:00:00 11 days ago",
+ "2004-04-07 00:00:00 -10 day +2 hours",
+ "2004-04-07 00:00:00 -1 day",
+ "2004-04-07 00:00:00",
+ "2004-04-07 00:00:00 +1 hour",
+ "2004-04-07 00:00:00 +2 hour",
+ "2004-04-07 00:00:00 +1 day",
+ "2004-04-07 00:00:00 1 day",
+ "2004-04-07 00:00:00 +21 days",
+);
+
+foreach ($timezones as $timezone) {
+ putenv("TZ=$timezone");
+ echo $timezone, "\n";
+
+ foreach ($timestrings as $timestring) {
+ $time = strtotime($timestring);
+
+ echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n";
+ }
+
+ echo "\n";
+}
+?>
+--EXPECT--
+America/Chicago
+1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076824801 [2004-02-15 00:00:01 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079503200 [2004-03-17 00:00:00 CST] [2004-04-07 00:00:00 -21 days]
+1080367200 [2004-03-27 00:00:00 CST] [2004-04-07 00:00:00 11 days ago]
+1080460800 [2004-03-28 02:00:00 CST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081227600 [2004-04-06 00:00:00 CDT] [2004-04-07 00:00:00 -1 day]
+1081314000 [2004-04-07 00:00:00 CDT] [2004-04-07 00:00:00]
+1081317600 [2004-04-07 01:00:00 CDT] [2004-04-07 00:00:00 +1 hour]
+1081321200 [2004-04-07 02:00:00 CDT] [2004-04-07 00:00:00 +2 hour]
+1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 +1 day]
+1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 1 day]
+1083128400 [2004-04-28 00:00:00 CDT] [2004-04-07 00:00:00 +21 days]
+
+Europe/Amsterdam
+1076799599 [2004-02-14 23:59:59 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076799600 [2004-02-15 00:00:00 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076799601 [2004-02-15 00:00:01 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079478000 [2004-03-17 00:00:00 CET] [2004-04-07 00:00:00 -21 days]
+1080342000 [2004-03-27 00:00:00 CET] [2004-04-07 00:00:00 11 days ago]
+1080435600 [2004-03-28 03:00:00 CEST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081202400 [2004-04-06 00:00:00 CEST] [2004-04-07 00:00:00 -1 day]
+1081288800 [2004-04-07 00:00:00 CEST] [2004-04-07 00:00:00]
+1081292400 [2004-04-07 01:00:00 CEST] [2004-04-07 00:00:00 +1 hour]
+1081296000 [2004-04-07 02:00:00 CEST] [2004-04-07 00:00:00 +2 hour]
+1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 +1 day]
+1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 1 day]
+1083103200 [2004-04-28 00:00:00 CEST] [2004-04-07 00:00:00 +21 days]
+
+Asia/Jerusalem
+1076795999 [2004-02-14 23:59:59 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076796000 [2004-02-15 00:00:00 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076796001 [2004-02-15 00:00:01 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079474400 [2004-03-17 00:00:00 IST] [2004-04-07 00:00:00 -21 days]
+1080338400 [2004-03-27 00:00:00 IST] [2004-04-07 00:00:00 11 days ago]
+1080432000 [2004-03-28 02:00:00 IST] [2004-04-07 00:00:00 -10 day +2 hours]
+1081202400 [2004-04-06 00:00:00 IST] [2004-04-07 00:00:00 -1 day]
+1081288800 [2004-04-07 00:00:00 IST] [2004-04-07 00:00:00]
+1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +1 hour]
+1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +2 hour]
+1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 +1 day]
+1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 1 day]
+1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days]
+
+Asia/Singapore
+1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days]
+1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago]
+1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours]
+1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day]
+1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00]
+1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour]
+1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour]
+1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day]
+1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day]
+1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days]
+
+America/Sao_Paulo
+1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds]
+1076810400 [2004-02-14 23:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds]
+1076810401 [2004-02-14 23:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds]
+1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days]
+1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago]
+1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours]
+1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day]
+1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00]
+1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour]
+1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour]
+1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day]
+1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day]
+1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days]
diff --git a/ext/standard/tests/time/bug28599.phpt b/ext/standard/tests/time/bug28599.phpt
new file mode 100644
index 0000000000..79ac9c84b1
--- /dev/null
+++ b/ext/standard/tests/time/bug28599.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #28599 (strtotime fails with zero base time)
+--FILE--
+<?php
+print gmdate("d-m-Y H:i:s", strtotime("+30 minutes", 1100535573));
+?>
+--EXPECT--
+15-11-2004 16:49:33
diff --git a/ext/xmlwriter/CREDITS b/ext/xmlwriter/CREDITS
deleted file mode 100644
index d3a9ebe1bb..0000000000
--- a/ext/xmlwriter/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-XMLWriter
-Rob Richards
-Pierre-Alain Joye
diff --git a/ext/xmlwriter/TODO b/ext/xmlwriter/TODO
deleted file mode 100644
index dd3235fc68..0000000000
--- a/ext/xmlwriter/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-- Fix up config file for PHP 5 to use libxml extension configuration
-- Add OOP support
-
-
diff --git a/ext/xmlwriter/config.m4 b/ext/xmlwriter/config.m4
deleted file mode 100644
index a1952b3879..0000000000
--- a/ext/xmlwriter/config.m4
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN([PHP_XMLWRITER_CHECK_VERSION],[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$XMLWRITER_DIR/include$XMLWRITER_DIR_ADD
- AC_MSG_CHECKING(for libxml version)
- AC_EGREP_CPP(yes,[
-#include <libxml/xmlversion.h>
-#if LIBXML_VERSION >= 20600
- yes
-#endif
- ],[
- AC_MSG_RESULT(>= 2.6.0)
- ],[
- AC_MSG_ERROR(libxml version 2.6.0 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-PHP_ARG_WITH(xmlwriter, for XMLWriter support,
-[ --with-xmlwriter Include XMLWriter support.])
-
-if test "$PHP_XMLWRITER" != "no"; then
-
- XMLWRITER_DIR_ADD=""
- if test -r $PHP_XMLWRITER/include/libxml2/libxml/xmlwriter.h; then
- XMLWRITER_DIR=$PHP_XMLWRITER
- XMLWRITER_DIR_ADD="/libxml2"
- elif test -r $PHP_XMLWRITER/include/libxml/xmlwriter.h; then
- XMLWRITER_DIR=$PHP_XMLWRITER
- else
- for i in /usr/local /usr; do
- test -r $i/include/libxml/xmlwriter.h && XMLWRITER_DIR=$i
- test -r $i/include/libxml2/libxml/xmlwriter.h && XMLWRITER_DIR=$i && XMLWRITER_DIR_ADD="/libxml2"
- done
- fi
-
- if test -z "$XMLWRITER_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libxml >= 2.6.0 distribution)
- fi
-
- PHP_XMLWRITER_CHECK_VERSION
-
- XML2_CONFIG=$XMLWRITER_DIR/bin/xml2-config
-
- if test -x $XML2_CONFIG; then
- XMLWRITER_LIBS=`$XML2_CONFIG --libs`
- PHP_EVAL_LIBLINE($XMLWRITER_LIBS, XMLWRITER_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH($XMLWRITER_LIBNAME, $XMLWRITER_DIR/lib, XMLWRITER_SHARED_LIBADD)
- fi
-
- PHP_ADD_INCLUDE($XMLWRITER_DIR/include$XMLWRITER_DIR_ADD)
-
- AC_DEFINE(HAVE_XMLWRITER,1,[ ])
- PHP_NEW_EXTENSION(xmlwriter, php_xmlwriter.c, $ext_shared)
- PHP_SUBST(XMLWRITER_SHARED_LIBADD)
-fi
diff --git a/ext/xmlwriter/config.w32 b/ext/xmlwriter/config.w32
deleted file mode 100644
index c18b2c13fd..0000000000
--- a/ext/xmlwriter/config.w32
+++ /dev/null
@@ -1,18 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_WITH("xmlwriter", "XMLWriter support", "no");
-
-if (PHP_XMLWRITER == "yes" && PHP_LIBXML == "yes") {
- if (CHECK_HEADER_ADD_INCLUDE('libxml/xmlwriter.h', 'CFLAGS_XMLWRITER', PHP_XMLWRITER)) {
- EXTENSION("xmlwriter", "php_xmlwriter.c");
- AC_DEFINE("HAVE_XMLWRITER", 1, "XMLWriter support");
- if (!PHP_XMLWRITER_SHARED) {
- ADD_FLAG("CFLAGS_XMLWRITER", "/D LIBXML_STATIC");
- }
- ADD_EXTENSION_DEP('xmlwriter', 'libxml');
- } else {
- WARNING('Could not find xmlwriter.h');
- }
-}
-
diff --git a/ext/xmlwriter/examples/xmlwriter_file.php b/ext/xmlwriter/examples/xmlwriter_file.php
deleted file mode 100644
index e200a11dc0..0000000000
--- a/ext/xmlwriter/examples/xmlwriter_file.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-dl('xmlwriter.so');
-
-$xw = xmlwriter_open_uri('./a.xml');
-xmlwriter_set_indent($xw, 1);
-$res = xmlwriter_set_indent_string($xw, ' ');
-
-xmlwriter_start_document($xw, '1.0', 'utf8');
-
-// A first element
-xmlwriter_start_element($xw, 'tag1');
-
-// Attribute 'att1' for element 'tag1'
-xmlwriter_start_attribute($xw, 'att1');
-xmlwriter_text($xw, 'valueofatt1');
-xmlwriter_end_attribute($xw);
-
-xmlwriter_write_comment($xw, 'this is a comment.');
-
-// Start a child element
-xmlwriter_start_element($xw, 'tag11');
-xmlwriter_text($xw, utf8_encode('This is a sample text, ä'));
-xmlwriter_end_element($xw); // tag11
-
-xmlwriter_end_element($xw); // tag1
-
-
-// CDATA
-xmlwriter_start_element($xw, 'testc');
-xmlwriter_write_cdata($xw, "This is a cdata content");
-xmlwriter_end_element($xw); // testctag
-
-xmlwriter_start_element($xw, 'testc');
-xmlwriter_start_cdata($xw);
-xmlwriter_text($xw, "test cdata2");
-xmlwriter_end_cdata($xw);
-xmlwriter_end_element($xw); // testctag
-
-// A processing instruction
-xmlwriter_start_pi($xw, 'php');
-xmlwriter_text($xw, '$foo=2;echo $foo;');
-xmlwriter_end_pi($xw);
-
-xmlwriter_end_document($xw);
diff --git a/ext/xmlwriter/examples/xmlwriter_mem.php b/ext/xmlwriter/examples/xmlwriter_mem.php
deleted file mode 100644
index 774b6e0021..0000000000
--- a/ext/xmlwriter/examples/xmlwriter_mem.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-dl('xmlwriter.so');
-
-$xw = xmlwriter_open_memory();
-xmlwriter_set_indent($xw, 1);
-$res = xmlwriter_set_indent_string($xw, ' ');
-
-xmlwriter_start_document($xw, '1.0', 'utf8');
-
-// A first element
-xmlwriter_start_element($xw, 'tag1');
-
-// Attribute 'att1' for element 'tag1'
-xmlwriter_start_attribute($xw, 'att1');
-xmlwriter_text($xw, 'valueofatt1');
-xmlwriter_end_attribute($xw);
-
-xmlwriter_text($xw, utf8_encode('This is a sample text, ä'));
-xmlwriter_end_element($xw); // tag1
-
-
-$res = xmlwriter_start_comment($xw);
-xmlwriter_text($xw, "Demo text comment");
-$res = xmlwriter_end_comment($xw);
-
-xmlwriter_end_document($xw);
-$out = xmlwriter_output_memory($xw, 0);
-
-echo $out;
-
-// flush the xml buffer using optional
-// flust argument, default is 1
-$out = xmlwriter_output_memory($xw, 1);
-echo $out;
-
-
-$out = xmlwriter_output_memory($xw);
-echo $out;
-
diff --git a/ext/xmlwriter/examples/xmlwriter_mem_ns.php b/ext/xmlwriter/examples/xmlwriter_mem_ns.php
deleted file mode 100644
index 681e86c0b1..0000000000
--- a/ext/xmlwriter/examples/xmlwriter_mem_ns.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-dl('xmlwriter.so');
-
-$xw = xmlwriter_open_memory();
-xmlwriter_set_indent($xw, 1);
-$res = xmlwriter_set_indent_string($xw, ' ');
-
-xmlwriter_start_document($xw, '1.0', 'utf8');
-// A first element
-xmlwriter_start_element_ns($xw,'prefix', 'books', 'uri');
-xmlwriter_start_attribute($xw, 'isbn');
-
-/* Uncomment this line if you have libxml 2.6.17 or CVS version
- after 2005/02/22
- earlier versions segfault
-*/
-/*
-xmlwriter_start_attribute_ns($xw, 'prefix', 'isbn', 'uri');
-xmlwriter_end_attribute($xw);
-*/
-xmlwriter_end_attribute($xw);
-
-xmlwriter_text($xw, 'book1');
-xmlwriter_end_element($xw);
-
-xmlwriter_end_document($xw);
-$out = xmlwriter_output_memory($xw, 0);
-
-echo $out;
-
diff --git a/ext/xmlwriter/package.xml b/ext/xmlwriter/package.xml
deleted file mode 100644
index 3fecce8b54..0000000000
--- a/ext/xmlwriter/package.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE package SYSTEM "../package.dtd">
-<package>
- <name>xmlwriter</name>
- <summary>Provides fast, non-cached, forward-only means to write XML data.</summary>
- <description>
- This extension wraps the libxml xmlWriter API. Represents a writer that
- provides a non-cached, forward-only means of generating streams or files
- containing XML data.
- </description>
- <license>PHP License</license>
- <maintainers>
- <maintainer>
- <user>rrichards</user>
- <name>Rob Richards</name>
- <email>rrichards@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <maintainer>
- <user>pajoye</user>
- <name>Pierre-Alain Joye</name>
- <email>pierre.dev@gmail.com</email>
- <role>developer</role>
- </maintainer>
- <release>
- <version>1.0</version>
- <date>2005-05-02</date>
- <state>stable</state>
- <notes>
- Many Bug Fixes
- Use PHP streams under PHP 4
- Add xmlwriter_flush function to flush buffer
- Add support for xmlTextWriterStart/EndComment
- </notes>
- </release>
-
- <changelog>
- <release>
- <version>0.1</version>
- <date>2004-07-20</date>
- <state>alpha</state>
- <notes>Initial Release </notes>
- </release>
- <release>
- <version>0.2</version>
- <date>2004-10-08</date>
- <state>alpha</state>
- <notes>Fix bug 2482 and other function parameters</notes>
- </release>
- </changelog>
-
- <configureoptions>
- <configureoption name="with-xmlwriter" default="autodetect" prompt="Include XMLWriter support?"/>
- </configureoptions>
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="php_xmlwriter.c"/>
- <file role="src" name="php_xmlwriter.h"/>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="4.3.0" />
- </deps>
-</package>
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
deleted file mode 100644
index cb45373fed..0000000000
--- a/ext/xmlwriter/php_xmlwriter.c
+++ /dev/null
@@ -1,1493 +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_xmlwriter.h"
-
-zend_class_entry *xmlwriter_class_entry;
-
-static zend_function_entry xmlwriter_functions[] = {
- PHP_FE(xmlwriter_open_uri, NULL)
- PHP_FE(xmlwriter_open_memory, NULL)
-#if LIBXML_VERSION >= 20605
- PHP_FE(xmlwriter_set_indent, NULL)
- PHP_FE(xmlwriter_set_indent_string, NULL)
-#endif
-#if LIBXML_VERSION >= 20607
- PHP_FE(xmlwriter_start_comment, NULL)
- PHP_FE(xmlwriter_end_comment, NULL)
-#endif
- PHP_FE(xmlwriter_start_attribute, NULL)
- PHP_FE(xmlwriter_end_attribute, NULL)
- PHP_FE(xmlwriter_write_attribute, NULL)
-#if LIBXML_VERSION > 20617
- PHP_FE(xmlwriter_start_attribute_ns,NULL)
-#endif
- PHP_FE(xmlwriter_start_element, NULL)
- PHP_FE(xmlwriter_end_element, NULL)
- PHP_FE(xmlwriter_start_element_ns, NULL)
- PHP_FE(xmlwriter_write_element, NULL)
- PHP_FE(xmlwriter_write_element_ns, NULL)
- PHP_FE(xmlwriter_start_pi, NULL)
- PHP_FE(xmlwriter_end_pi, NULL)
- PHP_FE(xmlwriter_write_pi, NULL)
- PHP_FE(xmlwriter_start_cdata, NULL)
- PHP_FE(xmlwriter_end_cdata, NULL)
- PHP_FE(xmlwriter_write_cdata, NULL)
- PHP_FE(xmlwriter_text, NULL)
- PHP_FE(xmlwriter_start_document, NULL)
- PHP_FE(xmlwriter_end_document, NULL)
- PHP_FE(xmlwriter_write_comment, NULL)
- PHP_FE(xmlwriter_start_dtd, NULL)
- PHP_FE(xmlwriter_end_dtd, NULL)
- PHP_FE(xmlwriter_write_dtd, NULL)
- PHP_FE(xmlwriter_start_dtd_element, NULL)
- PHP_FE(xmlwriter_end_dtd_element, NULL)
- PHP_FE(xmlwriter_output_memory, NULL)
- PHP_FE(xmlwriter_flush, NULL)
- {NULL, NULL, NULL}
-};
-
-/* {{{ function prototypes */
-PHP_MINIT_FUNCTION(xmlwriter);
-PHP_MSHUTDOWN_FUNCTION(xmlwriter);
-PHP_MINFO_FUNCTION(xmlwriter);
-
-static int le_xmlwriter;
-
-/* _xmlwriter_get_valid_file_path should be made a
- common function in libxml extension as code is common to a few xml extensions */
-char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, int resolved_path_len TSRMLS_DC) {
- xmlURI *uri;
- xmlChar *escsource;
- char *file_dest;
- int isFileUri = 0;
-
- uri = xmlCreateURI();
- escsource = xmlURIEscapeStr(source, ":");
- xmlParseURIReference(uri, escsource);
- xmlFree(escsource);
-
- if (uri->scheme != NULL) {
- /* absolute file uris - libxml only supports localhost or empty host */
- if (strncasecmp(source, "file:///",8) == 0) {
- isFileUri = 1;
-#ifdef PHP_WIN32
- source += 8;
-#else
- source += 7;
-#endif
- } else if (strncasecmp(source, "file://localhost/",17) == 0) {
- isFileUri = 1;
-#ifdef PHP_WIN32
- source += 17;
-#else
- source += 16;
-#endif
- }
- }
-
- file_dest = source;
-
- if ((uri->scheme == NULL || isFileUri)) {
- /* XXX possible buffer overflow if VCWD_REALPATH does not know size of resolved_path */
- if (! VCWD_REALPATH(source, resolved_path)) {
- expand_filepath(source, resolved_path TSRMLS_CC);
- }
- file_dest = resolved_path;
- }
-
- xmlFreeURI(uri);
-
- return file_dest;
-}
-
-#ifndef ZEND_ENGINE_2
-/* Channel libxml file io layer through the PHP streams subsystem.
- * This allows use of ftps:// and https:// urls */
-
-static void *php_xmlwriter_streams_IO_open_write_wrapper(const char *filename TSRMLS_DC)
-{
- php_stream_wrapper *wrapper = NULL;
- void *ret_val = NULL;
-
- ret_val = php_stream_open_wrapper_ex((char *)filename, "wb", ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL, NULL);
- return ret_val;
-}
-
-int php_xmlwriter_streams_IO_write(void *context, const char *buffer, int len)
-{
- TSRMLS_FETCH();
- return php_stream_write((php_stream*)context, buffer, len);
-}
-
-int php_xmlwriter_streams_IO_close(void *context)
-{
- TSRMLS_FETCH();
- return php_stream_close((php_stream*)context);
-}
-#endif
-
-/* {{{ xmlwriter_module_entry
- */
-zend_module_entry xmlwriter_module_entry = {
- STANDARD_MODULE_HEADER,
- "xmlwriter",
- xmlwriter_functions,
- PHP_MINIT(xmlwriter),
- PHP_MSHUTDOWN(xmlwriter),
- NULL,
- NULL,
- PHP_MINFO(xmlwriter),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_XMLWRITER
-ZEND_GET_MODULE(xmlwriter)
-#endif
-
-/* {{{ xmlwriter_objects_clone */
-void xmlwriter_objects_clone(void *object, void **object_clone TSRMLS_DC)
-{
- /* TODO */
-}
-/* }}} */
-
-static void xmlwriter_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
- xmlwriter_object *intern;
-
- intern = (xmlwriter_object *) rsrc->ptr;
- if (intern) {
- if (intern->ptr) {
- xmlFreeTextWriter(intern->ptr);
- intern->ptr = NULL;
- }
- if (intern->output) {
- xmlBufferFree(intern->output);
- intern->output = NULL;
- }
- efree(intern);
- }
-}
-/* }}} */
-
-#if LIBXML_VERSION >= 20605
-/* {{{ proto bool xmlwriter_set_indent(resource xmlwriter, bool)
-Toggle indentation on/off - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_set_indent)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
- zend_bool indent;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &pind, &indent) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
-
- ptr = intern->ptr;
- if (ptr) {
- retval = xmlTextWriterSetIndent(ptr, indent);
- if (retval == 0) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_set_indent_string(resource xmlwriter, string indentString)
-Set string used for indenting - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_set_indent_string)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *indent;
- int indent_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &indent, &indent_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterSetIndentString(ptr, indent);
- if (retval == 0) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto bool xmlwriter_start_attribute(resource xmlwriter, string name)
-Create start attribute - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_attribute)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name;
- int name_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartAttribute(ptr, name);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_attribute(resource xmlwriter)
-End attribute - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_attribute)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndAttribute(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#if LIBXML_VERSION > 20617
-/* {{{ proto bool xmlwriter_start_attribute_ns(resource xmlwriter, string prefix, string name, string uri)
-Create start namespaced attribute - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_attribute_ns)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *prefix, *uri;
- int name_len, prefix_len, uri_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartAttributeNS(ptr, prefix, name, uri);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto bool xmlwriter_write_attribute(resource xmlwriter, string name, string content)
-Write full attribute - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_attribute)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *content;
- int name_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteAttribute(ptr, name, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_attribute_ns(resource xmlwriter, string prefix, string name, string uri, string content)
-Write full namespaced attribute - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_attribute_ns)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *prefix, *uri, *content;
- int name_len, prefix_len, uri_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssss", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteAttributeNS(ptr, prefix, name, uri, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_element(resource xmlwriter, string name)
-Create start element tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name;
- int name_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartElement(ptr, name);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_element_ns(resource xmlwriter, string prefix, string name, string uri)
-Create start namespaced element tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_element_ns)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *prefix, *uri;
- int name_len, prefix_len, uri_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartElementNS(ptr, prefix, name, uri);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_element(resource xmlwriter)
-End current element - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndElement(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_element(resource xmlwriter, string name, string content)
-Write full element tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *content;
- int name_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteElement(ptr, name, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri, string content)
-Write full namesapced element tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_element_ns)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *prefix, *uri, *content;
- int name_len, prefix_len, uri_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssss", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteElementNS(ptr, prefix, name, uri, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_pi(resource xmlwriter, string target)
-Create start PI tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_pi)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *target;
- int target_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &target, &target_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) target, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid PI Target");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartPI(ptr, target);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_pi(resource xmlwriter)
-End current PI - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_pi)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndPI(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_pi(resource xmlwriter, string target, string content)
-Write full PI tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_pi)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *target, *content;
- int target_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &target, &target_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) target, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid PI Target");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWritePI(ptr, target, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_cdata(resource xmlwriter)
-Create start CDATA tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_cdata)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartCDATA(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_cdata(resource xmlwriter)
-End current CDATA - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_cdata)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndCDATA(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_cdata(resource xmlwriter, string content)
-Write full CDATA tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_cdata)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *content;
- int content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind,
- &content, &content_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteCDATA(ptr, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_text(resource xmlwriter, string content)
-Write text - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_text)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *content;
- int content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &content, &content_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteString(ptr, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#if LIBXML_VERSION >= 20607
-/* {{{ proto bool xmlwriter_start_comment(resource xmlwriter)
-Create start comment - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_comment)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartComment(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_comment(resource xmlwriter)
-Create end comment - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_comment)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndComment(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-#endif /* LIBXML_VERSION >= 20607 */
-
-
-/* {{{ proto bool xmlwriter_write_comment(resource xmlwriter, string content)
-Write full comment tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_comment)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *content;
- int content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind,
- &content, &content_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteComment(ptr, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_document(resource xmlwriter, string version, string encoding, string standalone)
-Create document tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_document)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *version = NULL, *enc = NULL, *alone = NULL;
- int version_len, enc_len, alone_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!s!s!", &pind, &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartDocument(ptr, version, enc, alone);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_document(resource xmlwriter)
-End current document - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_document)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndDocument(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_dtd(resource xmlwriter, string name, string pubid, string sysid)
-Create start DTD tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_dtd)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *pubid = NULL, *sysid = NULL;
- int name_len, pubid_len, sysid_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartDTD(ptr, name, pubid, sysid);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_dtd(resource xmlwriter)
-End current DTD - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_dtd)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndDTD(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_dtd(resource xmlwriter, string name, string pubid, string sysid, string subset)
-Write full DTD tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_dtd)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *pubid = NULL, *sysid = NULL, *subset = NULL;
- int name_len, pubid_len, sysid_len, subset_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s!s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteDTD(ptr, name, pubid, sysid, subset);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_dtd_element(resource xmlwriter, string name)
-Create start DTD element - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_dtd_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name;
- int name_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartDTDElement(ptr, name);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_dtd_element(resource xmlwriter)
-End current DTD element - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_dtd_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndDTDElement(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_dtd_element(resource xmlwriter, string name, string content)
-Write full DTD element tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_dtd_element)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *content;
- int name_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteDTDElement(ptr, name, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_dtd_attlist(resource xmlwriter, string name)
-Create start DTD AttList - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_dtd_attlist)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name;
- int name_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartDTDAttlist(ptr, name);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_dtd_attlist(resource xmlwriter)
-End current DTD AttList - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_dtd_attlist)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndDTDAttlist(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_dtd_attlist(resource xmlwriter, string name, string content)
-Write full DTD AttList tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_dtd_attlist)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *content;
- int name_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteDTDAttlist(ptr, name, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_start_dtd_entity(resource xmlwriter, string name, bool isparam)
-Create start DTD Entity - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_start_dtd_entity)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name;
- int name_len, retval;
- zend_bool isparm;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsb", &pind, &name, &name_len, &isparm) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Attribute Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterStartDTDEntity(ptr, isparm, name);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_end_dtd_entity(resource xmlwriter)
-End current DTD Entity - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_end_dtd_entity)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- int retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pind) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterEndDTDEntity(ptr);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool xmlwriter_write_dtd_entity(resource xmlwriter, string name, string content)
-Write full DTD Entity tag - returns FALSE on error */
-PHP_FUNCTION(xmlwriter_write_dtd_entity)
-{
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *name, *content;
- int name_len, content_len, retval;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
-
- retval = xmlValidateName((xmlChar *) name, 0);
- if (retval != 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Element Name");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- retval = xmlTextWriterWriteDTDAttlist(ptr, name, content);
- if (retval != -1) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto resource xmlwriter_open_uri(resource xmlwriter, string source)
-Create new xmlwriter using source uri for output */
-PHP_FUNCTION(xmlwriter_open_uri)
-{
- char *valid_file = NULL;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- char *source;
- char resolved_path[MAXPATHLEN + 1];
- int source_len;
-#ifndef ZEND_ENGINE_2
- xmlOutputBufferPtr out_buffer;
- void *ioctx;
-#endif
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, &source_len) == FAILURE) {
- WRONG_PARAM_COUNT;
- return;
- }
-
- valid_file = _xmlwriter_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
- if (!valid_file) {
- RETURN_FALSE;
- }
-
-#ifndef ZEND_ENGINE_2
- ioctx = php_xmlwriter_streams_IO_open_write_wrapper(valid_file TSRMLS_CC);
- if (ioctx == NULL) {
- RETURN_FALSE;
- }
-
- out_buffer = xmlOutputBufferCreateIO(php_xmlwriter_streams_IO_write,
- php_xmlwriter_streams_IO_close, ioctx, NULL);
-
- if (out_buffer == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create output buffer");
- RETURN_FALSE;
- }
- ptr = xmlNewTextWriter(out_buffer);
-#else
- ptr = xmlNewTextWriterFilename(valid_file, 0);
-#endif
- if (! ptr) {
- RETURN_FALSE;
- }
-
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = NULL;
-#ifndef ZEND_ENGINE_2
- intern->uri_output = out_buffer;
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value,intern,le_xmlwriter);
-
-}
-/* }}} */
-
-/* {{{ proto resource xmlwriter_open_memory()
-Create new xmlwriter using memory for string output */
-PHP_FUNCTION(xmlwriter_open_memory)
-{
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- xmlBufferPtr buffer;
-
- buffer = xmlBufferCreate();
-
- if (buffer == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create output buffer");
- RETURN_FALSE;
- }
-
- ptr = xmlNewTextWriterMemory(buffer, 0);
- if (! ptr) {
- xmlBufferFree(buffer);
- RETURN_FALSE;
- }
-
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = buffer;
-#ifndef ZEND_ENGINE_2
- intern->uri_output = NULL;
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value,intern,le_xmlwriter);
-
-}
-/* }}} */
-
-static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) {
- zval *pind;
- xmlwriter_object *intern;
- xmlTextWriterPtr ptr;
- xmlBufferPtr buffer;
- zend_bool empty = 1;
- int output_bytes;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|b", &pind, &empty) == FAILURE) {
- return;
- }
-
- ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
- ptr = intern->ptr;
-
- if (ptr) {
- buffer = intern->output;
- if (force_string == 1 && buffer == NULL) {
- RETURN_EMPTY_STRING();
- }
- output_bytes = xmlTextWriterFlush(ptr);
- if (buffer) {
- RETVAL_STRING(buffer->content, 1);
- if (empty) {
- xmlBufferEmpty(buffer);
- }
- } else {
- RETVAL_LONG(output_bytes);
- }
- return;
- }
-
- RETURN_EMPTY_STRING();
-}
-
-/* {{{ proto string xmlwriter_output_memory(resource xmlwriter [,bool flush])
-Output current buffer as string */
-PHP_FUNCTION(xmlwriter_output_memory)
-{
- php_xmlwriter_flush(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto mixed xmlwriter_flush(resource xmlwriter [,bool empty])
-Output current buffer */
-PHP_FUNCTION(xmlwriter_flush)
-{
- php_xmlwriter_flush(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(xmlwriter)
-{
-
- le_xmlwriter = zend_register_list_destructors_ex(xmlwriter_dtor, NULL, "xmlwriter", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(xmlwriter)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(xmlwriter)
-{
- php_info_print_table_start();
- {
- php_info_print_table_row(2, "XMLWriter", "enabled");
- }
- php_info_print_table_end();
-}
-/* }}} */
-
-/*
- * 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/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
deleted file mode 100644
index d4f0e33aee..0000000000
--- a/ext/xmlwriter/php_xmlwriter.h
+++ /dev/null
@@ -1,98 +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_XMLWRITER_H
-#define PHP_XMLWRITER_H
-
-extern zend_module_entry xmlwriter_module_entry;
-#define phpext_xmlwriter_ptr &xmlwriter_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XMLWRITER_API __declspec(dllexport)
-#else
-#define PHP_XMLWRITER_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include <libxml/tree.h>
-#include <libxml/xmlwriter.h>
-#include <libxml/uri.h>
-
-typedef struct _xmlwriter_object {
- xmlTextWriterPtr ptr;
- xmlBufferPtr output;
-#ifndef ZEND_ENGINE_2
- xmlOutputBufferPtr uri_output;
-#endif
-} xmlwriter_object;
-
-#if LIBXML_VERSION >= 20605
-PHP_FUNCTION(xmlwriter_set_indent);
-PHP_FUNCTION(xmlwriter_set_indent_string);
-#endif
-PHP_FUNCTION(xmlwriter_start_attribute);
-PHP_FUNCTION(xmlwriter_end_attribute);
-PHP_FUNCTION(xmlwriter_start_attribute_ns);
-PHP_FUNCTION(xmlwriter_write_attribute);
-#if LIBXML_VERSION > 20617
-PHP_FUNCTION(xmlwriter_write_attribute_ns);
-#endif
-PHP_FUNCTION(xmlwriter_start_element);
-PHP_FUNCTION(xmlwriter_end_element);
-PHP_FUNCTION(xmlwriter_start_element_ns);
-PHP_FUNCTION(xmlwriter_write_element);
-PHP_FUNCTION(xmlwriter_write_element_ns);
-PHP_FUNCTION(xmlwriter_start_pi);
-PHP_FUNCTION(xmlwriter_end_pi);
-PHP_FUNCTION(xmlwriter_write_pi);
-PHP_FUNCTION(xmlwriter_start_cdata);
-PHP_FUNCTION(xmlwriter_end_cdata);
-PHP_FUNCTION(xmlwriter_write_cdata);
-PHP_FUNCTION(xmlwriter_text);
-PHP_FUNCTION(xmlwriter_start_document);
-PHP_FUNCTION(xmlwriter_end_document);
-#if LIBXML_VERSION >= 20607
-PHP_FUNCTION(xmlwriter_start_comment);
-PHP_FUNCTION(xmlwriter_end_comment);
-#endif
-PHP_FUNCTION(xmlwriter_write_comment);
-PHP_FUNCTION(xmlwriter_start_dtd);
-PHP_FUNCTION(xmlwriter_end_dtd);
-PHP_FUNCTION(xmlwriter_write_dtd);
-PHP_FUNCTION(xmlwriter_start_dtd_element);
-PHP_FUNCTION(xmlwriter_end_dtd_element);
-PHP_FUNCTION(xmlwriter_open_uri);
-PHP_FUNCTION(xmlwriter_open_memory);
-PHP_FUNCTION(xmlwriter_output_memory);
-PHP_FUNCTION(xmlwriter_flush);
-
-#endif /* PHP_XMLWRITER_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/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:
- */
diff --git a/tests/lang/bug21800.phpt b/tests/lang/bug21800.phpt
new file mode 100644
index 0000000000..72755e29a5
--- /dev/null
+++ b/tests/lang/bug21800.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #21800 (Segfault under interactive mode)
+--SKIPIF--
+<?php (PHP_SAPI != 'cli') and print "SKIP PHP binary is not cli"; ?>
+--FILE--
+<?php
+$exe = getenv('TEST_PHP_EXECUTABLE');
+$fh = popen("$exe -a", 'w');
+if ($fh !== false) {
+ fwrite($fh, "<?php echo ':test:'; ?>\n\n");
+ fclose($fh);
+} else {
+ echo "failure\n";
+}
+?>
+--EXPECT--
+Interactive mode enabled
+
+:test: