From 80b7d0980fea8f46a782a1dd75da7af43ba2596f Mon Sep 17 00:00:00 2001
From: SVN Migration
Date: Wed, 18 Jan 2006 21:06:19 +0000
Subject: [PATCH] This commit was manufactured by cvs2svn to create tag
'RELEASE_1_0_4'.
---
ext/filter/CREDITS | 2 -
ext/filter/callback_filter.c | 68 ---
ext/filter/config.m4 | 95 -----
ext/filter/config.w32 | 8 -
ext/filter/filter.c | 680 ------------------------------
ext/filter/filter_private.h | 87 ----
ext/filter/package.xml | 53 ---
ext/filter/package2.xml | 68 ---
ext/filter/php_filter.h | 105 -----
ext/filter/sanitizing_filters.c | 340 ---------------
ext/filter/tests/001.phpt | 8 -
ext/filter/tests/002.phpt | 11 -
ext/filter/tests/003.phpt | 22 -
ext/filter/tests/004.phpt | 24 --
ext/filter/tests/005.phpt | 21 -
ext/filter/tests/006.phpt | 10 -
ext/filter/tests/007.phpt | 68 ---
ext/filter/tests/008.phpt | 88 ----
ext/filter/tests/009.phpt | 30 --
ext/filter/tests/010.phpt | 60 ---
ext/filter/tests/011.phpt | 49 ---
ext/filter/tests/012.phpt | 16 -
ext/filter/tests/013.phpt | 40 --
ext/filter/tests/014.phpt | 41 --
ext/filter/tests/015.phpt | 72 ----
ext/filter/tests/016.phpt | 32 --
ext/filter/tests/017.phpt | 24 --
ext/filter/tests/018.phpt | 50 ---
ext/filter/tests/019.phpt | 20 -
ext/filter/tests/020.phpt | 18 -
ext/filter/tests/021.phpt | 44 --
ext/filter/tests/022.phpt | 20 -
ext/filter/tests/023.phpt | 20 -
ext/filter/tests/024.phpt | 18 -
ext/filter/tests/025.phpt | 24 --
ext/filter/tests/026.phpt | 30 --
ext/filter/tests/027.phpt | 30 --
ext/filter/tests/028.phpt | 35 --
ext/filter/tests/029.phpt | 103 -----
ext/filter/tests/filter_data.phpt | 71 ----
ext/imap/imap.h | 103 -----
main/php_realpath.c | 285 -------------
42 files changed, 2993 deletions(-)
delete mode 100644 ext/filter/CREDITS
delete mode 100644 ext/filter/callback_filter.c
delete mode 100644 ext/filter/config.m4
delete mode 100644 ext/filter/config.w32
delete mode 100644 ext/filter/filter.c
delete mode 100644 ext/filter/filter_private.h
delete mode 100644 ext/filter/package.xml
delete mode 100644 ext/filter/package2.xml
delete mode 100644 ext/filter/php_filter.h
delete mode 100644 ext/filter/sanitizing_filters.c
delete mode 100644 ext/filter/tests/001.phpt
delete mode 100644 ext/filter/tests/002.phpt
delete mode 100644 ext/filter/tests/003.phpt
delete mode 100644 ext/filter/tests/004.phpt
delete mode 100644 ext/filter/tests/005.phpt
delete mode 100644 ext/filter/tests/006.phpt
delete mode 100644 ext/filter/tests/007.phpt
delete mode 100644 ext/filter/tests/008.phpt
delete mode 100644 ext/filter/tests/009.phpt
delete mode 100644 ext/filter/tests/010.phpt
delete mode 100644 ext/filter/tests/011.phpt
delete mode 100644 ext/filter/tests/012.phpt
delete mode 100644 ext/filter/tests/013.phpt
delete mode 100644 ext/filter/tests/014.phpt
delete mode 100644 ext/filter/tests/015.phpt
delete mode 100644 ext/filter/tests/016.phpt
delete mode 100644 ext/filter/tests/017.phpt
delete mode 100644 ext/filter/tests/018.phpt
delete mode 100644 ext/filter/tests/019.phpt
delete mode 100644 ext/filter/tests/020.phpt
delete mode 100644 ext/filter/tests/021.phpt
delete mode 100644 ext/filter/tests/022.phpt
delete mode 100644 ext/filter/tests/023.phpt
delete mode 100644 ext/filter/tests/024.phpt
delete mode 100644 ext/filter/tests/025.phpt
delete mode 100644 ext/filter/tests/026.phpt
delete mode 100644 ext/filter/tests/027.phpt
delete mode 100644 ext/filter/tests/028.phpt
delete mode 100644 ext/filter/tests/029.phpt
delete mode 100644 ext/filter/tests/filter_data.phpt
delete mode 100644 ext/imap/imap.h
delete mode 100644 main/php_realpath.c
diff --git a/ext/filter/CREDITS b/ext/filter/CREDITS
deleted file mode 100644
index fade411d07cdb..0000000000000
--- a/ext/filter/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Input Filter
-Rasmus Lerdorf, Derick Rethans
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
deleted file mode 100644
index 5ce17fe23fc11..0000000000000
--- a/ext/filter/callback_filter.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 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_01.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. |
- +----------------------------------------------------------------------+
- | Authors: Derick Rethans |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php_filter.h"
-
-void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL)
-{
- char *name = NULL;
- zval *retval_ptr;
- zval ***args;
- int status;
-
- if (!option_array || !zend_is_callable(option_array, IS_CALLABLE_CHECK_NO_ACCESS, &name)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback");
- if (name) {
- efree(name);
- }
- zval_dtor(value);
- Z_TYPE_P(value) = IS_NULL;
- return;
- }
- efree(name);
-
- args = safe_emalloc(sizeof(zval **), 1, 0);
- args[0] = &value;
-
- status = call_user_function_ex(EG(function_table), NULL, option_array, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
-
- if (status == SUCCESS && retval_ptr != NULL) {
- zval_dtor(value);
- *value = *retval_ptr;
- zval_copy_ctor(value);
- } else {
- zval_dtor(value);
- Z_TYPE_P(value) = IS_NULL;
- }
-
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
- efree(args);
-}
-
-/*
- * 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/config.m4 b/ext/filter/config.m4
deleted file mode 100644
index 0db0375e2679b..0000000000000
--- a/ext/filter/config.m4
+++ /dev/null
@@ -1,95 +0,0 @@
-dnl $Id$
-dnl config.m4 for input filtering extension
-
-PHP_ARG_ENABLE(filter, whether to enable input filter support,
-[ --disable-filter Disable input filter support], yes)
-
-PHP_ARG_WITH(pcre-dir, pcre install prefix,
-[ --with-pcre-dir FILTER: pcre install prefix], no, no)
-
-if test "$PHP_FILTER" != "no"; then
-
- dnl Check if configure is the PHP core configure
- if test -n "$PHP_VERSION"; then
- dnl This extension can not be build as shared when in PHP core
- ext_shared=no
- else
- dnl This is PECL build, check if bundled PCRE library is used
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=$INCLUDES
- AC_EGREP_CPP(yes,[
-#include
-#if defined(HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE)
-yes
-#endif
- ],[
- PHP_PCRE_REGEX=yes
- ],[
- AC_EGREP_CPP(yes,[
-#include
-#if defined(HAVE_PCRE) && !defined(COMPILE_DL_PCRE)
-yes
-#endif
- ],[
- PHP_PCRE_REGEX=pecl
- ],[
- PHP_PCRE_REGEX=no
- ])
- ])
- CPPFLAGS=$old_CPPFLAGS
- fi
-
- if test "$PHP_PCRE_REGEX" != "yes"; then
- dnl
- dnl If PCRE extension is enabled we can use the already found paths,
- dnl otherwise we have to detect them here:
- dnl
- if test "$PHP_PCRE_REGEX" = "no" || test "$PHP_PCRE_REGEX" = "pecl"; then
- dnl Set the PCRE search dirs correctly
- case "$PHP_PCRE_DIR" in
- yes|no)
- PCRE_SEARCH_DIR="/usr/local /usr"
- ;;
- *)
- PCRE_SEARCH_DIR="$PHP_PCRE_DIR"
- ;;
- esac
-
- for i in $PCRE_SEARCH_DIR; do
- if test -f $i/include/pcre/pcre.h; then
- PCRE_INCDIR=$i/include/pcre
- break
- elif test -f $i/include/pcre.h; then
- PCRE_INCDIR=$i/include
- break
- elif test -f $i/pcre.h; then
- PCRE_INCDIR=$i
- break
- fi
- done
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_ERROR([Could not find pcre.h anywhere under $PCRE_SEARCH_DIR])
- fi
-
- for j in $PCRE_SEARCH_DIR/$PHP_LIBDIR $PCRE_SEARCH_DIR; do
- if test -f $j/libpcre.a || test -f $j/libpcre.$SHLIB_SUFFIX_NAME; then
- PCRE_LIBDIR=$j
- break
- fi
- done
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR([Could not find libpcre.(a|$SHLIB_SUFFIX_NAME) anywhere under $PCRE_SEARCH_DIR])
- fi
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, FILTER_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- fi
-
- PHP_NEW_EXTENSION(filter, filter.c sanitizing_filters.c logical_filters.c callback_filter.c, $ext_shared)
- PHP_SUBST(FILTER_SHARED_LIBADD)
-
- PHP_INSTALL_HEADERS([$ext_srcdir/php_filter.h])
-fi
diff --git a/ext/filter/config.w32 b/ext/filter/config.w32
deleted file mode 100644
index 083555a4c77a7..0000000000000
--- a/ext/filter/config.w32
+++ /dev/null
@@ -1,8 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("filter", "Filter Support", "yes");
-
-if (PHP_FILTER == "yes") {
- EXTENSION("filter", "filter.c sanitizing_filters.c logical_filters.c callback_filter.c");
-}
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
deleted file mode 100644
index 52aef9775f84e..0000000000000
--- a/ext/filter/filter.c
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 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_01.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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf |
- | Derick Rethans |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_filter.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(filter)
-
-#include "filter_private.h"
-
-typedef struct filter_list_entry {
- char *name;
- int id;
- void (*function)(PHP_INPUT_FILTER_PARAM_DECL);
-} filter_list_entry;
-
-filter_list_entry filter_list[] = {
- { "int", FL_INT, php_filter_int },
- { "boolean", FL_BOOLEAN, php_filter_boolean },
- { "float", FL_FLOAT, php_filter_float },
-
- { "validate_regexp", FL_REGEXP, php_filter_validate_regexp },
- { "validate_url", FL_URL, php_filter_validate_url },
- { "validate_email", FL_EMAIL, php_filter_validate_email },
- { "validate_ip", FL_IP, php_filter_validate_ip },
-
- { "string", FS_STRING, php_filter_string },
- { "stripped", FS_STRING, php_filter_string },
- { "encoded", FS_ENCODED, php_filter_encoded },
- { "special_chars", FS_SPECIAL_CHARS, php_filter_special_chars },
- { "unsafe_raw", FS_UNSAFE_RAW, php_filter_unsafe_raw },
- { "email", FS_EMAIL, php_filter_email },
- { "url", FS_URL, php_filter_url },
- { "number_int", FS_NUMBER_INT, php_filter_number_int },
- { "number_float", FS_NUMBER_FLOAT, php_filter_number_float },
- { "magic_quotes", FS_MAGIC_QUOTES, php_filter_magic_quotes },
-
- { "callback", FC_CALLBACK, php_filter_callback },
-};
-
-#ifndef PARSE_ENV
-#define PARSE_ENV 4
-#endif
-
-#ifndef PARSE_SERVER
-#define PARSE_SERVER 5
-#endif
-
-#ifndef PARSE_SESSION
-#define PARSE_SESSION 6
-#endif
-
-static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC);
-
-/* {{{ filter_functions[]
- */
-zend_function_entry filter_functions[] = {
- PHP_FE(input_get, NULL)
- PHP_FE(input_filters_list, NULL)
- PHP_FE(input_has_variable, NULL)
- PHP_FE(input_name_to_filter, NULL)
- PHP_FE(filter_data, 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.9.3",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_FILTER
-ZEND_GET_MODULE(filter)
-#endif
-
-/* {{{ UpdateDefaultFilter
- */
-static PHP_INI_MH(UpdateDefaultFilter)
-{
- int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
-
- for (i = 0; i < size; ++i) {
- if ((strcasecmp(new_value, filter_list[i].name) == 0)) {
- IF_G(default_filter) = filter_list[i].id;
- return SUCCESS;
- }
- }
- /* Fallback to "string" filter */
- IF_G(default_filter) = FS_DEFAULT;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_INI
- */
-static PHP_INI_MH(OnUpdateFlags)
-{
- if (!new_value) {
- IF_G(default_filter_flags) = FILTER_FLAG_NO_ENCODE_QUOTES;
- } else {
- IF_G(default_filter_flags) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("filter.default", "string", PHP_INI_ALL, UpdateDefaultFilter, default_filter, zend_filter_globals, filter_globals)
- PHP_INI_ENTRY("filter.default_flags", NULL, PHP_INI_ALL, OnUpdateFlags)
-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->session_array = NULL;
- filter_globals->default_filter = FS_DEFAULT;
-}
-/* }}} */
-
-#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("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FL_INT", FL_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FL_BOOLEAN", FL_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FL_FLOAT", FL_FLOAT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FL_REGEXP", FL_REGEXP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FL_URL", FL_URL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FL_EMAIL", FL_EMAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FL_IP", FL_IP, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FS_DEFAULT", FS_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_STRING", FS_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_STRIPPED", FS_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_ENCODED", FS_ENCODED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_SPECIAL_CHARS", FS_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_UNSAFE_RAW", FS_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_EMAIL", FS_EMAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_URL", FS_URL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_NUMBER_INT", FS_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_NUMBER_FLOAT", FS_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FS_MAGIC_QUOTES", FS_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FC_CALLBACK", FC_CALLBACK, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, 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_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, 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_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, 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
- */
-#define VAR_ARRAY_COPY_DTOR(a) \
- if (IF_G(a)) { \
- zval_ptr_dtor(&IF_G(a)); \
- IF_G(a) = NULL; \
- }
-PHP_RSHUTDOWN_FUNCTION(filter)
-{
- VAR_ARRAY_COPY_DTOR(get_array)
- VAR_ARRAY_COPY_DTOR(post_array)
- VAR_ARRAY_COPY_DTOR(cookie_array)
- VAR_ARRAY_COPY_DTOR(server_array)
- VAR_ARRAY_COPY_DTOR(env_array)
- VAR_ARRAY_COPY_DTOR(session_array)
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(filter)
-{
- php_info_print_table_start();
- php_info_print_table_row( 2, "Input Validation and Filtering", "enabled" );
- php_info_print_table_row( 2, "Revision", "$Revision$");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-static filter_list_entry php_find_filter(long id)
-{
- int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
-
- for (i = 0; i < size; ++i) {
- if (filter_list[i].id == id) {
- return filter_list[i];
- }
- }
- /* Fallback to "string" filter */
- for (i = 0; i < size; ++i) {
- if (filter_list[i].id == FS_DEFAULT) {
- return filter_list[i];
- }
- }
- /* To shut up GCC */
- return filter_list[0];
-}
-
-static void php_zval_filter(zval *value, long filter, long flags, zval *options, char* charset TSRMLS_DC)
-{
- filter_list_entry filter_func;
-
- filter_func = php_find_filter(filter);
-
- if (!filter_func.id) {
- /* Find default filter */
- filter_func = php_find_filter(FS_DEFAULT);
- }
-
- /* Here be strings */
- convert_to_string(value);
-
- filter_func.function(value, flags, options, charset TSRMLS_CC);
-}
-
-/* {{{ php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned *new_val_len)
- */
-static 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, raw_var;
- zval *array_ptr = NULL, *orig_array_ptr = NULL;
- char *orig_var;
- int retval = 0;
-
- assert(*val != NULL);
-
-#define PARSE_CASE(s,a,t) \
- case s: \
- if (!IF_G(a)) { \
- ALLOC_ZVAL(array_ptr); \
- array_init(array_ptr); \
- INIT_PZVAL(array_ptr); \
- IF_G(a) = array_ptr; \
- } else { \
- array_ptr = IF_G(a); \
- } \
- orig_array_ptr = PG(http_globals)[t]; \
- break;
-
- switch (arg) {
- PARSE_CASE(PARSE_POST, post_array, TRACK_VARS_POST)
- PARSE_CASE(PARSE_GET, get_array, TRACK_VARS_GET)
- PARSE_CASE(PARSE_COOKIE, cookie_array, TRACK_VARS_COOKIE)
- PARSE_CASE(PARSE_SERVER, server_array, TRACK_VARS_SERVER)
- PARSE_CASE(PARSE_ENV, env_array, TRACK_VARS_ENV)
-
- case PARSE_STRING: /* PARSE_STRING is used by parse_str() function */
- retval = 1;
- break;
- }
-
- if (array_ptr) {
- /* Make a copy of the variable name, as php_register_variable_ex seems to
- * modify it */
- orig_var = estrdup(var);
-
- /* Store the RAW variable internally */
- /* FIXME: Should not use php_register_variable_ex as that also registers
- * globals when register_globals is turned on */
- Z_STRLEN(raw_var) = val_len;
- Z_STRVAL(raw_var) = estrndup(*val, val_len + 1);
- Z_TYPE(raw_var) = IS_STRING;
-
- php_register_variable_ex(var, &raw_var, array_ptr TSRMLS_CC);
- }
-
- /* Register mangled variable */
- /* FIXME: Should not use php_register_variable_ex as that also registers
- * globals when register_globals is turned on */
- Z_STRLEN(new_var) = val_len;
- Z_STRVAL(new_var) = estrndup(*val, val_len + 1);
- Z_TYPE(new_var) = IS_STRING;
-
- if (val_len) {
- if (! (IF_G(default_filter) == FS_UNSAFE_RAW)) {
- php_zval_filter(&new_var, IF_G(default_filter), IF_G(default_filter_flags), NULL, NULL/*charset*/ TSRMLS_CC);
- }
- }
-
- if (orig_array_ptr) {
- php_register_variable_ex(orig_var, &new_var, orig_array_ptr TSRMLS_CC);
- efree(orig_var);
- }
-
- if (retval) {
- if (new_val_len) {
- *new_val_len = Z_STRLEN(new_var);
- }
- efree(*val);
- if (Z_STRLEN(new_var)) {
- *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var) + 1);
- zval_dtor(&new_var);
- } else {
- *val = estrdup("");
- }
- }
-
- return retval;
-}
-/* }}} */
-
-/* {{{ static void php_zval_filter_recursive(zval *array, long filter, long flags, char *charset TSRMLS_DC)
- */
-static void php_zval_filter_recursive(zval *value, long filter, long flags, zval *options, char *charset TSRMLS_DC)
-{
- zval **element;
- HashPosition pos;
-
- if (Z_TYPE_P(value) == IS_ARRAY) {
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(value), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_P(value), (void **) &element, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_P(value), &pos)) {
- php_zval_filter_recursive(*element, filter, flags, options, charset TSRMLS_CC);
- }
- } else {
- php_zval_filter(value, filter, flags, options, charset TSRMLS_CC);
- }
-}
-/* }}} */
-
-#define FIND_SOURCE(a,t) \
- array_ptr = IF_G(a); \
- break;
-
-/* {{{ proto mixed input_has_variable(constant type, string variable_name)
- */
-PHP_FUNCTION(input_has_variable)
-{
- long arg;
- char *var;
- int var_len;
- zval **tmp;
- zval *array_ptr = NULL;
- HashTable *hash_ptr;
- int found = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
- return;
- }
-
- switch (arg) {
- case PARSE_GET: FIND_SOURCE(get_array, TRACK_VARS_GET)
- case PARSE_POST: FIND_SOURCE(post_array, TRACK_VARS_POST)
- case PARSE_COOKIE: FIND_SOURCE(cookie_array, TRACK_VARS_COOKIE)
- case PARSE_SERVER: FIND_SOURCE(server_array, TRACK_VARS_SERVER)
- case PARSE_ENV: FIND_SOURCE(env_array, TRACK_VARS_ENV)
- }
-
- if (!array_ptr) {
- RETURN_FALSE;
- }
-
- if (!found) {
- hash_ptr = HASH_OF(array_ptr);
-
- if (hash_ptr && zend_hash_find(hash_ptr, var, var_len + 1, (void **)&tmp) == SUCCESS) {
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto mixed input_get(constant type, string variable_name [, int filter [, mixed flags [, string charset]]])
- */
-PHP_FUNCTION(input_get)
-{
- long arg, filter = FS_DEFAULT;
- char *var, *charset = NULL;
- int var_len, charset_len;
- zval *flags = NULL;
- zval **tmp;
- zval *array_ptr = NULL, *array_ptr2 = NULL, *array_ptr3 = NULL;
- HashTable *hash_ptr;
- int found = 0;
- int filter_flags = 0;
- zval *options = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls|lzs", &arg, &var, &var_len, &filter, &flags, &charset, &charset_len) == FAILURE) {
- return;
- }
-
- if (flags) {
- switch (Z_TYPE_P(flags)) {
- case IS_ARRAY:
- options = flags;
- break;
-
- case IS_STRING:
- case IS_BOOL:
- case IS_LONG:
- convert_to_long(flags);
- filter_flags = Z_LVAL_P(flags);
- options = NULL;
- break;
- }
- }
-
- switch(arg) {
- case PARSE_GET: FIND_SOURCE(get_array, TRACK_VARS_GET)
- case PARSE_POST: FIND_SOURCE(post_array, TRACK_VARS_POST)
- case PARSE_COOKIE: FIND_SOURCE(cookie_array, TRACK_VARS_COOKIE)
- case PARSE_SERVER: FIND_SOURCE(server_array, TRACK_VARS_SERVER)
- case PARSE_ENV: FIND_SOURCE(env_array, TRACK_VARS_ENV)
-
- case PARSE_SESSION:
- /* FIXME: Implement session source */
- 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) != FS_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) != FS_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) != FS_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 {
- FIND_SOURCE(get_array, TRACK_VARS_GET)
- }
-
- }
-
- if (!array_ptr) {
- RETURN_FALSE;
- }
-
- if (array_ptr3) {
- hash_ptr = HASH_OF(array_ptr3);
- if (hash_ptr && zend_hash_find(hash_ptr, var, var_len + 1, (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, var, var_len + 1, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- found = 1;
- }
- }
-
- if (!found) {
- hash_ptr = HASH_OF(array_ptr);
-
- if (hash_ptr && zend_hash_find(hash_ptr, var, var_len + 1, (void **)&tmp) == SUCCESS) {
- *return_value = **tmp;
- found = 1;
- }
- }
-
- if (found) {
- zval_copy_ctor(return_value); /* Watch out for empty strings */
- php_zval_filter_recursive(return_value, filter, filter_flags, options, charset TSRMLS_CC);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto input_filters_list()
- * Returns a list of all supported filters */
-PHP_FUNCTION(input_filters_list)
-{
- int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
-
- array_init(return_value);
- for (i = 0; i < size; ++i) {
- add_next_index_string(return_value, filter_list[i].name, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto input_name_to_filter(string filtername)
- * Returns the filter ID belonging to a named filter */
-PHP_FUNCTION(input_name_to_filter)
-{
- int i, filter_len;
- int size = sizeof(filter_list) / sizeof(filter_list_entry);
- char *filter;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filter, &filter_len) == FAILURE) {
- return;
- }
-
- for (i = 0; i < size; ++i) {
- if (strcmp(filter_list[i].name, filter) == 0) {
- RETURN_LONG(filter_list[i].id);
- }
- }
- RETURN_NULL();
-}
-/* }}} */
-
-/* {{{ proto filter_data(mixed variable, int filter [, mixed filter_options [, string charset ]])
- */
-PHP_FUNCTION(filter_data)
-{
- long filter = FS_DEFAULT;
- char *charset = NULL;
- int charset_len;
- zval *var, *flags = NULL;
- int filter_flags = 0;
- zval *options = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/l|zs", &var, &filter, &flags, &charset, &charset_len) == FAILURE) {
- return;
- }
-
- if (filter != FC_CALLBACK) {
- if (flags) {
- switch (Z_TYPE_P(flags)) {
- case IS_ARRAY:
- options = flags;
- break;
-
- case IS_STRING:
- case IS_BOOL:
- case IS_LONG:
- convert_to_long(flags);
- filter_flags = Z_LVAL_P(flags);
- options = NULL;
- break;
- }
- }
- } else {
- if (flags) {
- switch (Z_TYPE_P(flags)) {
- case IS_ARRAY:
- case IS_STRING:
- options = flags;
- break;
-
- default:
- convert_to_string(flags);
- options = flags;
- break;
- }
- }
- }
- php_zval_filter_recursive(var, filter, filter_flags, options, charset TSRMLS_CC);
- RETURN_ZVAL(var, 1, 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/filter/filter_private.h b/ext/filter/filter_private.h
deleted file mode 100644
index 3fa40c8ff2e8a..0000000000000
--- a/ext/filter/filter_private.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 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_01.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. |
- +----------------------------------------------------------------------+
- | Authors: Derick Rethans |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef FILTER_PRIVATE_H
-#define FILTER_PRIVATE_H
-
-#define FILTER_FLAG_NONE 0x0000
-
-#define FILTER_FLAG_ALLOW_OCTAL 0x0001
-#define FILTER_FLAG_ALLOW_HEX 0x0002
-
-#define FILTER_FLAG_STRIP_LOW 0x0004
-#define FILTER_FLAG_STRIP_HIGH 0x0008
-#define FILTER_FLAG_ENCODE_LOW 0x0010
-#define FILTER_FLAG_ENCODE_HIGH 0x0020
-#define FILTER_FLAG_ENCODE_AMP 0x0040
-#define FILTER_FLAG_NO_ENCODE_QUOTES 0x0080
-#define FILTER_FLAG_EMPTY_STRING_NULL 0x0100
-
-#define FILTER_FLAG_ALLOW_FRACTION 0x1000
-#define FILTER_FLAG_ALLOW_THOUSAND 0x2000
-#define FILTER_FLAG_ALLOW_SCIENTIFIC 0x4000
-
-#define FILTER_FLAG_SCHEME_REQUIRED 0x010000
-#define FILTER_FLAG_HOST_REQUIRED 0x020000
-#define FILTER_FLAG_PATH_REQUIRED 0x040000
-#define FILTER_FLAG_QUERY_REQUIRED 0x080000
-
-#define FILTER_FLAG_IPV4 0x100000
-#define FILTER_FLAG_IPV6 0x200000
-#define FILTER_FLAG_NO_RES_RANGE 0x400000
-#define FILTER_FLAG_NO_PRIV_RANGE 0x800000
-
-#define FL_INT 0x0101
-#define FL_BOOLEAN 0x0102
-#define FL_FLOAT 0x0103
-
-#define FL_REGEXP 0x0110
-#define FL_URL 0x0111
-#define FL_EMAIL 0x0112
-#define FL_IP 0x0113
-
-#define FL_ALL 0x0100
-
-#define FS_DEFAULT 0x0201
-
-#define FS_STRING 0x0201
-#define FS_ENCODED 0x0202
-#define FS_SPECIAL_CHARS 0x0203
-#define FS_UNSAFE_RAW 0x0204
-#define FS_EMAIL 0x0205
-#define FS_URL 0x0206
-#define FS_NUMBER_INT 0x0207
-#define FS_NUMBER_FLOAT 0x0208
-#define FS_MAGIC_QUOTES 0x0209
-
-#define FS_ALL 0x0200
-
-#define FC_CALLBACK 0x0400
-
-#endif /* FILTER_PRIVATE_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/package.xml b/ext/filter/package.xml
deleted file mode 100644
index 70adbd8111352..0000000000000
--- a/ext/filter/package.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- filter
- Extension for safely dealing with input parameters
-
-
- derick
- Derick Rethans
- derick@php.net
- lead
-
-
- rasmus
- Rasmus Lerdorf
- rasmus@php.net
- lead
-
-
-
-The Input Filter extension is meant to address this issue by implementing a set
-of filters and mechanisms that users can use to safely access their input data.
-
- PHP
-
- beta
- 0.9.3
- 2005-11-18
-
-- Fixed PECL bug #5960: Build with PHP's PCRE headers
-- Fixed PECL bug #5962: Postive float returned when negative float given
-- Fixed PECL bug #5963: Segmentation fault when passing anything other than strings
-
-- Added PECL FR #5961: Support other cases of "On", "Off", "True", and "False"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ext/filter/package2.xml b/ext/filter/package2.xml
deleted file mode 100644
index 5da39aaa676ce..0000000000000
--- a/ext/filter/package2.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
- filter
- pecl.php.net
- Extension for safely dealing with input parameters
- The Input Filter extension is meant to address this issue by implementing a set
-of filters and mechanisms that users can use to safely access their input data.
-
-
-
- Derick Rethans
- derick
- derick@php.net
- yes
-
-
- Rasmus Lerdorf
- rasmus
- rasmus@php.net
- yes
-
- 2005-11-18
-
-
- 0.9.3
- 0.9.3
-
-
- beta
- beta
-
- PHP
- - Fixed PECL bug #5960: Build with PHP's PCRE headers
-- Fixed PECL bug #5962: Postive float returned when negative float given
-- Fixed PECL bug #5963: Segmentation fault when passing anything other than strings
-
-- Added PECL FR #5961: Support other cases of "On", "Off", "True", and "False"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0.0
-
-
- 1.4.0b1
-
-
-
- filter
-
-
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
deleted file mode 100644
index fd22b5a06ca14..0000000000000
--- a/ext/filter/php_filter.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 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_01.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. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf |
- | Derick Rethans |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FILTER_H
-#define PHP_FILTER_H
-
-#include "SAPI.h"
-#include "zend_API.h"
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-#include "php_variables.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
-
-PHP_MINIT_FUNCTION(filter);
-PHP_MSHUTDOWN_FUNCTION(filter);
-PHP_RINIT_FUNCTION(filter);
-PHP_RSHUTDOWN_FUNCTION(filter);
-PHP_MINFO_FUNCTION(filter);
-
-PHP_FUNCTION(input_get);
-PHP_FUNCTION(input_filters_list);
-PHP_FUNCTION(input_has_variable);
-PHP_FUNCTION(input_name_to_filter);
-PHP_FUNCTION(filter_data);
-
-ZEND_BEGIN_MODULE_GLOBALS(filter)
- zval *post_array;
- zval *get_array;
- zval *cookie_array;
- zval *env_array;
- zval *server_array;
- zval *session_array;
- long default_filter;
- long default_filter_flags;
-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
-
-
-#define PHP_INPUT_FILTER_PARAM_DECL zval *value, long flags, zval *option_array, char *charset TSRMLS_DC
-void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL);
-
-void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_encoded(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_special_chars(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_email(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_url(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL);
-
-void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL);
-
-#endif /* FILTER_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
deleted file mode 100644
index 67c7b416b3d0b..0000000000000
--- a/ext/filter/sanitizing_filters.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 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_01.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. |
- +----------------------------------------------------------------------+
- | Authors: Derick Rethans |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php_filter.h"
-#include "filter_private.h"
-#include "ext/standard/php_smart_str.h"
-
-/* {{{ STRUCTS */
-typedef unsigned long filter_map[256];
-/* }}} */
-
-/* {{{ HELPER FUNCTIONS */
-static void php_filter_encode_html(zval *value, char* chars, int encode_nul)
-{
- register int x, y;
- smart_str str = {0};
- int len = Z_STRLEN_P(value);
- char *s = Z_STRVAL_P(value);
-
- if (Z_STRLEN_P(value) == 0) {
- return;
- }
-
- for (x = 0, y = 0; len--; x++, y++) {
- if (strchr(chars, s[x]) || (encode_nul && s[x] == 0)) {
- smart_str_appendl(&str, "", 2);
- smart_str_append_long(&str, s[x]);
- smart_str_appendc(&str, ';');
- } else {
- smart_str_appendc(&str, s[x]);
- }
- }
- smart_str_0(&str);
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = str.c;
- Z_STRLEN_P(value) = str.len;
-}
-
-static void php_filter_encode_html_high_low(zval *value, long flags)
-{
- register int x, y;
- smart_str str = {0};
- int len = Z_STRLEN_P(value);
- unsigned char *s = Z_STRVAL_P(value);
-
- if (Z_STRLEN_P(value) == 0) {
- return;
- }
-
- for (x = 0, y = 0; len--; x++, y++) {
- if (((flags & FILTER_FLAG_ENCODE_LOW) && (s[x] < 32)) || ((flags & FILTER_FLAG_ENCODE_HIGH) && (s[x] > 127))) {
- smart_str_appendl(&str, "", 2);
- smart_str_append_long(&str, s[x]);
- smart_str_appendc(&str, ';');
- } else {
- smart_str_appendc(&str, s[x]);
- }
- }
- smart_str_0(&str);
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = str.c;
- Z_STRLEN_P(value) = str.len;
-}
-
-static unsigned char hexchars[] = "0123456789ABCDEF";
-
-#define LOWALPHA "abcdefghijklmnopqrstuvwxyz"
-#define HIALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-#define DIGIT "0123456789"
-
-#define DEFAULT_URL_ENCODE LOWALPHA HIALPHA DIGIT "-._"
-
-static void php_filter_encode_url(zval *value, char* chars, int high, int low, int encode_nul)
-{
- register int x, y;
- unsigned char *str;
- int len = Z_STRLEN_P(value);
- char *s = Z_STRVAL_P(value);
-
- str = (unsigned char *) safe_emalloc(3, len, 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
-
- if ((strlen(chars) && !strchr(chars, str[y])) || (high && str[y] > 127) || (low && str[y] < 32) || (encode_nul && str[y] == 0)) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
- }
- }
- str[y] = '\0';
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = str;
- Z_STRLEN_P(value) = y;
-}
-
-static void php_filter_strip(zval *value, long flags)
-{
- unsigned char *buf, *str;
- int i, c;
-
- /* Optimization for if no strip flags are set */
- if (! ((flags & FILTER_FLAG_STRIP_LOW) || (flags & FILTER_FLAG_STRIP_HIGH)) ) {
- return;
- }
-
- str = Z_STRVAL_P(value);
- buf = safe_emalloc(1, Z_STRLEN_P(value) + 1, 1);
- c = 0;
- for (i = 0; i < Z_STRLEN_P(value); i++) {
- if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) {
- } else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) {
- } else {
- buf[c] = str[i];
- ++c;
- }
- }
- /* update zval string data */
- buf[c] = '\0';
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = buf;
- Z_STRLEN_P(value) = c;
-}
-/* }}} */
-
-/* {{{ FILTER MAP HELPERS */
-static void filter_map_init(filter_map *map)
-{
- memset(map, 0, sizeof(filter_map));
-}
-
-static void filter_map_update(filter_map *map, int flag, unsigned char *allowed_list)
-{
- int l, i;
-
- l = strlen(allowed_list);
- for (i = 0; i < l; ++i) {
- (*map)[allowed_list[i]] = flag;
- }
-}
-
-static void filter_map_apply(zval *value, filter_map *map)
-{
- unsigned char *buf, *str;
- int i, c;
-
- str = Z_STRVAL_P(value);
- buf = safe_emalloc(1, Z_STRLEN_P(value) + 1, 1);
- c = 0;
- for (i = 0; i < Z_STRLEN_P(value); i++) {
- if ((*map)[str[i]]) {
- buf[c] = str[i];
- ++c;
- }
- }
- /* update zval string data */
- buf[c] = '\0';
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = buf;
- Z_STRLEN_P(value) = c;
-}
-/* }}} */
-
-
-/* {{{ php_filter_string */
-void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
-{
- size_t new_len;
-
- /* strip tags, implicitly also removes \0 chars */
- new_len = php_strip_tags(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0);
- Z_STRLEN_P(value) = new_len;
-
- if (new_len == 0) {
- zval_dtor(value);
- Z_TYPE_P(value) = IS_NULL;
- return;
- }
-
- if (! (flags & FILTER_FLAG_NO_ENCODE_QUOTES)) {
- /* encode ' and " to numerical entity */
- php_filter_encode_html(value, "'\"", 0);
- }
- /* strip high/strip low ( see flags )*/
- php_filter_strip(value, flags);
-
- /* encode low/encode high flags */
- php_filter_encode_html_high_low(value, flags);
-
- /* also all the flags - & encode as %xx */
- if (flags & FILTER_FLAG_ENCODE_AMP) {
- php_filter_encode_html(value, "&", 0);
- }
-}
-/* }}} */
-
-/* {{{ php_filter_encoded */
-void php_filter_encoded(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* apply strip_high and strip_low filters */
- php_filter_strip(value, flags);
- /* urlencode */
- php_filter_encode_url(value, DEFAULT_URL_ENCODE, flags & FILTER_FLAG_ENCODE_HIGH, flags & FILTER_FLAG_ENCODE_LOW, 1);
-}
-/* }}} */
-
-/* {{{ php_filter_special_chars */
-void php_filter_special_chars(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* encodes ' " < > & \0 to numerical entities */
- php_filter_encode_html(value, "'\"<>&", 1);
- /* if strip low is not set, then we encode them as x; */
- php_filter_strip(value, flags);
- php_filter_encode_html_high_low(value, FILTER_FLAG_ENCODE_LOW | flags);
-}
-/* }}} */
-
-/* {{{ php_filter_unsafe_raw */
-void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* Only if no flags are set (optimization) */
- if (flags != 0 && Z_STRLEN_P(value) > 0) {
- php_filter_strip(value, flags);
- if (flags & FILTER_FLAG_ENCODE_AMP) {
- php_filter_encode_html(value, "&", 0);
- }
- php_filter_encode_html_high_low(value, flags);
- }
-}
-/* }}} */
-
-/* {{{ php_filter_email */
-#define SAFE "$-_.+"
-#define EXTRA "!*'(),"
-#define NATIONAL "{}|\\^~[]`"
-#define PUNCTUATION "<>#%\""
-#define RESERVED ";/?:@&="
-
-void php_filter_email(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* Check section 6 of rfc 822 http://www.faqs.org/rfcs/rfc822.html */
- unsigned char *allowed_list = LOWALPHA HIALPHA DIGIT "!#$%&'*+-/=?^_`{|}~@.[]";
- filter_map map;
-
- filter_map_init(&map);
- filter_map_update(&map, 1, allowed_list);
- filter_map_apply(value, &map);
-}
-/* }}} */
-
-/* {{{ php_filter_url */
-void php_filter_url(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* Strip all chars not part of section 5 of
- * http://www.faqs.org/rfcs/rfc1738.html */
- unsigned char *allowed_list = LOWALPHA HIALPHA DIGIT SAFE EXTRA NATIONAL PUNCTUATION RESERVED;
- filter_map map;
-
- filter_map_init(&map);
- filter_map_update(&map, 1, allowed_list);
- filter_map_apply(value, &map);
-}
-/* }}} */
-
-/* {{{ php_filter_number_int */
-void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* strip everything [^0-9+-] */
- unsigned char *allowed_list = "+-" DIGIT;
- filter_map map;
-
- filter_map_init(&map);
- filter_map_update(&map, 1, allowed_list);
- filter_map_apply(value, &map);
-}
-/* }}} */
-
-/* {{{ php_filter_number_float */
-void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL)
-{
- /* strip everything [^0-9+-] */
- unsigned char *allowed_list = "+-" DIGIT;
- filter_map map;
-
- filter_map_init(&map);
- filter_map_update(&map, 1, allowed_list);
-
- /* depending on flags, strip '.', 'e', ",", "'" */
- if (flags & FILTER_FLAG_ALLOW_FRACTION) {
- filter_map_update(&map, 2, ".");
- }
- if (flags & FILTER_FLAG_ALLOW_THOUSAND) {
- filter_map_update(&map, 3, ",");
- }
- if (flags & FILTER_FLAG_ALLOW_SCIENTIFIC) {
- filter_map_update(&map, 4, "eE");
- }
- filter_map_apply(value, &map);
-}
-/* }}} */
-
-/* {{{ php_filter_magic_quotes */
-void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL)
-{
- char *buf;
- int len;
-
- /* just call php_addslashes quotes */
- buf = php_addslashes(Z_STRVAL_P(value), Z_STRLEN_P(value), &len, 0 TSRMLS_CC);
-
- efree(Z_STRVAL_P(value));
- Z_STRVAL_P(value) = buf;
- Z_STRLEN_P(value) = len;
-}
-/* }}} */
-
-/*
- * 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/tests/001.phpt b/ext/filter/tests/001.phpt
deleted file mode 100644
index 2755a57363b4e..0000000000000
--- a/ext/filter/tests/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Simple GET test
---GET--
-a=1
---FILE--
-
---EXPECT--
-1
diff --git a/ext/filter/tests/002.phpt b/ext/filter/tests/002.phpt
deleted file mode 100644
index 7136b251a6fd5..0000000000000
--- a/ext/filter/tests/002.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-GET test with 2 values and an empty one
---GET--
-a=1&b=&c=3
---FILE--
-
---EXPECT--
-13
diff --git a/ext/filter/tests/003.phpt b/ext/filter/tests/003.phpt
deleted file mode 100644
index 43e6cd9b03c07..0000000000000
--- 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--
-
---EXPECT--
-1345
-1345
diff --git a/ext/filter/tests/004.phpt b/ext/filter/tests/004.phpt
deleted file mode 100644
index 05ea95214539c..0000000000000
--- a/ext/filter/tests/004.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-GET/POST/REQUEST Test with filtered data
---INI--
-filter.default=special_chars
---POST--
-d="quotes"&e=\slash
---GET--
-a=O'Henry&b=&c=Bold
---FILE--
-
---EXPECT--
-O'HenryBold"quotes"\slash
-O'HenryBold"quotes"\slash
diff --git a/ext/filter/tests/005.phpt b/ext/filter/tests/005.phpt
deleted file mode 100644
index f44379153ea7f..0000000000000
--- a/ext/filter/tests/005.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-GET/REQUEST Test with fifa example data
---INI--
-filter.default=stripped
---GET--
-id=f03_photos&pgurl=http%3A//fifaworldcup.yahoo.com/03/en/photozone/index.html
---FILE--
-
---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 1f8717c184a6d..0000000000000
--- a/ext/filter/tests/006.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-filter() test
---POST--
-foo=abc
---FILE--
-
---EXPECT--
-abc
diff --git a/ext/filter/tests/007.phpt b/ext/filter/tests/007.phpt
deleted file mode 100644
index ffc727801d926..0000000000000
--- a/ext/filter/tests/007.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-input_has_variable()
---GET--
-a=qwe&abc=href
---POST--
-b=qwe&bbc=href
---FILE--
-
---EXPECTF--
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-PHP Warning: input_has_variable() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: input_has_variable() expects parameter 2 to be string, array given in %s on line %d
-NULL
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-PHP Warning: input_has_variable() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: input_has_variable() expects parameter 2 to be string, array given in %s on line %d
-NULL
-bool(false)
-PHP Warning: input_has_variable() expects parameter 1 to be long, string given in %s on line %d
-
-Warning: input_has_variable() expects parameter 1 to be long, string given in %s on line %d
-NULL
-PHP Warning: input_has_variable() expects parameter 1 to be long, array given in %s on line %d
-
-Warning: input_has_variable() expects parameter 1 to be long, array given in %s on line %d
-NULL
-PHP Warning: input_has_variable() expects parameter 1 to be long, array given in %s on line %d
-
-Warning: input_has_variable() expects parameter 1 to be long, array given in %s on line %d
-NULL
-PHP Warning: input_has_variable() expects parameter 1 to be long, string given in %s on line %d
-
-Warning: input_has_variable() expects parameter 1 to be long, string given in %s on line %d
-NULL
-Done
diff --git a/ext/filter/tests/008.phpt b/ext/filter/tests/008.phpt
deleted file mode 100644
index eb6963c09925b..0000000000000
--- a/ext/filter/tests/008.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-input_filters_list()
---FILE--
-
---EXPECTF--
-array(18) {
- [0]=>
- string(3) "int"
- [1]=>
- string(7) "boolean"
- [2]=>
- string(5) "float"
- [3]=>
- string(15) "validate_regexp"
- [4]=>
- string(12) "validate_url"
- [5]=>
- string(14) "validate_email"
- [6]=>
- string(11) "validate_ip"
- [7]=>
- string(6) "string"
- [8]=>
- string(8) "stripped"
- [9]=>
- string(7) "encoded"
- [10]=>
- string(13) "special_chars"
- [11]=>
- string(10) "unsafe_raw"
- [12]=>
- string(5) "email"
- [13]=>
- string(3) "url"
- [14]=>
- string(10) "number_int"
- [15]=>
- string(12) "number_float"
- [16]=>
- string(12) "magic_quotes"
- [17]=>
- string(8) "callback"
-}
-array(18) {
- [0]=>
- string(3) "int"
- [1]=>
- string(7) "boolean"
- [2]=>
- string(5) "float"
- [3]=>
- string(15) "validate_regexp"
- [4]=>
- string(12) "validate_url"
- [5]=>
- string(14) "validate_email"
- [6]=>
- string(11) "validate_ip"
- [7]=>
- string(6) "string"
- [8]=>
- string(8) "stripped"
- [9]=>
- string(7) "encoded"
- [10]=>
- string(13) "special_chars"
- [11]=>
- string(10) "unsafe_raw"
- [12]=>
- string(5) "email"
- [13]=>
- string(3) "url"
- [14]=>
- string(10) "number_int"
- [15]=>
- string(12) "number_float"
- [16]=>
- string(12) "magic_quotes"
- [17]=>
- string(8) "callback"
-}
-Done
diff --git a/ext/filter/tests/009.phpt b/ext/filter/tests/009.phpt
deleted file mode 100644
index c33fe8ae365b6..0000000000000
--- a/ext/filter/tests/009.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-input_name_to_filter()
---FILE--
-
---EXPECTF--
-int(513)
-int(513)
-int(518)
-int(257)
-NULL
-
-Warning: input_name_to_filter() expects parameter 1 to be string, array given in %s on line %d
-NULL
-NULL
-
-Warning: input_name_to_filter() expects exactly 1 parameter, 3 given in %s on line %d
-NULL
-Done
diff --git a/ext/filter/tests/010.phpt b/ext/filter/tests/010.phpt
deleted file mode 100644
index aae5bc43f43c4..0000000000000
--- a/ext/filter/tests/010.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-filter_data()
---FILE--
-
---EXPECTF--
-array(7) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- int(0)
- [3]=>
- int(-23234)
- [4]=>
- NULL
- [5]=>
- NULL
- [6]=>
- array(0) {
- }
-}
-array(7) {
- [0]=>
- float(1.2)
- [1]=>
- float(1.7)
- [2]=>
- float(0)
- [3]=>
- float(-23234.123)
- [4]=>
- NULL
- [5]=>
- NULL
- [6]=>
- array(0) {
- }
-}
-
-Warning: filter_data() expects parameter 2 to be long, array given in %s on line %d
-NULL
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-string(1) "1"
-Done
diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt
deleted file mode 100644
index a2e4b5b62c5c9..0000000000000
--- a/ext/filter/tests/011.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-input_get()
---GET--
-a=test&b=http://example.com
---POST--
-c=string
&d=12345.7
---FILE--
-
---EXPECTF--
-string(4) "test"
-string(18) "http://example.com"
-string(27) "<b>test</b>"
-NULL
-string(6) "string"
-float(12345.7)
-string(29) "<p>string</p>"
-NULL
-PHP Warning: input_get() expects parameter 1 to be long, object given in %s on line %d
-
-Warning: input_get() expects parameter 1 to be long, object given in %s on line %d
-NULL
-PHP Warning: input_get() expects parameter 3 to be long, string given in %s on line %d
-
-Warning: input_get() expects parameter 3 to be long, string given in %s on line %d
-NULL
-PHP Warning: input_get() expects parameter 1 to be long, string given in %s on line %d
-
-Warning: input_get() expects parameter 1 to be long, string given in %s on line %d
-NULL
-bool(false)
-Done
diff --git a/ext/filter/tests/012.phpt b/ext/filter/tests/012.phpt
deleted file mode 100644
index 77c18801376b2..0000000000000
--- a/ext/filter/tests/012.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-input_get()
---FILE--
-
---EXPECT--
-bool(false)
-bool(false)
-bool(false)
-Done
diff --git a/ext/filter/tests/013.phpt b/ext/filter/tests/013.phpt
deleted file mode 100644
index c1c420549c22f..0000000000000
--- a/ext/filter/tests/013.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-filter_data() and flags
---FILE--
-FILTER_FLAG_ALLOW_HEX)));
-var_dump(filter_data("07", FL_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL)));
-var_dump(filter_data("0xff0000", FL_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX)));
-var_dump(filter_data("0666", FL_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL)));
-
-var_dump(filter_data("6", FL_INT, array("min_range"=>1, "max_range"=>7)));
-var_dump(filter_data("6", FL_INT, array("min_range"=>0, "max_range"=>5)));
-var_dump(filter_data(-1, FL_INT, array("min_range"=>1, "max_range"=>7)));
-var_dump(filter_data(-1, FL_INT, array("min_range"=>-4, "max_range"=>7)));
-
-var_dump(filter_data("", FL_INT, array("min_range"=>-4, "max_range"=>7)));
-var_dump(filter_data("", FL_INT, array("min_range"=>2, "max_range"=>7)));
-var_dump(filter_data("", FL_INT, array("min_range"=>-5, "max_range"=>-3)));
-var_dump(filter_data(345, FL_INT, array("min_range"=>500, "max_range"=>100)));
-var_dump(filter_data("0ff", FL_INT));
-var_dump(filter_data("010", FL_INT));
-
-echo "Done\n";
-?>
---EXPECT--
-int(255)
-int(7)
-int(16711680)
-int(438)
-int(6)
-NULL
-NULL
-int(-1)
-int(0)
-NULL
-NULL
-NULL
-NULL
-NULL
-Done
diff --git a/ext/filter/tests/014.phpt b/ext/filter/tests/014.phpt
deleted file mode 100644
index 2a8cae69d98e0..0000000000000
--- a/ext/filter/tests/014.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-filter_data() and FL_BOOLEAN
---FILE--
-
---EXPECTF--
-bool(false)
-
-Notice: Object of class stdClass to string conversion in %s on line %d
-NULL
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-NULL
-bool(false)
-NULL
-NULL
-NULL
-Done
diff --git a/ext/filter/tests/015.phpt b/ext/filter/tests/015.phpt
deleted file mode 100644
index 92376c3e5fe55..0000000000000
--- a/ext/filter/tests/015.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-filter_data() and FL_URL
---FILE--
-
---EXPECTF--
-string(29) "http://example.com/index.html"
-string(32) "http://www.example.com/index.php"
-string(31) "http://www.example/img/test.png"
-string(27) "http://www.example/img/dir/"
-string(26) "http://www.example/img/dir"
-string(28) "http//www.example/wrong/url/"
-string(17) "http:/www.example"
-string(18) "file:///tmp/test.c"
-string(26) "ftp://ftp.example.com/tmp/"
-string(11) "/tmp/test.c"
-string(1) "/"
-NULL
-string(6) "http:/"
-string(5) "http:"
-string(4) "http"
-string(0) ""
-string(2) "-1"
-array(0) {
-}
-NULL
-string(10) "http://qwe"
-NULL
-NULL
-string(22) "http://www.example.com"
-NULL
-string(42) "http://www.example.com/path/at/the/server/"
-NULL
-string(40) "http://www.example.com/index.php?a=b&c=d"
-Done
diff --git a/ext/filter/tests/016.phpt b/ext/filter/tests/016.phpt
deleted file mode 100644
index a99f25d4a2f69..0000000000000
--- a/ext/filter/tests/016.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-filter_data() and FL_EMAIL
---FILE--
-
---EXPECT--
-string(5) "a@b.c"
-string(17) "abuse@example.com"
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-string(57) "QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET"
-Done
diff --git a/ext/filter/tests/017.phpt b/ext/filter/tests/017.phpt
deleted file mode 100644
index 214f710d20b0c..0000000000000
--- a/ext/filter/tests/017.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-filter_data() and FL_REGEXP
---FILE--
-'/.*/')));
-var_dump(filter_data("data", FL_REGEXP, array("regexp"=>'/^b(.*)/')));
-var_dump(filter_data("data", FL_REGEXP, array("regexp"=>'/^d(.*)/')));
-var_dump(filter_data("data", FL_REGEXP, array("regexp"=>'blah')));
-var_dump(filter_data("data", FL_REGEXP, array("regexp"=>'[')));
-var_dump(filter_data("data", FL_REGEXP));
-
-echo "Done\n";
-?>
---EXPECTF--
-string(4) "data"
-NULL
-string(4) "data"
-NULL
-NULL
-
-Warning: filter_data(): 'regexp' option missing in %s on line %d
-NULL
-Done
diff --git a/ext/filter/tests/018.phpt b/ext/filter/tests/018.phpt
deleted file mode 100644
index 729a1fec0d360..0000000000000
--- a/ext/filter/tests/018.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-filter_data() and FL_IP
---FILE--
-
---EXPECT--
-string(11) "192.168.0.1"
-NULL
-string(3) "::1"
-string(7) "fe00::0"
-NULL
-NULL
-string(9) "127.0.0.1"
-NULL
-string(12) "192.0.34.166"
-string(9) "127.0.0.1"
-string(9) "192.0.0.1"
-string(12) "192.0.34.166"
-NULL
-string(15) "255.255.255.255"
-NULL
-NULL
-NULL
-NULL
-NULL
-string(3) "::1"
-string(9) "127.0.0.1"
-Done
diff --git a/ext/filter/tests/019.phpt b/ext/filter/tests/019.phpt
deleted file mode 100644
index 0a78265941274..0000000000000
--- a/ext/filter/tests/019.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-filter_data() & FL_IP and weird data
---FILE--
-
---EXPECTF--
-NULL
-NULL
-NULL
-NULL
-string(7) "1.1.1.1"
-Done
diff --git a/ext/filter/tests/020.phpt b/ext/filter/tests/020.phpt
deleted file mode 100644
index 8b88d89290aa8..0000000000000
--- a/ext/filter/tests/020.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-filter_data() and FS_MAGIC_QUOTES
---FILE--
-
---EXPECT--
-string(36) "test\'asd\'asd\'\' asd\\\'\"asdfasdf"
-string(2) "\'"
-string(0) ""
-string(2) "-1"
-Done
diff --git a/ext/filter/tests/021.phpt b/ext/filter/tests/021.phpt
deleted file mode 100644
index 519690a799125..0000000000000
--- a/ext/filter/tests/021.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-filter_data() and FS_NUMBER_*
---FILE--
-
---EXPECT--
-string(6) "123456"
-string(11) "12312312323"
-string(5) "12323"
-string(0) ""
-string(1) "0"
-string(4) "1232"
-string(0) ""
-string(5) "123.4"
-string(4) "1234"
-string(4) "1234"
-string(5) "123,4"
-string(5) "1234e"
-string(5) "1234E"
-string(4) "1234"
-string(8) "65456.34"
-string(6) "234.56"
-string(0) ""
-Done
diff --git a/ext/filter/tests/022.phpt b/ext/filter/tests/022.phpt
deleted file mode 100644
index 8f1fd1692cac3..0000000000000
--- a/ext/filter/tests/022.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-filter_data() and FS_EMAIL
---FILE--
-
---EXPECTF--
-string(5) "a@b.c"
-string(30) "a[!@#$%^&*@a@#$%^&*.com@#$%^&*"
-string(21) "whitespaceheresommore"
-string(0) ""
-string(15) "123456789000000"
-Done
diff --git a/ext/filter/tests/023.phpt b/ext/filter/tests/023.phpt
deleted file mode 100644
index d8abbd7c0a0dc..0000000000000
--- a/ext/filter/tests/023.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-filter_data() and FS_UNSAFE_RAW
---FILE--
-test para
", FS_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP));
-var_dump(filter_data("a[!@#$%^&*()@a@#$%^&*(.
com@#$%^&*(", FS_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP));
-var_dump(filter_data("white space here \ \ \" some more", FS_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP));
-var_dump(filter_data("", FS_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP));
-var_dump(filter_data(" 123456789000000 ", FS_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP));
-
-echo "Done\n";
-?>
---EXPECT--
-string(18) "}"test para
"
-string(53) "a[!@#$%^&*()@a@#$%^&*(.
com@#$%^&*("
-string(32) "white space here \ \ " some more"
-string(0) ""
-string(48) " 123456789000000 "
-Done
diff --git a/ext/filter/tests/024.phpt b/ext/filter/tests/024.phpt
deleted file mode 100644
index d2caaa9af38f8..0000000000000
--- a/ext/filter/tests/024.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-filter_data() and FS_ENCODED
---FILE--
-blah", FS_ENCODED));
-var_dump(filter_data("", FS_ENCODED));
-var_dump(filter_data(" text here ", FS_ENCODED));
-var_dump(filter_data("!@#$%^&*()QWERTYUIOP{ASDFGHJKL:\"ZXCVBNM<>?", FS_ENCODED));
-
-echo "Done\n";
-?>
---EXPECT--
-string(26) "%22%3Cbr%3Eblah%3C%2Fph%3E"
-string(0) ""
-string(23) "%20%20text%20here%20%20"
-string(74) "%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOP%7BASDFGHJKL%3A%22ZXCVBNM%3C%3E%3F"
-Done
diff --git a/ext/filter/tests/025.phpt b/ext/filter/tests/025.phpt
deleted file mode 100644
index 0c24c8d6c1cc2..0000000000000
--- a/ext/filter/tests/025.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-filter_data() and FS_STRING
---FILE--
-", FS_STRING));
-var_dump(filter_data("<>!@#$%^&*()'\"", FS_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
-var_dump(filter_data("<>!@#$%^&*()'\"", FS_STRING, FILTER_FLAG_ENCODE_AMP));
-var_dump(filter_data("<>`1234567890", FS_STRING));
-var_dump(filter_data("`123`", FS_STRING));
-var_dump(filter_data(".", FS_STRING));
-
-echo "Done\n";
-?>
---EXPECT--
-NULL
-NULL
-string(12) "!@#$%^&*()'""
-string(32) "!@#$%^&*()'""
-string(11) "`1234567890"
-string(5) "`123`"
-string(1) "."
-Done
diff --git a/ext/filter/tests/026.phpt b/ext/filter/tests/026.phpt
deleted file mode 100644
index 5f34831a5db64..0000000000000
--- a/ext/filter/tests/026.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-filter_data() and FS_STRIPPED
---FILE--
-Let me see you
Stripped down to the bone", FS_STRIPPED));
-var_dump(filter_data("!@#$%^&*()><<>+_\"'
", FS_STRIPPED));
-var_dump(filter_data("", FS_STRIPPED));
-
-var_dump(filter_data("Let me see you
Stripped down to the bone
", FS_STRIPPED, FILTER_FLAG_STRIP_LOW));
-var_dump(filter_data("!@#$%^&*()><<>+_\"'
", FS_STRIPPED, FILTER_FLAG_STRIP_LOW));
-var_dump(filter_data("", FS_STRIPPED, FILTER_FLAG_STRIP_LOW));
-
-var_dump(filter_data("Let me see you
Stripped down to the bone
", FS_STRIPPED, FILTER_FLAG_STRIP_HIGH));
-var_dump(filter_data("!@#$%^&*()><<>+_\"'
", FS_STRIPPED, FILTER_FLAG_STRIP_HIGH));
-var_dump(filter_data("", FS_STRIPPED, FILTER_FLAG_STRIP_HIGH));
-
-echo "Done\n";
-?>
---EXPECTF--
-string(40) "Let me see you Stripped down to the bone"
-string(11) "!@#$%^&*()>"
-NULL
-string(40) "Let me see you Stripped down to the bone"
-string(11) "!@#$%^&*()>"
-NULL
-string(40) "Let me see you Stripped down to the bone"
-string(11) "!@#$%^&*()>"
-NULL
-Done
diff --git a/ext/filter/tests/027.phpt b/ext/filter/tests/027.phpt
deleted file mode 100644
index fd84801fe4886..0000000000000
--- a/ext/filter/tests/027.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-filter_data() and FS_ENCODED
---FILE--
-", FS_ENCODED));
-var_dump(filter_data("", FS_ENCODED));
-
-var_dump(filter_data("?>", FS_ENCODED, FILTER_FLAG_ENCODE_LOW));
-var_dump(filter_data("", FS_ENCODED, FILTER_FLAG_ENCODE_LOW));
-
-var_dump(filter_data("?>", FS_ENCODED, FILTER_FLAG_ENCODE_HIGH));
-var_dump(filter_data("", FS_ENCODED, FILTER_FLAG_ENCODE_HIGH));
-
-echo "Done\n";
-?>
---EXPECT--
-string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn"
-string(17) "%3Cdata%26sons%3E"
-string(0) ""
-string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn"
-string(17) "%3Cdata%26sons%3E"
-string(0) ""
-string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn"
-string(17) "%3Cdata%26sons%3E"
-string(0) ""
-Done
diff --git a/ext/filter/tests/028.phpt b/ext/filter/tests/028.phpt
deleted file mode 100644
index 89830cb231f1e..0000000000000
--- a/ext/filter/tests/028.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-filter_data() and FS_SPECIAL_CHARS
---FILE--
-", FS_SPECIAL_CHARS));
-var_dump(filter_data("", FS_SPECIAL_CHARS));
-
-var_dump(filter_data("?>", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW));
-var_dump(filter_data("", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW));
-
-var_dump(filter_data("?>", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH));
-var_dump(filter_data("", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH));
-
-var_dump(filter_data("кириллица", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH));
-var_dump(filter_data("кириллица", FS_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW));
-
-echo "Done\n";
-?>
---EXPECT--
-string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn"
-string(23) "<data&sons>"
-string(0) ""
-string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn"
-string(23) "<data&sons>"
-string(0) ""
-string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn"
-string(23) "<data&sons>"
-string(0) ""
-string(108) "киÑиллиÑа"
-string(18) "кириллица"
-Done
diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt
deleted file mode 100644
index 126cff8cf9310..0000000000000
--- a/ext/filter/tests/029.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-filter_data() and FC_CALLBACK
---FILE--
->?\"}{:", FC_CALLBACK, "test"));
-var_dump(filter_data("", FC_CALLBACK, "test"));
-var_dump(filter_data("qwe", FC_CALLBACK, "no such func"));
-var_dump(filter_data("qwe", FC_CALLBACK, ""));
-var_dump(filter_data("qwe", FC_CALLBACK));
-
-/* Simple class method callback */
-class test_class {
- static function test ($var) {
- return strtolower($var);
- }
-}
-
-var_dump(filter_data("dAtA", FC_CALLBACK, array("test_class", "test")));
-var_dump(filter_data("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FC_CALLBACK, array("test_class","test")));
-var_dump(filter_data("", FC_CALLBACK, array("test_class","test")));
-
-/* empty function without return value */
-function test1($var) {
-}
-
-var_dump(filter_data("data", FC_CALLBACK, "test1"));
-var_dump(filter_data("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FC_CALLBACK, "test1"));
-var_dump(filter_data("", FC_CALLBACK, "test1"));
-
-/* attempting to change data by reference */
-function test2(&$var) {
- $var = 1;
-}
-
-var_dump(filter_data("data", FC_CALLBACK, "test2"));
-var_dump(filter_data("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FC_CALLBACK, "test2"));
-var_dump(filter_data("", FC_CALLBACK, "test2"));
-
-/* unsetting data */
-function test3(&$var) {
- unset($var);
-}
-
-var_dump(filter_data("data", FC_CALLBACK, "test3"));
-var_dump(filter_data("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FC_CALLBACK, "test3"));
-var_dump(filter_data("", FC_CALLBACK, "test3"));
-
-/* unset data and return value */
-function test4(&$var) {
- unset($var);
- return 1;
-}
-
-var_dump(filter_data("data", FC_CALLBACK, "test4"));
-
-/* thrown exception in the callback */
-function test5(&$var) {
- throw new Exception("test");
-}
-
-try {
- var_dump(filter_data("data", FC_CALLBACK, "test5"));
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-echo "Done\n";
-?>
---EXPECTF--
-string(4) "DATA"
-string(46) "~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?"}{:"
-string(0) ""
-
-Warning: filter_data(): First argument is expected to be a valid callback in %s on line %d
-NULL
-
-Warning: filter_data(): First argument is expected to be a valid callback in %s on line %d
-NULL
-
-Warning: filter_data(): First argument is expected to be a valid callback in %s on line %d
-NULL
-string(4) "data"
-string(46) "~!@#$%^&*()_qwertyuiopasdfghjklzxcvbnm<>>?"}{:"
-string(0) ""
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-int(1)
-string(4) "test"
-Done
diff --git a/ext/filter/tests/filter_data.phpt b/ext/filter/tests/filter_data.phpt
deleted file mode 100644
index 281c85a94c7b8..0000000000000
--- a/ext/filter/tests/filter_data.phpt
+++ /dev/null
@@ -1,71 +0,0 @@
---TEST--
-Simple filter_data() tests
---FILE--
-
---EXPECT--
-int(-123)
-int(0)
-int(123)
-int(-123)
-int(0)
-int(123)
-int(0)
-
-float(-0.123)
-float(0)
-float(1.23)
-float(-1.23)
-float(0)
-float(1.23)
-float(0)
-
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(false)
diff --git a/ext/imap/imap.h b/ext/imap/imap.h
deleted file mode 100644
index 914d12831661d..0000000000000
--- 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/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 0607e91cc481b..0000000000000
--- 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
-#endif
-#include
-
-#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:
- */