diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-03-18 11:28:21 +0100 |
commit | 038ba12e8724d537040e88ec794354b0c063f0a6 (patch) | |
tree | a7181b4f4d10e3a154522d4b96fdf42f4597bf2a /ext/standard | |
parent | fd5a0b31640419ca63d1ddeaffd6d3cf2a741814 (diff) | |
download | php-038ba12e8724d537040e88ec794354b0c063f0a6.tar.gz |
Imported Upstream version 5.3.6upstream/5.3.6
Diffstat (limited to 'ext/standard')
144 files changed, 1266 insertions, 330 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index b477b8747..030bb0e4f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c 305570 2010-11-19 22:06:44Z felipe $ */ +/* $Id: array.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_ini.h" @@ -4048,10 +4048,10 @@ PHP_FUNCTION(array_product) return; } + ZVAL_LONG(return_value, 1); if (!zend_hash_num_elements(Z_ARRVAL_P(input))) { - RETURN_LONG(0); + return; } - ZVAL_LONG(return_value, 1); for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(input), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(input), (void **)&entry, &pos) == SUCCESS; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 1730e417b..778628613 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: assert.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: assert.c 306939 2011-01-01 02:19:59Z felipe $ */ /* {{{ includes */ #include "php.h" diff --git a/ext/standard/base64.c b/ext/standard/base64.c index f0b7a3e1a..7cd108b36 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: base64.c 305780 2010-11-26 21:00:03Z iliaa $ */ +/* $Id: base64.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <string.h> diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 89760959a..33ce1cb30 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: base64.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: base64.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef BASE64_H #define BASE64_H diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index f7c82dda5..de8a2cea7 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: basic_functions.c 308127 2011-02-08 16:29:34Z cataphract $ */ #include "php.h" #include "php_streams.h" @@ -1233,6 +1233,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1) ZEND_ARG_INFO(0, length) ZEND_ARG_INFO(0, delimiter) ZEND_ARG_INFO(0, enclosure) + ZEND_ARG_INFO(0, escape) ZEND_END_ARG_INFO() #if (!defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS) @@ -3648,7 +3649,9 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ php_register_url_stream_wrapper("php", &php_stream_php_wrapper TSRMLS_CC); php_register_url_stream_wrapper("file", &php_plain_files_wrapper TSRMLS_CC); +#ifdef HAVE_GLOB php_register_url_stream_wrapper("glob", &php_glob_stream_wrapper TSRMLS_CC); +#endif php_register_url_stream_wrapper("data", &php_stream_rfc2397_wrapper TSRMLS_CC); #ifndef PHP_CURL_URL_WRAPPERS php_register_url_stream_wrapper("http", &php_stream_http_wrapper TSRMLS_CC); diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index acd17e5b3..337b003bd 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: basic_functions.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef BASIC_FUNCTIONS_H #define BASIC_FUNCTIONS_H diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 9106727a0..9a3672d8c 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: browscap.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: browscap.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_browscap.h" diff --git a/ext/standard/config.w32 b/ext/standard/config.w32 index 44dea72d3..fc90d12b9 100644 --- a/ext/standard/config.w32 +++ b/ext/standard/config.w32 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32 291899 2009-12-09 00:20:14Z pajoye $ +// $Id: config.w32 306344 2010-12-13 18:43:10Z pajoye $ ARG_WITH("config-file-scan-dir", "Dir to check for additional php ini files", ""); @@ -21,7 +21,8 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \ php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \ user_filters.c uuencode.c filters.c proc_open.c \ streamsfuncs.c http.c flock_compat.c", false /* never shared */); - + PHP_INSTALL_HEADERS("", "ext/standard"); if (PHP_MBREGEX != "no") { CHECK_HEADER_ADD_INCLUDE("oniguruma.h", "CFLAGS_STANDARD", PHP_MBREGEX + ";ext\\mbstring\\oniguruma") } +PHP_INSTALL_HEADERS("", "ext/standard"); diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 1504dabcd..4390c42d6 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: crc32.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: crc32.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "basic_functions.h" diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h index 50ac1162d..48eb22e70 100644 --- a/ext/standard/crc32.h +++ b/ext/standard/crc32.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: crc32.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: crc32.h 306939 2011-01-01 02:19:59Z felipe $ */ /* * This code implements the AUTODIN II polynomial diff --git a/ext/standard/credits.c b/ext/standard/credits.c index 1e684f06e..21272edc1 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: credits.c 305420 2010-11-16 23:02:00Z felipe $ */ +/* $Id: credits.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "info.h" diff --git a/ext/standard/credits.h b/ext/standard/credits.h index 2451c7724..2aa2f8c39 100644 --- a/ext/standard/credits.h +++ b/ext/standard/credits.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: credits.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: credits.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef CREDITS_H #define CREDITS_H diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h index 056028253..ec233a273 100644 --- a/ext/standard/credits_ext.h +++ b/ext/standard/credits_ext.h @@ -59,7 +59,7 @@ CREDIT_LINE("PostgreSQL driver for PDO", "Edin Kadribasic, Ilia Alshanetsky"); CREDIT_LINE("PostgreSQL", "Jouni Ahto, Zeev Suraski, Yasuo Ohgaki, Chris Kings-Lynne"); CREDIT_LINE("Pspell", "Vlad Krupin"); CREDIT_LINE("Readline", "Thies C. Arntzen"); -CREDIT_LINE("Recode", "Kristian Köhntopp"); +CREDIT_LINE("Recode", "Kristian Koehntopp"); CREDIT_LINE("Reflection", "Marcus Boerger, Timm Friebe, George Schlossnagle, Andrei Zmievski, Johannes Schlueter"); CREDIT_LINE("Sessions", "Sascha Schumann, Andrei Zmievski"); CREDIT_LINE("Shared Memory Operations", "Slava Poliakov, Ilia Alshanetsky"); @@ -68,7 +68,7 @@ CREDIT_LINE("SNMP", "Rasmus Lerdorf, Harrie Hazewinkel, Mike Jackson, Steven Law CREDIT_LINE("SOAP", "Brad Lafountain, Shane Caraveo, Dmitry Stogov"); CREDIT_LINE("Sockets", "Chris Vandomelen, Sterling Hughes, Daniel Beulshausen, Jason Greene"); CREDIT_LINE("SPL", "Marcus Boerger, Etienne Kneuss"); -CREDIT_LINE("SQLite3", "Scott MacVicar"); +CREDIT_LINE("SQLite3", "Scott MacVicar, Ilia Alshanetsky"); CREDIT_LINE("SQLite 3.x driver for PDO", "Wez Furlong"); CREDIT_LINE("SQLite", "Wez Furlong, Tal Peer, Marcus Boerger, Ilia Alshanetsky"); CREDIT_LINE("Sybase-CT", "Zeev Suraski, Tom May, Timm Friebe"); diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index d2476ce7e..77e459d9f 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: crypt.c 300429 2010-06-14 09:56:50Z pajoye $ */ +/* $Id: crypt.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> diff --git a/ext/standard/css.c b/ext/standard/css.c index d4179538d..ad2b2d64e 100644 --- a/ext/standard/css.c +++ b/ext/standard/css.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: css.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: css.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "info.h" diff --git a/ext/standard/css.h b/ext/standard/css.h index d7cc796fc..8ac13a673 100644 --- a/ext/standard/css.h +++ b/ext/standard/css.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: css.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: css.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef CSS_H #define CSS_H diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c index be11cd02a..7547aabfc 100644 --- a/ext/standard/cyr_convert.c +++ b/ext/standard/cyr_convert.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cyr_convert.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: cyr_convert.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h index 3ff5c5904..fbe514a6e 100644 --- a/ext/standard/cyr_convert.h +++ b/ext/standard/cyr_convert.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cyr_convert.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: cyr_convert.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef CYR_CONVERT_H #define CYR_CONVERT_H diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 87fd1b674..9881df1fd 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: datetime.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: datetime.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "zend_operators.h" diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h index 0ac21ea91..fae5a9308 100644 --- a/ext/standard/datetime.h +++ b/ext/standard/datetime.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: datetime.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: datetime.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef DATETIME_H #define DATETIME_H diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 4acd8913f..6c93a1981 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: dir.c 306939 2011-01-01 02:19:59Z felipe $ */ /* {{{ includes/startup/misc */ diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 04990075c..79d0d20a1 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dl.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: dl.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "dl.h" diff --git a/ext/standard/dl.h b/ext/standard/dl.h index 6eb3fb632..c60550443 100644 --- a/ext/standard/dl.h +++ b/ext/standard/dl.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dl.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: dl.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef DL_H #define DL_H diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 685eb776b..0db3480e5 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dns.c 304301 2010-10-11 03:07:03Z cataphract $ */ +/* $Id: dns.c 306939 2011-01-01 02:19:59Z felipe $ */ /* {{{ includes */ #include "php.h" diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 713a8a09b..efe18e797 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ | Ilia Alshanetsky <iliaa@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: exec.c 296107 2010-03-12 10:28:59Z jani $ */ +/* $Id: exec.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdio.h> #include "php.h" diff --git a/ext/standard/exec.h b/ext/standard/exec.h index 18ba00836..a8e809df3 100644 --- a/ext/standard/exec.h +++ b/ext/standard/exec.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: exec.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: exec.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef EXEC_H #define EXEC_H diff --git a/ext/standard/file.c b/ext/standard/file.c index d4ccdf26b..3bf1c47bb 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: file.c 306939 2011-01-01 02:19:59Z felipe $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ diff --git a/ext/standard/file.h b/ext/standard/file.h index 8a6b4ed7e..b4c0e6287 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.h 305495 2010-11-18 12:10:17Z cataphract $ */ +/* $Id: file.h 306939 2011-01-01 02:19:59Z felipe $ */ /* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 841c4c76b..d961f0e65 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: filestat.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "safe_mode.h" diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 13ce8bf8b..4ffda5d51 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filters.c 298700 2010-04-28 14:10:01Z pajoye $ */ +/* $Id: filters.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_globals.h" diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c index 696e972a4..2c9bcdb22 100644 --- a/ext/standard/flock_compat.c +++ b/ext/standard/flock_compat.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: flock_compat.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: flock_compat.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include <errno.h> diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h index c7265fc2e..4d2ac3bb4 100644 --- a/ext/standard/flock_compat.h +++ b/ext/standard/flock_compat.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: flock_compat.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: flock_compat.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef FLOCK_COMPAT_H #define FLOCK_COMPAT_H diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index f253f8d94..78663bc5d 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c 305561 2010-11-19 16:36:10Z iliaa $ */ +/* $Id: formatted_print.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <math.h> /* modf() */ #include "php.h" diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 87e3e52e0..a7b8c846d 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fsock.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: fsock.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_globals.h" diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h index 377661300..08422c103 100644 --- a/ext/standard/fsock.h +++ b/ext/standard/fsock.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fsock.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: fsock.h 306939 2011-01-01 02:19:59Z felipe $ */ /* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */ diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 13e80a2ff..27eb839b4 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftok.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: ftok.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index f5885defb..b8f3fe100 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ | Sara Golemon <pollita@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: ftp_fopen_wrapper.c 305495 2010-11-18 12:10:17Z cataphract $ */ +/* $Id: ftp_fopen_wrapper.c 308734 2011-02-27 20:23:54Z cataphract $ */ #include "php.h" #include "php_globals.h" @@ -72,6 +72,12 @@ #define FTPS_ENCRYPT_DATA 1 #define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC) +typedef struct _php_ftp_dirstream_data { + php_stream *datastream; + php_stream *controlstream; + php_stream *dirstream; +} php_ftp_dirstream_data; + /* {{{ get_ftp_result */ static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC) @@ -97,14 +103,28 @@ static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *s */ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC) { - php_stream *controlstream = (php_stream *)stream->wrapperdata; + php_stream *controlstream = stream->wrapperthis; + int ret = 0; if (controlstream) { + if (strpbrk(stream->mode, "wa+")) { + char tmp_line[512]; + int result; + + /* For write modes close data stream first to signal EOF to server */ + result = GET_FTP_RESULT(controlstream); + if (result != 226 && result != 250) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "FTP server error %d:%s", result, tmp_line); + ret = EOF; + } + } + php_stream_write_string(controlstream, "QUIT\r\n"); php_stream_close(controlstream); - stream->wrapperdata = NULL; + stream->wrapperthis = NULL; } - return 0; + + return ret; } /* }}} */ @@ -513,7 +533,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_LVAL_PP(tmpzval)); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %d", Z_LVAL_PP(tmpzval)); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_LVAL_PP(tmpzval)); goto errexit; } } @@ -564,7 +584,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch } /* remember control stream */ - datastream->wrapperdata = (zval *)stream; + datastream->wrapperthis = stream; php_url_free(resource); return datastream; @@ -588,11 +608,13 @@ errexit: static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { php_stream_dirent *ent = (php_stream_dirent *)buf; - php_stream *innerstream = (php_stream *)stream->abstract; + php_stream *innerstream; size_t tmp_len; char *basename; size_t basename_len; + innerstream = ((php_ftp_dirstream_data *)stream->abstract)->datastream; + if (count != sizeof(php_stream_dirent)) { return 0; } @@ -636,13 +658,18 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count */ static int php_ftp_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC) { - php_stream *innerstream = (php_stream *)stream->abstract; + php_ftp_dirstream_data *data = stream->abstract; - if (innerstream->wrapperdata) { - php_stream_close((php_stream *)innerstream->wrapperdata); - innerstream->wrapperdata = NULL; + /* close control connection */ + if (data->controlstream) { + php_stream_close(data->controlstream); + data->controlstream = NULL; } - php_stream_close((php_stream *)stream->abstract); + /* close data connection */ + php_stream_close(data->datastream); + data->datastream = NULL; + + efree(data); stream->abstract = NULL; return 0; @@ -668,6 +695,7 @@ static php_stream_ops php_ftp_dirstream_ops = { php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream, *reuseid, *datastream = NULL; + php_ftp_dirstream_data *dirsdata; php_url *resource = NULL; int result = 0, use_ssl, use_ssl_on_data = 0; char *hoststart = NULL, tmp_line[512]; @@ -727,11 +755,14 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, cha goto opendir_errexit; } - /* remember control stream */ - datastream->wrapperdata = (zval *)stream; - php_url_free(resource); - return php_stream_alloc(&php_ftp_dirstream_ops, datastream, 0, mode); + + dirsdata = emalloc(sizeof *dirsdata); + dirsdata->datastream = datastream; + dirsdata->controlstream = stream; + dirsdata->dirstream = php_stream_alloc(&php_ftp_dirstream_ops, dirsdata, 0, mode); + + return dirsdata->dirstream; opendir_errexit: if (resource) { diff --git a/ext/standard/head.c b/ext/standard/head.c index 01dbe57c4..c29e95490 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: head.c 296107 2010-03-12 10:28:59Z jani $ */ +/* $Id: head.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdio.h> #include "php.h" diff --git a/ext/standard/head.h b/ext/standard/head.h index 7d7f6ca1c..5458e028a 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: head.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: head.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef HEAD_H #define HEAD_H diff --git a/ext/standard/html.c b/ext/standard/html.c index e5bb01303..a65456bf5 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.c 304404 2010-10-14 19:14:06Z cataphract $ */ +/* $Id: html.c 306939 2011-01-01 02:19:59Z felipe $ */ /* * HTML entity resources: diff --git a/ext/standard/html.h b/ext/standard/html.h index 86bae2d20..20256a3a5 100644 --- a/ext/standard/html.h +++ b/ext/standard/html.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: html.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef HTML_H #define HTML_H diff --git a/ext/standard/http.c b/ext/standard/http.c index 3f57bbeb5..5ddfbf055 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: http.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: http.c 307432 2011-01-13 07:27:46Z stas $ */ #include "php_http.h" #include "php_ini.h" diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 69b8bfa59..678e711f7 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -19,7 +19,7 @@ | Sara Golemon <pollita@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: http_fopen_wrapper.c 305495 2010-11-18 12:10:17Z cataphract $ */ +/* $Id: http_fopen_wrapper.c 307815 2011-01-28 10:33:47Z dmitry $ */ #include "php.h" #include "php_globals.h" @@ -202,7 +202,70 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, smart_str_appends(&header, resource->host); smart_str_appendc(&header, ':'); smart_str_append_unsigned(&header, resource->port); - smart_str_appendl(&header, " HTTP/1.0\r\n\r\n", sizeof(" HTTP/1.0\r\n\r\n")-1); + smart_str_appendl(&header, " HTTP/1.0\r\n", sizeof(" HTTP/1.0\r\n")-1); + + /* check if we have Proxy-Authorization header */ + if (context && php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS) { + char *s, *p; + + if (Z_TYPE_PP(tmpzval) == IS_ARRAY) { + HashPosition pos; + zval **tmpheader = NULL; + + for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(tmpzval), &pos); + SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(tmpzval), (void *)&tmpheader, &pos); + zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos)) { + if (Z_TYPE_PP(tmpheader) == IS_STRING) { + s = Z_STRVAL_PP(tmpheader); + do { + while (*s == ' ' || *s == '\t') s++; + p = s; + while (*p != 0 && *p != ':' && *p != '\r' && *p !='\n') p++; + if (*p == ':') { + p++; + if (p - s == sizeof("Proxy-Authorization:") - 1 && + zend_binary_strcasecmp(s, sizeof("Proxy-Authorization:") - 1, + "Proxy-Authorization:", sizeof("Proxy-Authorization:") - 1) == 0) { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + smart_str_appendl(&header, s, p - s); + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + goto finish; + } else { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + } + } + s = p; + while (*s == '\r' || *s == '\n') s++; + } while (*s != 0); + } + } + } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { + s = Z_STRVAL_PP(tmpzval); + do { + while (*s == ' ' || *s == '\t') s++; + p = s; + while (*p != 0 && *p != ':' && *p != '\r' && *p !='\n') p++; + if (*p == ':') { + p++; + if (p - s == sizeof("Proxy-Authorization:") - 1 && + zend_binary_strcasecmp(s, sizeof("Proxy-Authorization:") - 1, + "Proxy-Authorization:", sizeof("Proxy-Authorization:") - 1) == 0) { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + smart_str_appendl(&header, s, p - s); + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + goto finish; + } else { + while (*p != 0 && *p != '\r' && *p !='\n') p++; + } + } + s = p; + while (*s == '\r' || *s == '\n') s++; + } while (*s != 0); + } + } +finish: + smart_str_appendl(&header, "\r\n", sizeof("\r\n")-1); + if (php_stream_write(stream, header.c, header.len) != header.len) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Cannot connect to HTTPS server through proxy"); php_stream_close(stream); @@ -288,12 +351,12 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, if (!request_fulluri && context && php_stream_context_get_option(context, "http", "request_fulluri", &tmpzval) == SUCCESS) { - zval tmp = **tmpzval; + zval ztmp = **tmpzval; - zval_copy_ctor(&tmp); - convert_to_boolean(&tmp); - request_fulluri = Z_BVAL(tmp) ? 1 : 0; - zval_dtor(&tmp); + zval_copy_ctor(&ztmp); + convert_to_boolean(&ztmp); + request_fulluri = Z_BVAL(ztmp) ? 1 : 0; + zval_dtor(&ztmp); } if (request_fulluri) { @@ -359,9 +422,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, tmp = php_trim(Z_STRVAL_PP(tmpzval), Z_STRLEN_PP(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { + char *s; + if (!header_init) { /* Remove post headers for redirects */ int l = strlen(tmp); - char *s, *s2, *tmp_c = estrdup(tmp); + char *s2, *tmp_c = estrdup(tmp); php_strtolower(tmp_c, l); if ((s = strstr(tmp_c, "content-length:"))) { @@ -382,6 +447,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, tmp[s - tmp_c] = '\0'; } } + efree(tmp_c); tmp_c = php_trim(tmp, strlen(tmp), NULL, 0, NULL, 3 TSRMLS_CC); efree(tmp); @@ -392,24 +458,58 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, /* Make lowercase for easy comparison against 'standard' headers */ php_strtolower(tmp, strlen(tmp)); - if (strstr(tmp, "user-agent:")) { + if ((s = strstr(tmp, "user-agent:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_USER_AGENT; } - if (strstr(tmp, "host:")) { + if ((s = strstr(tmp, "host:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_HOST; } - if (strstr(tmp, "from:")) { + if ((s = strstr(tmp, "from:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_FROM; } - if (strstr(tmp, "authorization:")) { + if ((s = strstr(tmp, "authorization:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_AUTH; } - if (strstr(tmp, "content-length:")) { + if ((s = strstr(tmp, "content-length:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_CONTENT_LENGTH; } - if (strstr(tmp, "content-type:")) { + if ((s = strstr(tmp, "content-type:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { have_header |= HTTP_HEADER_TYPE; } + /* remove Proxy-Authorization header */ + if (use_proxy && use_ssl && (s = strstr(tmp, "proxy-authorization:")) && + (s == tmp || *(s-1) == '\r' || *(s-1) == '\n' || + *(s-1) == '\t' || *(s-1) == ' ')) { + char *p = s + sizeof("proxy-authorization:") - 1; + + while (s > tmp && (*(s-1) == ' ' || *(s-1) == '\t')) s--; + while (*p != 0 && *p != '\r' && *p != '\n') p++; + while (*p == '\r' || *p == '\n') p++; + if (*p == 0) { + if (s == tmp) { + efree(user_headers); + user_headers = NULL; + } else { + while (s > tmp && (*(s-1) == '\r' || *(s-1) == '\n')) s--; + user_headers[s - tmp] = 0; + } + } else { + memmove(user_headers + (s - tmp), user_headers + (p - tmp), strlen(p) + 1); + } + } + } if (tmp) { efree(tmp); @@ -543,10 +643,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, } if (header_init) { - zval *tmp; - MAKE_STD_ZVAL(tmp); - array_init(tmp); - ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", tmp); + zval *ztmp; + MAKE_STD_ZVAL(ztmp); + array_init(ztmp); + ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", ztmp); } { diff --git a/ext/standard/image.c b/ext/standard/image.c index 85b5cd067..9654ed7e5 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: image.c 300881 2010-06-30 12:21:35Z iliaa $ */ +/* $Id: image.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include <stdio.h> diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index e64365f3f..9e45e4915 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: incomplete_class.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: incomplete_class.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "basic_functions.h" diff --git a/ext/standard/info.c b/ext/standard/info.c index 631ab3487..f33e537e9 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c 299960 2010-05-30 07:46:45Z pajoye $ */ +/* $Id: info.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_ini.h" diff --git a/ext/standard/info.h b/ext/standard/info.h index 4eaf06e1f..977e305e1 100644 --- a/ext/standard/info.h +++ b/ext/standard/info.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: info.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef INFO_H #define INFO_H diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 5c11a4287..dafbfa5f7 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: iptc.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: iptc.c 306939 2011-01-01 02:19:59Z felipe $ */ /* * Functions to parse & compse IPTC data. diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index 9a48ff2ae..6db3f6fe4 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: lcg.c 293253 2010-01-08 09:43:14Z rasmus $ */ +/* $Id: lcg.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_lcg.h" diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 8a3b74702..a84b155f8 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hholzgra@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: levenshtein.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: levenshtein.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include <stdlib.h> diff --git a/ext/standard/link.c b/ext/standard/link.c index cb152ef6a..1f8be4c1b 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: link.c 305507 2010-11-18 15:22:22Z pajoye $ */ +/* $Id: link.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_filestat.h" diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index faf256c3b..143b5be4a 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: link_win32.c 303500 2010-09-18 14:54:40Z pajoye $ */ +/* $Id: link_win32.c 306939 2011-01-01 02:19:59Z felipe $ */ #ifdef PHP_WIN32 #include "php.h" diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 57f69919e..984b84e37 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mail.c 301396 2010-07-19 13:38:53Z aharvey $ */ +/* $Id: mail.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> #include <ctype.h> diff --git a/ext/standard/math.c b/ext/standard/math.c index 2376730a5..8333fe7c5 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c 301991 2010-08-08 15:45:02Z iliaa $ */ +/* $Id: math.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_math.h" diff --git a/ext/standard/md5.c b/ext/standard/md5.c index e84fe4b7e..b9c9b3ab8 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: md5.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: md5.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "md5.h" diff --git a/ext/standard/md5.h b/ext/standard/md5.h index b976752b7..6ffbc2fca 100644 --- a/ext/standard/md5.h +++ b/ext/standard/md5.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: md5.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: md5.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef MD5_H #define MD5_H diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index bf1067130..468f26758 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: metaphone.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: metaphone.c 306939 2011-01-01 02:19:59Z felipe $ */ /* Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com> diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 116fb02a1..92248a22e 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: microtime.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: microtime.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h index 419150d8b..b0019dbf9 100644 --- a/ext/standard/microtime.h +++ b/ext/standard/microtime.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: microtime.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: microtime.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef MICROTIME_H #define MICROTIME_H diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 602d298e4..9eca312a6 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Chris Schneider <cschneid@relog.ch> | +----------------------------------------------------------------------+ */ -/* $Id: pack.c 299279 2010-05-12 11:04:57Z dmitry $ */ +/* $Id: pack.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/pack.h b/ext/standard/pack.h index ba5899727..81c96dc9d 100644 --- a/ext/standard/pack.h +++ b/ext/standard/pack.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pack.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: pack.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PACK_H #define PACK_H diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index a1b323b08..09182dd7e 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pageinfo.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: pageinfo.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "pageinfo.h" diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h index 0405de23f..672179503 100644 --- a/ext/standard/pageinfo.h +++ b/ext/standard/pageinfo.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pageinfo.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: pageinfo.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PAGEINFO_H #define PAGEINFO_H diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index 92a4f2267..ddd267096 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_array.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_array.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_ARRAY_H #define PHP_ARRAY_H diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h index bf4de1a86..6cc5d76d3 100644 --- a/ext/standard/php_assert.h +++ b/ext/standard/php_assert.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_assert.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_assert.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_ASSERT_H #define PHP_ASSERT_H diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h index c26098a93..523b2de13 100644 --- a/ext/standard/php_browscap.h +++ b/ext/standard/php_browscap.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_browscap.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_browscap.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_BROWSCAP_H #define PHP_BROWSCAP_H diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h index c0dafe631..02c6d564d 100644 --- a/ext/standard/php_crypt.h +++ b/ext/standard/php_crypt.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_crypt.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_crypt.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_CRYPT_H #define PHP_CRYPT_H diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index 5e2d851de..08c713fe3 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -1,9 +1,9 @@ -/* $Id: php_crypt_r.c 300511 2010-06-17 10:22:03Z pajoye $ */ +/* $Id: php_crypt_r.c 306939 2011-01-01 02:19:59Z felipe $ */ /* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -94,7 +94,7 @@ void _crypt_extended_init_r(void) if (!initialized) { #ifdef PHP_WIN32 InterlockedIncrement(&initialized); -#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR >= 2)) +#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2)) __sync_fetch_and_add(&initialized, 1); #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ membar_producer(); diff --git a/ext/standard/php_crypt_r.h b/ext/standard/php_crypt_r.h index e5fbf2601..7c73718b2 100644 --- a/ext/standard/php_crypt_r.h +++ b/ext/standard/php_crypt_r.h @@ -1,9 +1,9 @@ -/* $Id: php_crypt_r.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_crypt_r.h 306939 2011-01-01 02:19:59Z felipe $ */ /* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h index 5e80f3e6d..a76615300 100644 --- a/ext/standard/php_dir.h +++ b/ext/standard/php_dir.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dir.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_dir.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_DIR_H #define PHP_DIR_H diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h index c5b84274b..e24caf538 100644 --- a/ext/standard/php_dns.h +++ b/ext/standard/php_dns.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dns.h 293211 2010-01-07 11:02:39Z sebastian $ */ +/* $Id: php_dns.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_DNS_H #define PHP_DNS_H diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h index 353c24e81..cf697593a 100644 --- a/ext/standard/php_ext_syslog.h +++ b/ext/standard/php_ext_syslog.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ext_syslog.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_ext_syslog.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_EXT_SYSLOG_H #define PHP_EXT_SYSLOG_H diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h index 7eee0fa2c..6103f2cb9 100644 --- a/ext/standard/php_filestat.h +++ b/ext/standard/php_filestat.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_filestat.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_filestat.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_FILESTAT_H #define PHP_FILESTAT_H diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 808a973a9..1360bab6c 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ | Hartmut Holzgraefe <hholzgra@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: php_fopen_wrapper.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_fopen_wrapper.c 307536 2011-01-17 13:44:54Z iliaa $ */ #include <stdio.h> #include <stdlib.h> @@ -257,6 +257,39 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch } else { fd = dup(STDERR_FILENO); } + } else if (!strncasecmp(path, "fd/", 3)) { + char *start, + *end; + long fildes_ori; + int dtablesize; + + start = &path[3]; + fildes_ori = strtol(start, &end, 10); + if (end == start || *end != '\0') { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "php://fd/ stream must be specified in the form php://fd/<orig fd>"); + return NULL; + } + +#if HAVE_UNISTD_H + dtablesize = getdtablesize(); +#else + dtablesize = INT_MAX; +#endif + + if (fildes_ori < 0 || fildes_ori >= dtablesize) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "The file descriptors must be non-negative numbers smaller than %d", dtablesize); + return NULL; + } + + fd = dup(fildes_ori); + if (fd == -1) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, + "Error duping file descriptor %ld; possibly it doesn't exist: " + "[%d]: %s", fildes_ori, errno, strerror(errno)); + return NULL; + } } else if (!strncasecmp(path, "filter/", 7)) { /* Save time/memory when chain isn't specified */ if (strchr(mode, 'r') || strchr(mode, '+')) { diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h index d9dee9494..96beaea30 100644 --- a/ext/standard/php_fopen_wrappers.h +++ b/ext/standard/php_fopen_wrappers.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_fopen_wrappers.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_fopen_wrappers.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_FOPEN_WRAPPERS_H #define PHP_FOPEN_WRAPPERS_H diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h index ac023b778..51860c809 100644 --- a/ext/standard/php_ftok.h +++ b/ext/standard/php_ftok.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ftok.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_ftok.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_FTOK_H #define PHP_FTOK_H diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h index f0ed15f20..7330248c0 100644 --- a/ext/standard/php_http.h +++ b/ext/standard/php_http.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_http.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_http.h 307432 2011-01-13 07:27:46Z stas $ */ #ifndef PHP_HTTP_H #define PHP_HTTP_H diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h index 093980ae0..ed52ec9c7 100644 --- a/ext/standard/php_image.h +++ b/ext/standard/php_image.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_image.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_image.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_IMAGE_H #define PHP_IMAGE_H diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index 3ec93c704..ed52210c2 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_incomplete_class.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_incomplete_class.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_INCOMPLETE_CLASS_H #define PHP_INCOMPLETE_CLASS_H diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h index e47753c09..859ad6862 100644 --- a/ext/standard/php_iptc.h +++ b/ext/standard/php_iptc.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_iptc.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_iptc.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_IPTC_H #define PHP_IPTC_H diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h index 8ccd218f8..7d57d69c2 100644 --- a/ext/standard/php_lcg.h +++ b/ext/standard/php_lcg.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_lcg.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_lcg.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_LCG_H #define PHP_LCG_H diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h index 916029da7..8126a6304 100644 --- a/ext/standard/php_link.h +++ b/ext/standard/php_link.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_link.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_link.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_LINK_H #define PHP_LINK_H diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h index e8d3875ec..8164af8ac 100644 --- a/ext/standard/php_mail.h +++ b/ext/standard/php_mail.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mail.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_mail.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_MAIL_H #define PHP_MAIL_H diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h index 1d124f0d0..77fe6540e 100644 --- a/ext/standard/php_math.h +++ b/ext/standard/php_math.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_math.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_math.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_MATH_H #define PHP_MATH_H diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h index da8c67b95..1067e8b77 100644 --- a/ext/standard/php_metaphone.h +++ b/ext/standard/php_metaphone.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_metaphone.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_metaphone.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_METAPHONE_H #define PHP_METAPHONE_H diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 887ac7058..9a0dceff4 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -20,7 +20,7 @@ | Based on code from: Shawn Cokus <Cokus@math.washington.edu> | +----------------------------------------------------------------------+ */ -/* $Id: php_rand.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_rand.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_RAND_H #define PHP_RAND_H diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 8dd964716..6b4c1a95c 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_smart_str.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_smart_str.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_SMART_STR_H #define PHP_SMART_STR_H diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h index c851fac39..98da8b564 100644 --- a/ext/standard/php_smart_str_public.h +++ b/ext/standard/php_smart_str_public.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_smart_str_public.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_smart_str_public.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_SMART_STR_PUBLIC_H #define PHP_SMART_STR_PUBLIC_H diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h index 447f6d7f1..7595d45ec 100644 --- a/ext/standard/php_standard.h +++ b/ext/standard/php_standard.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_standard.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_standard.h 306939 2011-01-01 02:19:59Z felipe $ */ #include "basic_functions.h" #include "php_math.h" diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index fd3c8b5e4..0901ec491 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_string.h 306939 2011-01-01 02:19:59Z felipe $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h index 550d4d545..c2e5aa90d 100644 --- a/ext/standard/php_type.h +++ b/ext/standard/php_type.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_type.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_type.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_TYPE_H #define PHP_TYPE_H diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h index d6432a6ce..7514ced0d 100644 --- a/ext/standard/php_uuencode.h +++ b/ext/standard/php_uuencode.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_uuencode.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_uuencode.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_UUENCODE_H #define PHP_UUENCODE_H diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 3dc23e164..94934183b 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_var.h 301144 2010-07-09 21:19:27Z scottmac $ */ +/* $Id: php_var.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_VAR_H #define PHP_VAR_H diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h index 6a91e6152..d3e9aee82 100644 --- a/ext/standard/php_versioning.h +++ b/ext/standard/php_versioning.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_versioning.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: php_versioning.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef PHP_VERSIONING_H #define PHP_VERSIONING_H diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 1aeea773c..ecf5e35d1 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: proc_open.c 303163 2010-09-08 08:34:57Z pajoye $ */ +/* $Id: proc_open.c 306939 2011-01-01 02:19:59Z felipe $ */ #if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h index 40249f211..3ff92eb73 100644 --- a/ext/standard/proc_open.h +++ b/ext/standard/proc_open.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: proc_open.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: proc_open.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifdef PHP_WIN32 typedef HANDLE php_file_descriptor_t; diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 056b2a463..e4caaa4f5 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: quot_print.c 305759 2010-11-25 21:38:06Z iliaa $ */ +/* $Id: quot_print.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h index 4a769e0dd..acbe736de 100644 --- a/ext/standard/quot_print.h +++ b/ext/standard/quot_print.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: quot_print.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: quot_print.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef QUOT_PRINT_H #define QUOT_PRINT_H diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 7660adadb..2be932046 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -23,7 +23,7 @@ | Shawn Cokus <Cokus@math.washington.edu> | +----------------------------------------------------------------------+ */ -/* $Id: rand.c 305754 2010-11-25 16:44:20Z cataphract $ */ +/* $Id: rand.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdlib.h> diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index dbfe83d59..161fd6d26 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: scanf.c 299484 2010-05-19 11:28:08Z mike $ */ +/* $Id: scanf.c 306939 2011-01-01 02:19:59Z felipe $ */ /* scanf.c -- diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 46243bd33..0d5858717 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: scanf.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: scanf.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef SCANF_H #define SCANF_H diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 084de7f1e..0a9447993 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sha1.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: sha1.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h index cd7e63106..9cfef1e64 100644 --- a/ext/standard/sha1.h +++ b/ext/standard/sha1.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sha1.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: sha1.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef SHA1_H #define SHA1_H diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c index d22d36191..0096a712c 100644 --- a/ext/standard/soundex.c +++ b/ext/standard/soundex.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> | +----------------------------------------------------------------------+ */ -/* $Id: soundex.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: soundex.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include <stdlib.h> diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 049af57bc..3a90b885b 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c 304384 2010-10-14 03:15:15Z cataphract $ */ +/* $Id: streamsfuncs.c 307922 2011-02-01 18:10:35Z cataphract $ */ #include "php.h" #include "php_globals.h" @@ -413,29 +413,36 @@ PHP_FUNCTION(stream_socket_recvfrom) Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */ PHP_FUNCTION(stream_get_contents) { - php_stream *stream; - zval *zsrc; - long maxlen = PHP_STREAM_COPY_ALL, pos = -1L; - int len, newlen; - char *contents = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &pos) == FAILURE) { + php_stream *stream; + zval *zsrc; + long maxlen = PHP_STREAM_COPY_ALL, + desiredpos = -1L; + int len, + newlen; + char *contents = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &zsrc); - if (pos >= 0) { - int seek_res = 0; - if (pos > stream->position) { + if (desiredpos >= 0) { + int seek_res = 0; + off_t position; + + position = php_stream_tell(stream); + if (position >= 0 && desiredpos > position) { /* use SEEK_CUR to allow emulation in streams that don't support seeking */ - seek_res = php_stream_seek(stream, pos - stream->position, SEEK_CUR); - } else if (pos < stream->position) { - seek_res = php_stream_seek(stream, pos, SEEK_SET); + seek_res = php_stream_seek(stream, desiredpos - position, SEEK_CUR); + } else if (desiredpos < position) { + /* desired position before position or error on tell */ + seek_res = php_stream_seek(stream, desiredpos, SEEK_SET); } if (seek_res != 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos); + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Failed to seek to position %ld in the stream", desiredpos); RETURN_FALSE; } } @@ -627,7 +634,7 @@ static int stream_array_to_fd_set(zval *stream_array, fd_set *fds, php_socket_t * when casting. It is only used here so that the buffered data warning * is not displayed. * */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) { + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { PHP_SAFE_FD_SET(this_fd, fds); @@ -667,7 +674,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) * when casting. It is only used here so that the buffered data warning * is not displayed. */ - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) { + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd != -1) { if (PHP_SAFE_FD_ISSET(this_fd, fds)) { zend_hash_next_index_insert(new_hash, (void *)elem, sizeof(zval *), (void **)&dest_elem); if (dest_elem) { diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h index 912efb33b..804501e99 100644 --- a/ext/standard/streamsfuncs.h +++ b/ext/standard/streamsfuncs.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.h 297895 2010-04-12 13:10:05Z pajoye $ */ +/* $Id: streamsfuncs.h 306939 2011-01-01 02:19:59Z felipe $ */ /* Flags for stream_socket_client */ #define PHP_STREAM_CLIENT_PERSISTENT 1 diff --git a/ext/standard/string.c b/ext/standard/string.c index 6c6f35a2e..a3a3c84e0 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c 305418 2010-11-16 22:16:44Z felipe $ */ +/* $Id: string.c 306939 2011-01-01 02:19:59Z felipe $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index 8208319dc..4cd54d687 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: syslog.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: syslog.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index 3a6cf216a..9250c03e1 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -25,7 +25,7 @@ foreach ($tests as $v) { --EXPECTF-- Warning: array_product() expects parameter 1 to be array, string given in %s on line %d NULL -int(0) +int(1) int(0) int(3) int(9) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 1c325b3fb..efd791ac9 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -25,7 +25,7 @@ foreach ($tests as $v) { --EXPECTF-- Warning: array_product() expects parameter 1 to be array, string given in %s on line %d NULL -int(0) +int(1) int(0) int(3) int(9) diff --git a/ext/standard/tests/array/bug48484.phpt b/ext/standard/tests/array/bug48484.phpt new file mode 100644 index 000000000..006c3cc98 --- /dev/null +++ b/ext/standard/tests/array/bug48484.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug 48484 (array_product() always returns 0 for an empty array) +--FILE-- +<?php +var_dump(array_product(array())); +?> +--EXPECT-- +int(1) +--TEST-- +Bug 48484 (array_product() always returns 0 for an empty array) +--FILE-- +<?php +var_dump(array_product(array())); +?> +--EXPECT-- +int(1) diff --git a/ext/standard/tests/file/php_fd_wrapper_01.phpt b/ext/standard/tests/file/php_fd_wrapper_01.phpt new file mode 100644 index 000000000..037edd7f6 --- /dev/null +++ b/ext/standard/tests/file/php_fd_wrapper_01.phpt @@ -0,0 +1,11 @@ +--TEST-- +php://fd wrapper: basic test +--FILE-- +<?php +$f = fopen("php://fd/1", "wb"); +fwrite($f, "hi!"); + +echo "\nDone.\n"; +--EXPECT-- +hi! +Done. diff --git a/ext/standard/tests/file/php_fd_wrapper_02.phpt b/ext/standard/tests/file/php_fd_wrapper_02.phpt new file mode 100644 index 000000000..6d40dc9ad --- /dev/null +++ b/ext/standard/tests/file/php_fd_wrapper_02.phpt @@ -0,0 +1,11 @@ +--TEST-- +php://fd wrapper: mode is ignored +--FILE-- +<?php +$f = fopen("php://fd/1", "rkkk"); +fwrite($f, "hi!"); + +echo "\nDone.\n"; +--EXPECT-- +hi! +Done. diff --git a/ext/standard/tests/file/php_fd_wrapper_03.phpt b/ext/standard/tests/file/php_fd_wrapper_03.phpt new file mode 100644 index 000000000..c004a4319 --- /dev/null +++ b/ext/standard/tests/file/php_fd_wrapper_03.phpt @@ -0,0 +1,22 @@ +--TEST-- +php://fd wrapper: bad syntax +--FILE-- +<?php +fopen("php://fd", "w"); +fopen("php://fd/", "w"); +fopen("php://fd/-2", "w"); +fopen("php://fd/1/", "w"); + +echo "\nDone.\n"; +--EXPECTF-- +Warning: fopen(): Invalid php:// URL specified in %s on line %d + +Warning: fopen(php://fd): failed to open stream: operation failed in %s on line 2 + +Warning: fopen(php://fd/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d + +Warning: fopen(php://fd/-2): failed to open stream: The file descriptors must be non-negative numbers smaller than %d in %s on line %d + +Warning: fopen(php://fd/1/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d + +Done. diff --git a/ext/standard/tests/file/php_fd_wrapper_04.phpt b/ext/standard/tests/file/php_fd_wrapper_04.phpt new file mode 100644 index 000000000..51f4d9f17 --- /dev/null +++ b/ext/standard/tests/file/php_fd_wrapper_04.phpt @@ -0,0 +1,20 @@ +--TEST-- +php://fd wrapper: invalid file descriptor +--SKIPIF-- +<?php include('skipif.inc'); +if(substr(PHP_OS, 0, 3) == "WIN") + die("skip Not for Windows"); + +//we'd need a release and a test variation for windows, because in debug builds we get this message: +//Warning: Invalid parameter detected in CRT function '_dup' (f:\dd\vctools\crt_bld\self_x86\crt\src\dup.c:52) +//I greped the CRT sources and found no function capable of validating a file descriptor + +--FILE-- +<?php +fopen("php://fd/12", "w"); + +echo "\nDone.\n"; +--EXPECTF-- +Warning: fopen(php://fd/12): failed to open stream: Error duping file descriptor 12; possibly it doesn't exist: [9]: %s in %s on line %d + +Done. diff --git a/ext/standard/tests/serialize/precision.phpt b/ext/standard/tests/serialize/precision.phpt new file mode 100644 index 000000000..142b2cecf --- /dev/null +++ b/ext/standard/tests/serialize/precision.phpt @@ -0,0 +1,49 @@ +--TEST-- +Default precision is sufficient to serialize all the information in floats +--SKIPIF-- +<?php +if (pack('s', 1) != "\x01\x00") + die("skip test for little-endian architectures"); +--FILE-- +<?php + +$numbers = array( + "0000000000000000", //0 + "2d431cebe2362a3f", //.0002 + "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01 + "0000000000001000", //2^-1022. (minimum normal double) + "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01 + "ffffffffffffef7f", //2^1024. (maximum normal double) + "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.] + "0100000000000000", //minumum subnormal double + "0200000000000000", //2nd minumum subnormal double + "fffffffffffff000", //maximum subnormal double + "fefffffffffff000", //2nd maximum subnormal double + "0000000000000f7f", //+inf + "0000000000000fff", //-inf +); + +foreach ($numbers as $ns) { + $num = unpack("d", pack("H*", $ns)); $num = reset($num); + echo "number: ", sprintf("%.17e", $num), "... "; + $num2 = unserialize(serialize($num)); + $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr); + if ($repr == $ns) + echo "OK\n"; + else + echo "mismatch\n\twas: $ns\n\tbecame: $repr\n"; +} +--EXPECT-- +number: 0.00000000000000000e+0... OK +number: 2.00000000000000010e-4... OK +number: 2.00000000000000037e-4... OK +number: 2.22507385850720138e-308... OK +number: 2.22507385850720188e-308... OK +number: 1.79769313486231571e+308... OK +number: 1.79769313486231551e+308... OK +number: 4.94065645841246544e-324... OK +number: 9.88131291682493088e-324... OK +number: 3.87340857288933536e-304... OK +number: 3.87340857288933455e-304... OK +number: 1.06293653832877718e+304... OK +number: -1.06293653832877718e+304... OK diff --git a/ext/standard/tests/streams/bug53903.phpt b/ext/standard/tests/streams/bug53903.phpt new file mode 100644 index 000000000..3b61635d7 --- /dev/null +++ b/ext/standard/tests/streams/bug53903.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #53903 streamwrapper/stream_stat causes problems +--FILE-- +<?php + +class sw { + + public function stream_open($path, $mode, $options, &$opened_path) { + return true; + } + + public function stream_stat() { + return array( + 'atime' => $this->undefined, + ); + } + +} +stream_wrapper_register('sx', 'sw') or die('failed'); + +fstat(fopen('sx://test', 'r')); + +$s[] = 1; // Cannot use a scalar value as an array + +print_r($s); +--EXPECTF-- +Notice: Undefined property: sw::$undefined in %s on line %d +Array +( + [0] => 1 +) + diff --git a/ext/standard/tests/strings/bug54055.phpt b/ext/standard/tests/strings/bug54055.phpt new file mode 100644 index 000000000..7124c4687 --- /dev/null +++ b/ext/standard/tests/strings/bug54055.phpt @@ -0,0 +1,589 @@ +--TEST-- +Bug #54055: PHP crashes when executing strval when precision setting is very high +--FILE-- +<?php +for($i = 495; $i <= 1074; $i++) { + ini_set('precision', $i); + echo "$i: len=", strlen(strval(-1 * pow(2, -1074))), "\n"; +} +--EXPECT-- +495: len=502 +496: len=503 +497: len=504 +498: len=505 +499: len=506 +500: len=507 +501: len=507 +502: len=507 +503: len=507 +504: len=507 +505: len=507 +506: len=507 +507: len=507 +508: len=507 +509: len=507 +510: len=507 +511: len=507 +512: len=507 +513: len=507 +514: len=507 +515: len=507 +516: len=507 +517: len=507 +518: len=507 +519: len=507 +520: len=507 +521: len=507 +522: len=507 +523: len=507 +524: len=507 +525: len=507 +526: len=507 +527: len=507 +528: len=507 +529: len=507 +530: len=507 +531: len=507 +532: len=507 +533: len=507 +534: len=507 +535: len=507 +536: len=507 +537: len=507 +538: len=507 +539: len=507 +540: len=507 +541: len=507 +542: len=507 +543: len=507 +544: len=507 +545: len=507 +546: len=507 +547: len=507 +548: len=507 +549: len=507 +550: len=507 +551: len=507 +552: len=507 +553: len=507 +554: len=507 +555: len=507 +556: len=507 +557: len=507 +558: len=507 +559: len=507 +560: len=507 +561: len=507 +562: len=507 +563: len=507 +564: len=507 +565: len=507 +566: len=507 +567: len=507 +568: len=507 +569: len=507 +570: len=507 +571: len=507 +572: len=507 +573: len=507 +574: len=507 +575: len=507 +576: len=507 +577: len=507 +578: len=507 +579: len=507 +580: len=507 +581: len=507 +582: len=507 +583: len=507 +584: len=507 +585: len=507 +586: len=507 +587: len=507 +588: len=507 +589: len=507 +590: len=507 +591: len=507 +592: len=507 +593: len=507 +594: len=507 +595: len=507 +596: len=507 +597: len=507 +598: len=507 +599: len=507 +600: len=507 +601: len=507 +602: len=507 +603: len=507 +604: len=507 +605: len=507 +606: len=507 +607: len=507 +608: len=507 +609: len=507 +610: len=507 +611: len=507 +612: len=507 +613: len=507 +614: len=507 +615: len=507 +616: len=507 +617: len=507 +618: len=507 +619: len=507 +620: len=507 +621: len=507 +622: len=507 +623: len=507 +624: len=507 +625: len=507 +626: len=507 +627: len=507 +628: len=507 +629: len=507 +630: len=507 +631: len=507 +632: len=507 +633: len=507 +634: len=507 +635: len=507 +636: len=507 +637: len=507 +638: len=507 +639: len=507 +640: len=507 +641: len=507 +642: len=507 +643: len=507 +644: len=507 +645: len=507 +646: len=507 +647: len=507 +648: len=507 +649: len=507 +650: len=507 +651: len=507 +652: len=507 +653: len=507 +654: len=507 +655: len=507 +656: len=507 +657: len=507 +658: len=507 +659: len=507 +660: len=507 +661: len=507 +662: len=507 +663: len=507 +664: len=507 +665: len=507 +666: len=507 +667: len=507 +668: len=507 +669: len=507 +670: len=507 +671: len=507 +672: len=507 +673: len=507 +674: len=507 +675: len=507 +676: len=507 +677: len=507 +678: len=507 +679: len=507 +680: len=507 +681: len=507 +682: len=507 +683: len=507 +684: len=507 +685: len=507 +686: len=507 +687: len=507 +688: len=507 +689: len=507 +690: len=507 +691: len=507 +692: len=507 +693: len=507 +694: len=507 +695: len=507 +696: len=507 +697: len=507 +698: len=507 +699: len=507 +700: len=507 +701: len=507 +702: len=507 +703: len=507 +704: len=507 +705: len=507 +706: len=507 +707: len=507 +708: len=507 +709: len=507 +710: len=507 +711: len=507 +712: len=507 +713: len=507 +714: len=507 +715: len=507 +716: len=507 +717: len=507 +718: len=507 +719: len=507 +720: len=507 +721: len=507 +722: len=507 +723: len=507 +724: len=507 +725: len=507 +726: len=507 +727: len=507 +728: len=507 +729: len=507 +730: len=507 +731: len=507 +732: len=507 +733: len=507 +734: len=507 +735: len=507 +736: len=507 +737: len=507 +738: len=507 +739: len=507 +740: len=507 +741: len=507 +742: len=507 +743: len=507 +744: len=507 +745: len=507 +746: len=507 +747: len=507 +748: len=507 +749: len=507 +750: len=507 +751: len=507 +752: len=507 +753: len=507 +754: len=507 +755: len=507 +756: len=507 +757: len=507 +758: len=507 +759: len=507 +760: len=507 +761: len=507 +762: len=507 +763: len=507 +764: len=507 +765: len=507 +766: len=507 +767: len=507 +768: len=507 +769: len=507 +770: len=507 +771: len=507 +772: len=507 +773: len=507 +774: len=507 +775: len=507 +776: len=507 +777: len=507 +778: len=507 +779: len=507 +780: len=507 +781: len=507 +782: len=507 +783: len=507 +784: len=507 +785: len=507 +786: len=507 +787: len=507 +788: len=507 +789: len=507 +790: len=507 +791: len=507 +792: len=507 +793: len=507 +794: len=507 +795: len=507 +796: len=507 +797: len=507 +798: len=507 +799: len=507 +800: len=507 +801: len=507 +802: len=507 +803: len=507 +804: len=507 +805: len=507 +806: len=507 +807: len=507 +808: len=507 +809: len=507 +810: len=507 +811: len=507 +812: len=507 +813: len=507 +814: len=507 +815: len=507 +816: len=507 +817: len=507 +818: len=507 +819: len=507 +820: len=507 +821: len=507 +822: len=507 +823: len=507 +824: len=507 +825: len=507 +826: len=507 +827: len=507 +828: len=507 +829: len=507 +830: len=507 +831: len=507 +832: len=507 +833: len=507 +834: len=507 +835: len=507 +836: len=507 +837: len=507 +838: len=507 +839: len=507 +840: len=507 +841: len=507 +842: len=507 +843: len=507 +844: len=507 +845: len=507 +846: len=507 +847: len=507 +848: len=507 +849: len=507 +850: len=507 +851: len=507 +852: len=507 +853: len=507 +854: len=507 +855: len=507 +856: len=507 +857: len=507 +858: len=507 +859: len=507 +860: len=507 +861: len=507 +862: len=507 +863: len=507 +864: len=507 +865: len=507 +866: len=507 +867: len=507 +868: len=507 +869: len=507 +870: len=507 +871: len=507 +872: len=507 +873: len=507 +874: len=507 +875: len=507 +876: len=507 +877: len=507 +878: len=507 +879: len=507 +880: len=507 +881: len=507 +882: len=507 +883: len=507 +884: len=507 +885: len=507 +886: len=507 +887: len=507 +888: len=507 +889: len=507 +890: len=507 +891: len=507 +892: len=507 +893: len=507 +894: len=507 +895: len=507 +896: len=507 +897: len=507 +898: len=507 +899: len=507 +900: len=507 +901: len=507 +902: len=507 +903: len=507 +904: len=507 +905: len=507 +906: len=507 +907: len=507 +908: len=507 +909: len=507 +910: len=507 +911: len=507 +912: len=507 +913: len=507 +914: len=507 +915: len=507 +916: len=507 +917: len=507 +918: len=507 +919: len=507 +920: len=507 +921: len=507 +922: len=507 +923: len=507 +924: len=507 +925: len=507 +926: len=507 +927: len=507 +928: len=507 +929: len=507 +930: len=507 +931: len=507 +932: len=507 +933: len=507 +934: len=507 +935: len=507 +936: len=507 +937: len=507 +938: len=507 +939: len=507 +940: len=507 +941: len=507 +942: len=507 +943: len=507 +944: len=507 +945: len=507 +946: len=507 +947: len=507 +948: len=507 +949: len=507 +950: len=507 +951: len=507 +952: len=507 +953: len=507 +954: len=507 +955: len=507 +956: len=507 +957: len=507 +958: len=507 +959: len=507 +960: len=507 +961: len=507 +962: len=507 +963: len=507 +964: len=507 +965: len=507 +966: len=507 +967: len=507 +968: len=507 +969: len=507 +970: len=507 +971: len=507 +972: len=507 +973: len=507 +974: len=507 +975: len=507 +976: len=507 +977: len=507 +978: len=507 +979: len=507 +980: len=507 +981: len=507 +982: len=507 +983: len=507 +984: len=507 +985: len=507 +986: len=507 +987: len=507 +988: len=507 +989: len=507 +990: len=507 +991: len=507 +992: len=507 +993: len=507 +994: len=507 +995: len=507 +996: len=507 +997: len=507 +998: len=507 +999: len=507 +1000: len=507 +1001: len=507 +1002: len=507 +1003: len=507 +1004: len=507 +1005: len=507 +1006: len=507 +1007: len=507 +1008: len=507 +1009: len=507 +1010: len=507 +1011: len=507 +1012: len=507 +1013: len=507 +1014: len=507 +1015: len=507 +1016: len=507 +1017: len=507 +1018: len=507 +1019: len=507 +1020: len=507 +1021: len=507 +1022: len=507 +1023: len=507 +1024: len=507 +1025: len=507 +1026: len=507 +1027: len=507 +1028: len=507 +1029: len=507 +1030: len=507 +1031: len=507 +1032: len=507 +1033: len=507 +1034: len=507 +1035: len=507 +1036: len=507 +1037: len=507 +1038: len=507 +1039: len=507 +1040: len=507 +1041: len=507 +1042: len=507 +1043: len=507 +1044: len=507 +1045: len=507 +1046: len=507 +1047: len=507 +1048: len=507 +1049: len=507 +1050: len=507 +1051: len=507 +1052: len=507 +1053: len=507 +1054: len=507 +1055: len=507 +1056: len=507 +1057: len=507 +1058: len=507 +1059: len=507 +1060: len=507 +1061: len=507 +1062: len=507 +1063: len=507 +1064: len=507 +1065: len=507 +1066: len=507 +1067: len=507 +1068: len=507 +1069: len=507 +1070: len=507 +1071: len=507 +1072: len=507 +1073: len=507 +1074: len=507 diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index b2ec7b3a8..d989d6a42 100755 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -670,8 +670,8 @@ Array *** Output for precision value more than maximum *** -Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of 40 digits in %s on line %d -12345678900.0000000000000000000000000000000000000000 +Notice: printf(): Requested precision of 988 digits was truncated to PHP maximum of 53 digits in %s on line %d +12345678900.00000000000000000000000000000000000000000000000000000 *** Output for invalid width(-15) specifier *** 15s diff --git a/ext/standard/tests/strings/sprintf_variation52.phpt b/ext/standard/tests/strings/sprintf_variation52.phpt index 6155c9ec5..996434fef 100644 --- a/ext/standard/tests/strings/sprintf_variation52.phpt +++ b/ext/standard/tests/strings/sprintf_variation52.phpt @@ -48,7 +48,7 @@ string(1) "%" -- Testing for precision value more than maximum -- Notice: sprintf(): Requested precision of 988 digits was truncated to PHP maximum of %d digits in %s on line %d -string(52) "12345678900.0000000000000000000000000000000000000000" +string(65) "12345678900.00000000000000000000000000000000000000000000000000000" -- Testing for invalid width(-15) specifier -- string(3) "15s" diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt index 7b9d51399..1edc32eab 100644 --- a/ext/standard/tests/url/parse_url_basic_001.phpt +++ b/ext/standard/tests/url/parse_url_basic_001.phpt @@ -734,14 +734,7 @@ echo "Done"; string(9) "/blah.com" } ---> x://::abc/?: array(3) { - ["scheme"]=> - string(1) "x" - ["host"]=> - string(1) ":" - ["path"]=> - string(1) "/" -} +--> x://::abc/?: bool(false) --> http://::?: array(2) { ["scheme"]=> diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt index f3ac770f0..464e977ff 100644 --- a/ext/standard/tests/url/parse_url_basic_002.phpt +++ b/ext/standard/tests/url/parse_url_basic_002.phpt @@ -94,7 +94,7 @@ echo "Done"; --> http://x:? : string(4) "http" --> x:blah.com : string(1) "x" --> x:/blah.com : string(1) "x" ---> x://::abc/? : string(1) "x" +--> x://::abc/? : bool(false) --> http://::? : string(4) "http" --> x://::6.5 : string(1) "x" --> http://?:/ : string(4) "http" diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt index dbd92088a..57f182bfa 100644 --- a/ext/standard/tests/url/parse_url_basic_003.phpt +++ b/ext/standard/tests/url/parse_url_basic_003.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : string(1) "x" --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : string(1) ":" +--> x://::abc/? : bool(false) --> http://::? : string(1) ":" --> x://::6.5 : string(1) ":" --> http://?:/ : string(1) "?" diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt index 387907f0e..6abf4ed45 100644 --- a/ext/standard/tests/url/parse_url_basic_004.phpt +++ b/ext/standard/tests/url/parse_url_basic_004.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : NULL +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : int(6) --> http://?:/ : NULL diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt index d44dcfef3..3bcc89106 100644 --- a/ext/standard/tests/url/parse_url_basic_005.phpt +++ b/ext/standard/tests/url/parse_url_basic_005.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : NULL +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : NULL --> http://?:/ : NULL diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt index bd6d03efd..741a424a6 100644 --- a/ext/standard/tests/url/parse_url_basic_006.phpt +++ b/ext/standard/tests/url/parse_url_basic_006.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : NULL +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : NULL --> http://?:/ : NULL diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt index aa9f88ba5..bf8f98042 100644 --- a/ext/standard/tests/url/parse_url_basic_007.phpt +++ b/ext/standard/tests/url/parse_url_basic_007.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : string(8) "blah.com" --> x:/blah.com : string(9) "/blah.com" ---> x://::abc/? : string(1) "/" +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : NULL --> http://?:/ : string(1) "/" diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt index 7b166127f..a61fd0694 100644 --- a/ext/standard/tests/url/parse_url_basic_008.phpt +++ b/ext/standard/tests/url/parse_url_basic_008.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : NULL +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : NULL --> http://?:/ : NULL diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt index a814546c5..5302388f6 100644 --- a/ext/standard/tests/url/parse_url_basic_009.phpt +++ b/ext/standard/tests/url/parse_url_basic_009.phpt @@ -93,7 +93,7 @@ echo "Done"; --> http://x:? : NULL --> x:blah.com : NULL --> x:/blah.com : NULL ---> x://::abc/? : NULL +--> x://::abc/? : bool(false) --> http://::? : NULL --> x://::6.5 : NULL --> http://?:/ : NULL diff --git a/ext/standard/type.c b/ext/standard/type.c index 8b84662b6..9f28c2874 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: type.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_incomplete_class.h" diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index ef25240d1..5c969fb48 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: uniqid.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: uniqid.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h index da98a8fad..e78308392 100644 --- a/ext/standard/uniqid.h +++ b/ext/standard/uniqid.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: uniqid.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: uniqid.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef UNIQID_H #define UNIQID_H diff --git a/ext/standard/url.c b/ext/standard/url.c index 63e302ddc..5446c87ac 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: url.c 305159 2010-11-07 12:59:22Z felipe $ */ +/* $Id: url.c 309175 2011-03-13 17:14:18Z pierrick $ */ #include <stdlib.h> #include <string.h> @@ -176,19 +176,27 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } } } - } else if (e) { /* no scheme, look for port */ + } else if (e) { /* no scheme; starts with colon: look for port */ parse_port: p = e + 1; pp = p; - + while (pp-p < 6 && isdigit(*pp)) { pp++; } - - if (pp-p < 6 && (*pp == '/' || *pp == '\0')) { - memcpy(port_buf, p, (pp-p)); - port_buf[pp-p] = '\0'; - ret->port = atoi(port_buf); + + if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { + long port; + memcpy(port_buf, p, (pp - p)); + port_buf[pp - p] = '\0'; + port = strtol(port_buf, NULL, 10); + if (port > 0 && port <= 65535) { + ret->port = (unsigned short) port; + } else { + STR_FREE(ret->scheme); + efree(ret); + return NULL; + } } else { goto just_path; } @@ -264,9 +272,19 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) efree(ret); return NULL; } else if (e - p > 0) { - memcpy(port_buf, p, (e-p)); - port_buf[e-p] = '\0'; - ret->port = atoi(port_buf); + long port; + memcpy(port_buf, p, (e - p)); + port_buf[e - p] = '\0'; + port = strtol(port_buf, NULL, 10); + if (port > 0 && port <= 65535) { + ret->port = (unsigned short)port; + } else { + STR_FREE(ret->scheme); + STR_FREE(ret->user); + STR_FREE(ret->pass); + efree(ret); + return NULL; + } } p--; } diff --git a/ext/standard/url.h b/ext/standard/url.h index a9c2e03c0..9a2bcfaaa 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -15,7 +15,7 @@ | Author: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: url.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: url.h 307432 2011-01-13 07:27:46Z stas $ */ #ifndef URL_H #define URL_H diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index 7c2731dd3..cd4ca9e91 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Jul 27 02:20:40 2009 */ +/* Generated by re2c 0.13.5 on Fri Dec 31 23:52:51 2010 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.c 296107 2010-03-12 10:28:59Z jani $ */ +/* $Id: url_scanner_ex.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig index 57f273deb..cbc3f57bc 100644 --- a/ext/standard/url_scanner_ex.c.orig +++ b/ext/standard/url_scanner_ex.c.orig @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Jul 27 02:20:40 2009 */ +/* Generated by re2c 0.13.5 on Fri Dec 31 23:52:51 2010 */ #line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.c 296107 2010-03-12 10:28:59Z jani $ */ +/* $Id: url_scanner_ex.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h index f454d9f65..692f05af1 100644 --- a/ext/standard/url_scanner_ex.h +++ b/ext/standard/url_scanner_ex.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: url_scanner_ex.h 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: url_scanner_ex.h 306939 2011-01-01 02:19:59Z felipe $ */ #ifndef URL_SCANNER_EX_H #define URL_SCANNER_EX_H diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 3922fc56a..acd414277 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: user_filters.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: user_filters.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "php_globals.h" diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 0ef1fd462..cdd73aaa5 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: uuencode.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: uuencode.c 306939 2011-01-01 02:19:59Z felipe $ */ /* * Portions of this code are based on Berkeley's uuencode/uudecode diff --git a/ext/standard/var.c b/ext/standard/var.c index e71e5945d..633b5685d 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c 303330 2010-09-13 20:14:18Z kalle $ */ +/* $Id: var.c 306939 2011-01-01 02:19:59Z felipe $ */ /* {{{ includes */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index b88cab0a5..015f92d9e 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,9 +1,9 @@ -/* Generated by re2c 0.13.5 on Fri Aug 6 19:14:17 2010 */ +/* Generated by re2c 0.13.5 on Fri Dec 31 23:52:55 2010 */ /* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.c 301949 2010-08-06 22:23:10Z felipe $ */ +/* $Id: var_unserializer.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "ext/standard/php_var.h" diff --git a/ext/standard/var_unserializer.c.orig b/ext/standard/var_unserializer.c.orig index 586eedba1..ad7823e99 100644 --- a/ext/standard/var_unserializer.c.orig +++ b/ext/standard/var_unserializer.c.orig @@ -1,10 +1,10 @@ -/* Generated by re2c 0.13.5 on Fri Aug 6 19:14:17 2010 */ +/* Generated by re2c 0.13.5 on Fri Dec 31 23:52:55 2010 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.c 301949 2010-08-06 22:23:10Z felipe $ */ +/* $Id: var_unserializer.c 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "ext/standard/php_var.h" diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 5d4a379f6..500025d4d 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.re 301935 2010-08-06 18:20:41Z rasmus $ */ +/* $Id: var_unserializer.re 306939 2011-01-01 02:19:59Z felipe $ */ #include "php.h" #include "ext/standard/php_var.h" diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index 0ab2472c7..759cbb8f1 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2010 The PHP Group | + | Copyright (c) 1997-2011 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: versioning.c 293036 2010-01-03 09:23:27Z sebastian $ */ +/* $Id: versioning.c 306939 2011-01-01 02:19:59Z felipe $ */ #include <stdio.h> #include <sys/types.h> |