summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/array.c42
-rw-r--r--ext/standard/basic_functions.c71
-rw-r--r--ext/standard/basic_functions.h9
-rw-r--r--ext/standard/crc32.c15
-rw-r--r--ext/standard/credits.c6
-rw-r--r--ext/standard/credits_ext.h9
-rw-r--r--ext/standard/cyr_convert.c6
-rw-r--r--ext/standard/dir.c4
-rw-r--r--ext/standard/exec.c6
-rw-r--r--ext/standard/file.c27
-rw-r--r--ext/standard/file.h3
-rw-r--r--ext/standard/filestat.c116
-rw-r--r--ext/standard/filters.c123
-rw-r--r--ext/standard/ftp_fopen_wrapper.c4
-rw-r--r--ext/standard/html.c4
-rw-r--r--ext/standard/http.c17
-rw-r--r--ext/standard/http_fopen_wrapper.c16
-rw-r--r--ext/standard/incomplete_class.c6
-rw-r--r--ext/standard/info.c40
-rw-r--r--ext/standard/math.c4
-rw-r--r--ext/standard/pack.c8
-rw-r--r--ext/standard/php_array.h13
-rw-r--r--ext/standard/php_ext_syslog.h3
-rw-r--r--ext/standard/php_filestat.h8
-rw-r--r--ext/standard/php_fopen_wrapper.c24
-rw-r--r--ext/standard/php_incomplete_class.h6
-rw-r--r--ext/standard/php_math.h5
-rw-r--r--ext/standard/php_smart_str.h2
-rw-r--r--ext/standard/reg.c4
-rw-r--r--ext/standard/scanf.c28
-rw-r--r--ext/standard/streamsfuncs.c16
-rw-r--r--ext/standard/string.c48
-rw-r--r--ext/standard/syslog.c28
-rw-r--r--ext/standard/tests/array/array_chunk2.phpt146
-rwxr-xr-xext/standard/tests/array/array_combine.phpt122
-rw-r--r--ext/standard/tests/array/array_count_values2.phpt43
-rwxr-xr-xext/standard/tests/array/array_diff_assoc.phpt49
-rw-r--r--ext/standard/tests/array/array_diff_key2.phpt44
-rw-r--r--ext/standard/tests/file/bug24313.phpt2
-rw-r--r--ext/standard/tests/file/bug37158.phpt39
-rw-r--r--ext/standard/tests/file/userstreams.phpt6
-rw-r--r--ext/standard/tests/filters/read.phpt72
-rwxr-xr-xext/standard/tests/general_functions/bug35229.phpt2
-rwxr-xr-xext/standard/tests/general_functions/bug36011.phpt46
-rw-r--r--ext/standard/tests/math/bug21523.phpt3
-rw-r--r--ext/standard/tests/strings/bug33605.phpt11
-rw-r--r--ext/standard/tests/strings/bug36148.phpt29
-rw-r--r--ext/standard/tests/strings/bug36306.phpt15
-rw-r--r--ext/standard/tests/strings/bug36944.phpt26
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt39
-rw-r--r--ext/standard/tests/strings/url_t.phpt7
-rw-r--r--ext/standard/url.c8
-rw-r--r--ext/standard/url_scanner_ex.c713
-rw-r--r--ext/standard/url_scanner_ex.c.orig781
-rw-r--r--ext/standard/url_scanner_ex.re6
-rw-r--r--ext/standard/user_filters.c21
-rw-r--r--ext/standard/var.c48
57 files changed, 2008 insertions, 991 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 426af5dc6..fc698fd2d 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.308.2.16 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: array.c,v 1.308.2.22 2006/06/03 18:59:55 andrei Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -92,20 +92,9 @@
#define DOUBLE_DRIFT_FIX 0.000000000000001
-ZEND_BEGIN_MODULE_GLOBALS(array)
- int *multisort_flags[2];
- int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
-ZEND_END_MODULE_GLOBALS(array)
-
ZEND_DECLARE_MODULE_GLOBALS(array)
-#ifdef ZTS
-#define ARRAYG(v) TSRMG(array_globals_id, zend_array_globals *, v)
-#else
-#define ARRAYG(v) (array_globals.v)
-#endif
-
-/* {{{ php_extname_init_globals
+/* {{{ php_array_init_globals
*/
static void php_array_init_globals(zend_array_globals *array_globals)
{
@@ -325,8 +314,11 @@ PHP_FUNCTION(count)
if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
- RETVAL_LONG(Z_LVAL_P(retval));
- zval_ptr_dtor(&retval);
+ if (retval) {
+ convert_to_long(retval);
+ RETVAL_LONG(Z_LVAL_P(retval));
+ zval_ptr_dtor(&retval);
+ }
return;
}
#endif
@@ -1823,14 +1815,14 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
/* Clamp the offset.. */
if (offset > num_in)
offset = num_in;
- else if (offset < 0 && (offset=num_in+offset) < 0)
+ else if (offset < 0 && (offset = (num_in + offset)) < 0)
offset = 0;
/* ..and the length */
if (length < 0) {
- length = num_in-offset+length;
- } else if (((unsigned) offset + (unsigned) length) > num_in) {
- length = num_in-offset;
+ length = num_in - offset + length;
+ } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) {
+ length = num_in - offset;
}
/* Create and initialize output hash */
@@ -2217,14 +2209,14 @@ PHP_FUNCTION(array_slice)
/* Clamp the offset.. */
if (offset_val > num_in)
return;
- else if (offset_val < 0 && (offset_val=num_in+offset_val) < 0)
+ else if (offset_val < 0 && (offset_val = (num_in + offset_val)) < 0)
offset_val = 0;
/* ..and the length */
if (length_val < 0) {
- length_val = num_in-offset_val+length_val;
- } else if (((unsigned) offset_val + (unsigned) length_val) > num_in) {
- length_val = num_in-offset_val;
+ length_val = num_in - offset_val + length_val;
+ } else if (((unsigned)offset_val + (unsigned)length_val) > (unsigned)num_in) {
+ length_val = num_in - offset_val;
}
if (length_val == 0)
@@ -4146,12 +4138,10 @@ PHP_FUNCTION(array_filter)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be an array");
return;
}
- if (callback) {
- func = *callback;
- }
array = *input;
if (ZEND_NUM_ARGS() > 1) {
+ func = *callback;
if (!zend_is_callable(func, 0, &callback_name)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second argument, '%s', should be a valid callback", callback_name);
efree(callback_name);
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index ed718ae7a..79adf1ca2 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.725.2.17 2006/01/04 21:31:29 derick Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.32 2006/06/28 22:08:59 iliaa Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -99,9 +99,9 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#ifdef ZTS
-int basic_globals_id;
+PHPAPI int basic_globals_id;
#else
-php_basic_globals basic_globals;
+PHPAPI php_basic_globals basic_globals;
#endif
#include "php_fopen_wrappers.h"
@@ -382,7 +382,9 @@ zend_function_entry basic_functions[] = {
#endif
#if !defined(PHP_WIN32) && !defined(NETWARE)
PHP_FE(expm1, NULL)
+# ifdef HAVE_LOG1P
PHP_FE(log1p, NULL)
+# endif
#endif
PHP_FE(pi, NULL)
@@ -423,7 +425,9 @@ zend_function_entry basic_functions[] = {
#ifdef HAVE_GETOPT
PHP_FE(getopt, NULL)
#endif
-
+#ifdef HAVE_GETLOADAVG
+ PHP_FE(sys_getloadavg, NULL)
+#endif
#ifdef HAVE_GETTIMEOFDAY
PHP_FE(microtime, NULL)
PHP_FE(gettimeofday, NULL)
@@ -694,8 +698,6 @@ zend_function_entry basic_functions[] = {
#endif
#if HAVE_LCHOWN
PHP_FE(lchown, NULL)
-#endif
-#if HAVE_LCHOWN
PHP_FE(lchgrp, NULL)
#endif
PHP_FE(chmod, NULL)
@@ -1124,6 +1126,9 @@ PHP_MINIT_FUNCTION(basic)
PHP_MSHUTDOWN_FUNCTION(basic)
{
+#ifdef HAVE_SYSLOG_H
+ PHP_MSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#endif
#ifdef ZTS
ts_free_id(basic_globals_id);
#ifdef PHP_WIN32
@@ -1663,7 +1668,7 @@ PHP_FUNCTION(getopt)
opterr = 0;
/* Force reinitialization of getopt() (via optind reset) on every call. */
- optind = 0;
+ optind = 1;
/* Invoke getopt(3) on the argument array. */
#ifdef HARTMUT_0
@@ -1743,17 +1748,19 @@ PHP_FUNCTION(flush)
Delay for a given number of seconds */
PHP_FUNCTION(sleep)
{
- zval **num;
+ long num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ RETURN_FALSE;
+ }
+ if (num < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of seconds must be greater than or equal to 0");
+ RETURN_FALSE;
}
-
- convert_to_long_ex(num);
#ifdef PHP_SLEEP_NON_VOID
- RETURN_LONG(php_sleep(Z_LVAL_PP(num)));
+ RETURN_LONG(php_sleep(num));
#else
- php_sleep(Z_LVAL_PP(num));
+ php_sleep(num);
#endif
}
@@ -1764,13 +1771,16 @@ PHP_FUNCTION(sleep)
PHP_FUNCTION(usleep)
{
#if HAVE_USLEEP
- zval **num;
+ long num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ return;
+ }
+ if (num < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of microseconds must be greater than or equal to 0");
+ RETURN_FALSE;
}
- convert_to_long_ex(num);
- usleep(Z_LVAL_PP(num));
+ usleep(num);
#endif
}
/* }}} */
@@ -1822,7 +1832,7 @@ PHP_FUNCTION(time_sleep_until)
c_ts = (double)(d_ts - tm.tv_sec - tm.tv_usec / 1000000.00);
if (c_ts < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sleep until to time is less then current time.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sleep until to time is less than current time.");
RETURN_FALSE;
}
@@ -2024,7 +2034,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers T
break;
case 3: /*save to a file */
- stream = php_stream_open_wrapper(opt, "a", IGNORE_URL | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
+ stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
if (!stream)
return FAILURE;
php_stream_write(stream, message, strlen(message));
@@ -2387,6 +2397,7 @@ PHP_FUNCTION(register_shutdown_function)
shutdown_function_entry.arguments = (zval **) safe_emalloc(sizeof(zval *), shutdown_function_entry.arg_count, 0);
if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) {
+ efree(shutdown_function_entry.arguments);
RETURN_FALSE;
}
@@ -2970,6 +2981,7 @@ PHP_FUNCTION(register_tick_function)
tick_fe.arguments = (zval **) safe_emalloc(sizeof(zval *), tick_fe.arg_count, 0);
if (zend_get_parameters_array(ht, tick_fe.arg_count, tick_fe.arguments) == FAILURE) {
+ efree(tick_fe.arguments);
RETURN_FALSE;
}
@@ -3339,6 +3351,23 @@ PHP_FUNCTION(import_request_variables)
}
/* }}} */
+#ifdef HAVE_GETLOADAVG
+PHP_FUNCTION(sys_getloadavg)
+{
+ double load[3];
+
+ if (getloadavg(load, 3) == -1) {
+ RETURN_FALSE;
+ } else {
+ array_init(return_value);
+ add_index_double(return_value, 0, load[0]);
+ add_index_double(return_value, 1, load[1]);
+ add_index_double(return_value, 2, load[2]);
+ }
+}
+#endif
+
+
/*
* Local variables:
* tab-width: 4
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index d47fe01c1..9f0bf7c93 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.h,v 1.139.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: basic_functions.h,v 1.139.2.4 2006/02/18 05:41:59 rasmus Exp $ */
#ifndef BASIC_FUNCTIONS_H
#define BASIC_FUNCTIONS_H
@@ -116,6 +116,9 @@ PHP_NAMED_FUNCTION(php_if_crc32);
PHP_FUNCTION(register_tick_function);
PHP_FUNCTION(unregister_tick_function);
+#ifdef HAVE_GETLOADAVG
+PHP_FUNCTION(sys_getloadavg);
+#endif
PHP_FUNCTION(is_uploaded_file);
PHP_FUNCTION(move_uploaded_file);
@@ -216,10 +219,10 @@ typedef struct _php_basic_globals {
#ifdef ZTS
#define BG(v) TSRMG(basic_globals_id, php_basic_globals *, v)
-extern int basic_globals_id;
+PHPAPI extern int basic_globals_id;
#else
#define BG(v) (basic_globals.v)
-extern php_basic_globals basic_globals;
+PHPAPI extern php_basic_globals basic_globals;
#endif
#if HAVE_PUTENV
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index 96419a705..af517f726 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: crc32.c,v 1.16.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: crc32.c,v 1.16.2.4 2006/02/09 15:48:46 pajoye Exp $ */
#include "php.h"
#include "basic_functions.h"
@@ -26,19 +26,20 @@
Calculate the crc32 polynomial of a string */
PHP_NAMED_FUNCTION(php_if_crc32)
{
- unsigned int crc = ~0;
char *p;
int len, nr;
-
+ php_uint32 crcinit = 0;
+ register php_uint32 crc;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) == FAILURE) {
return;
}
+ crc = crcinit^0xFFFFFFFF;
- len = 0 ;
- for (len += nr; nr--; ++p) {
- CRC32(crc, *p);
+ for (len =+nr; nr--; ++p) {
+ crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ];
}
- RETVAL_LONG(~crc);
+ RETVAL_LONG(crc^0xFFFFFFFF);
}
/* }}} */
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
index f64e5049e..2cf356ea9 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: credits.c,v 1.36.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: credits.c,v 1.36.2.4 2006/03/23 18:36:46 iliaa Exp $ */
#include "php.h"
#include "info.h"
@@ -69,7 +69,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC)
CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski, Wez Furlong");
CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski");
CREDIT_LINE("Streams Abstraction Layer", "Wez Furlong, Sara Golemon");
- CREDIT_LINE("PHP Data Objects Layer", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle");
+ CREDIT_LINE("PHP Data Objects Layer", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky");
php_info_print_table_end();
}
@@ -106,7 +106,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC)
if (flag & PHP_CREDITS_QA) {
php_info_print_table_start();
php_info_print_table_header(1, "PHP 5.1 Quality Assurance Team");
- php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen");
+ php_info_print_table_row(1, "Ilia Alshanetsky, Joerg Behrens, Antony Dovgal, Stefan Esser, Moriyoshi Koizumi, Magnus Maatta, Sebastian Nohn, Derick Rethans, Melvyn Sopacua, Jani Taskinen");
php_info_print_table_end();
}
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
index 5b8bface0..6b3f53648 100644
--- a/ext/standard/credits_ext.h
+++ b/ext/standard/credits_ext.h
@@ -43,10 +43,9 @@ CREDIT_LINE("mhash", "Sascha Schumann");
CREDIT_LINE("mime_magic", "Hartmut Holzgraefe");
CREDIT_LINE("MING", "Dave Hayden, Frank M. Kromann");
CREDIT_LINE("MS SQL", "Frank M. Kromann");
-CREDIT_LINE("msession", "Mark L. Woodward");
CREDIT_LINE("mSQL", "Zeev Suraski");
CREDIT_LINE("Multibyte String Functions", "Tsukada Takuya, Rui Hirokawa");
-CREDIT_LINE("mySQL 3.x driver for PDO", "George Schlossnagle");
+CREDIT_LINE("mySQL driver for PDO", "George Schlossnagle, Wez Furlong, Ilia Alshanetsky");
CREDIT_LINE("MySQL", "Zeev Suraski, Zak Greant, Georg Richter");
CREDIT_LINE("MySQLi", "Zak Greant, Georg Richter");
CREDIT_LINE("ncurses", "Ilia Alshanetsky, Wez Furlong, Hartmut Holzgraefe, Georg Richter");
@@ -57,9 +56,9 @@ CREDIT_LINE("OpenSSL", "Stig Venaas, Wez Furlong, Sascha Kettler");
CREDIT_LINE("Oracle (OCI) driver for PDO", "Wez Furlong");
CREDIT_LINE("pcntl", "Jason Greene");
CREDIT_LINE("Perl Compatible Regexps", "Andrei Zmievski");
-CREDIT_LINE("PHP Data Objects", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle");
+CREDIT_LINE("PHP Data Objects", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky");
CREDIT_LINE("PHP hash", "Sara Golemon, Rasmus Lerdorf, Stefan Esser, Michael Wallner");
-CREDIT_LINE("Posix", "Kristian Köhntopp");
+CREDIT_LINE("Posix", "Kristian Koehntopp");
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");
@@ -86,6 +85,6 @@ CREDIT_LINE("WDDX", "Andrei Zmievski");
CREDIT_LINE("XML", "Stig Bakken, Thies C. Arntzen, Sterling Hughes");
CREDIT_LINE("XMLReader", "Rob Richards");
CREDIT_LINE("xmlrpc", "Dan Libby");
-CREDIT_LINE("XMLWriter", "Rob Richards");
+CREDIT_LINE("XMLWriter", "Rob Richards, Pierre-Alain Joye");
CREDIT_LINE("XSL", "Christian Stocker, Rob Richards");
CREDIT_LINE("Zlib", "Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti");
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
index d48aa5715..501f9a61a 100644
--- a/ext/standard/cyr_convert.c
+++ b/ext/standard/cyr_convert.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cyr_convert.c,v 1.27.2.2 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: cyr_convert.c,v 1.27.2.3 2006/01/18 23:55:47 tony2001 Exp $ */
#include <stdlib.h>
@@ -47,9 +47,9 @@
typedef unsigned char _cyr_charset_table[512];
-/* {{{ const static _cyr_charset_table _cyr_win1251
+/* {{{ static const _cyr_charset_table _cyr_win1251
*/
-const static _cyr_charset_table _cyr_win1251 = {
+static const _cyr_charset_table _cyr_win1251 = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index cc3e727f2..dbdde4507 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dir.c,v 1.147.2.2 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: dir.c,v 1.147.2.3 2006/02/26 10:49:50 helly Exp $ */
/* {{{ includes/startup/misc */
@@ -370,7 +370,7 @@ PHP_FUNCTION(glob)
int pattern_len;
long flags = 0;
glob_t globbuf;
- unsigned int n;
+ int n;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE)
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 451026ba9..6ff23cc12 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -16,7 +16,7 @@
| Ilia Alshanetsky <iliaa@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.113.2.2 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: exec.c,v 1.113.2.3 2006/02/26 10:49:50 helly Exp $ */
#include <stdio.h>
#include "php.h"
@@ -135,7 +135,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
/* strip trailing whitespaces */
l = bufl;
while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (bufl - 1)) {
+ if (l != (int)(bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
@@ -148,7 +148,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
if (type != 2) {
l = bufl;
while (l-- && isspace(((unsigned char *)buf)[l]));
- if (l != (bufl - 1)) {
+ if (l != (int)(bufl - 1)) {
bufl = l + 1;
buf[bufl] = '\0';
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index ed4d1a72b..6e09bac53 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: file.c,v 1.409.2.6 2006/04/06 02:39:55 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -773,8 +773,9 @@ PHP_FUNCTION(tempnam)
zval **arg1, **arg2;
char *d;
char *opened_path;
- char p[64];
+ char *p;
int fd;
+ size_t p_len;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -787,7 +788,11 @@ PHP_FUNCTION(tempnam)
}
d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p));
+
+ php_basename(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), NULL, 0, &p, &p_len TSRMLS_CC);
+ if (p_len > 64) {
+ p[63] = '\0';
+ }
if ((fd = php_open_temporary_fd(d, p, &opened_path TSRMLS_CC)) >= 0) {
close(fd);
@@ -795,6 +800,7 @@ PHP_FUNCTION(tempnam)
} else {
RETVAL_FALSE;
}
+ efree(p);
efree(d);
}
/* }}} */
@@ -1355,10 +1361,10 @@ PHPAPI PHP_FUNCTION(fseek)
/* {{{ proto int mkdir(char *dir int mode)
*/
-PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
+PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC)
{
int ret;
-
+
if (PG(safe_mode) && (!php_checkuid(dir, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
return -1;
}
@@ -1367,11 +1373,16 @@ PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
return -1;
}
- if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0) {
+ if ((ret = VCWD_MKDIR(dir, (mode_t)mode)) < 0 && (options & REPORT_ERRORS)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
}
- return ret;
+ return ret;
+}
+
+PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
+{
+ return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC);
}
/* }}} */
@@ -1756,7 +1767,7 @@ no_stat:
}
safe_to_copy:
- srcstream = php_stream_open_wrapper(src, "rb", STREAM_DISABLE_OPEN_BASEDIR | REPORT_ERRORS, NULL);
+ srcstream = php_stream_open_wrapper(src, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
if (!srcstream) {
return ret;
diff --git a/ext/standard/file.h b/ext/standard/file.h
index 9cbb1166f..c7a1406fb 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.h,v 1.94.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: file.h,v 1.94.2.2 2006/01/13 04:05:59 pajoye Exp $ */
/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
@@ -72,6 +72,7 @@ PHP_MINIT_FUNCTION(user_streams);
PHPAPI int php_le_stream_context(void);
PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
+PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC);
PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC);
#define META_DEF_BUFSIZE 8192
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index f0746be46..3b81dbb07 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: filestat.c,v 1.136.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: filestat.c,v 1.136.2.9 2006/08/10 21:30:23 iliaa Exp $ */
#include "php.h"
#include "safe_mode.h"
@@ -323,12 +323,9 @@ PHP_FUNCTION(disk_free_space)
}
/* }}} */
-/* {{{ proto bool chgrp(string filename, mixed group)
- Change file group */
-#ifndef NETWARE
-PHP_FUNCTION(chgrp)
-{
#if !defined(WINDOWS)
+static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp)
+{
zval **filename, **group;
gid_t gid;
struct group *gr=NULL;
@@ -360,25 +357,51 @@ PHP_FUNCTION(chgrp)
RETURN_FALSE;
}
- ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid);
+ if (do_lchgrp) {
+#if HAVE_LCHOWN
+ ret = VCWD_LCHOWN(Z_STRVAL_PP(filename), -1, gid);
+#endif
+ } else {
+ ret = VCWD_CHOWN(Z_STRVAL_PP(filename), -1, gid);
+ }
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
RETURN_TRUE;
+}
+#endif
+
+#ifndef NETWARE
+/* {{{ proto bool chgrp(string filename, mixed group)
+ Change file group */
+PHP_FUNCTION(chgrp)
+{
+#if !defined(WINDOWS)
+ php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
#else
RETURN_FALSE;
#endif
}
+/* }}} */
+
+/* {{{ proto bool lchgrp(string filename, mixed group)
+ Change symlink group */
+#if HAVE_LCHOWN
+PHP_FUNCTION(lchgrp)
+{
+# if !defined(WINDOWS)
+ php_do_chgrp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+# else
+ RETURN_FALSE;
+# endif
+}
#endif
/* }}} */
+#endif
-/* {{{ proto bool chown (string filename, mixed user)
- Change file owner */
-#ifndef NETWARE
-PHP_FUNCTION(chown)
+static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown)
{
-#if !defined(WINDOWS)
zval **filename, **user;
int ret;
uid_t uid;
@@ -410,16 +433,48 @@ PHP_FUNCTION(chown)
RETURN_FALSE;
}
- ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1);
+ if (do_lchown) {
+#if HAVE_LCHOWN
+ ret = VCWD_LCHOWN(Z_STRVAL_PP(filename), uid, -1);
+#endif
+ } else {
+ ret = VCWD_CHOWN(Z_STRVAL_PP(filename), uid, -1);
+ }
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
+}
+
+#ifndef NETWARE
+/* {{{ proto bool chown (string filename, mixed user)
+ Change file owner */
+PHP_FUNCTION(chown)
+{
+#if !defined(WINDOWS)
+ RETVAL_TRUE;
+ php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+#else
+ RETURN_FALSE;
#endif
- RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool chown (string filename, mixed user)
+ Change file owner */
+#if HAVE_LCHOWN
+PHP_FUNCTION(lchown)
+{
+# if !defined(WINDOWS)
+ RETVAL_TRUE;
+ php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+# else
+ RETURN_FALSE;
+# endif
}
#endif
/* }}} */
+#endif
/* {{{ proto bool chmod(string filename, int mode)
Change file mode */
@@ -449,8 +504,23 @@ PHP_FUNCTION(chmod)
Setuiding files could allow users to gain privileges
that safe mode doesn't give them.
*/
- if(PG(safe_mode))
- imode &= 0777;
+
+ if(PG(safe_mode)) {
+ php_stream_statbuf ssb;
+ if (php_stream_stat_path_ex(Z_STRVAL_PP(filename), 0, &ssb, NULL)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "stat failed for %s", Z_STRVAL_PP(filename));
+ RETURN_FALSE;
+ }
+ if ((imode & 04000) != 0 && (ssb.sb.st_mode & 04000) == 0) {
+ imode ^= 04000;
+ }
+ if ((imode & 02000) != 0 && (ssb.sb.st_mode & 02000) == 0) {
+ imode ^= 02000;
+ }
+ if ((imode & 01000) != 0 && (ssb.sb.st_mode & 01000) == 0) {
+ imode ^= 01000;
+ }
+ }
ret = VCWD_CHMOD(Z_STRVAL_PP(filename), imode);
if (ret == -1) {
@@ -556,15 +626,22 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
"size", "atime", "mtime", "ctime", "blksize", "blocks"};
+ char *local;
+ php_stream_wrapper *wrapper;
if (!filename_length) {
RETURN_FALSE;
}
+ if ((wrapper = php_stream_locate_url_wrapper(filename, &local, 0 TSRMLS_CC)) == &php_plain_files_wrapper) {
+ if (php_check_open_basedir(local TSRMLS_CC) || (PG(safe_mode) && !php_checkuid_ex(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS, CHECKUID_NO_ERRORS))) {
+ RETURN_FALSE;
+ }
+ }
+
if (IS_ACCESS_CHECK(type)) {
- char *local;
+ if (wrapper == &php_plain_files_wrapper) {
- if (php_stream_locate_url_wrapper(filename, &local, 0 TSRMLS_CC) == &php_plain_files_wrapper) {
switch (type) {
#ifdef F_OK
case FS_EXISTS:
@@ -644,9 +721,6 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
if (IS_ABLE_CHECK(type) && getuid() == 0) {
/* root has special perms on plain_wrapper
But we don't know about root under Netware */
- php_stream_wrapper *wrapper;
-
- wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC);
if (wrapper == &php_plain_files_wrapper) {
if (type == FS_IS_X) {
xmask = S_IXROOT;
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 930663236..12aeabecd 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -14,10 +14,13 @@
+----------------------------------------------------------------------+
| Authors: |
| Wez Furlong (wez@thebrainroom.com) |
+ | Sara Golemon (pollita@php.net) |
+ | Moriyoshi Koizumi (moriyoshi@php.net) |
+ | Marcus Boerger (helly@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: filters.c,v 1.44.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: filters.c,v 1.44.2.6 2006/04/17 19:26:04 pollita Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -102,7 +105,7 @@ static php_stream_filter_status_t strfilter_toupper_filter(
if (bytes_consumed) {
*bytes_consumed = consumed;
}
-
+
return PSFS_PASS_ON;
}
@@ -130,7 +133,7 @@ static php_stream_filter_status_t strfilter_tolower_filter(
if (bytes_consumed) {
*bytes_consumed = consumed;
}
-
+
return PSFS_PASS_ON;
}
@@ -638,7 +641,7 @@ static php_conv_err_t php_conv_base64_decode_convert(php_conv_base64_decode *ins
size_t icnt, ocnt;
unsigned int ustat;
- const static unsigned int nbitsof_pack = 8;
+ static const unsigned int nbitsof_pack = 8;
if (in_pp == NULL || in_left_p == NULL) {
if (inst->eos || inst->urem_nbits == 0) {
@@ -1028,6 +1031,18 @@ static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *ins
scan_stat = 4;
ps++, icnt--;
break;
+ } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\r') {
+ /* auto-detect line endings, looks like network line ending \r\n (could be mac \r) */
+ lb_cnt++;
+ scan_stat = 5;
+ ps++, icnt--;
+ break;
+ } else if (!inst->lbchars && lb_cnt == 0 && *ps == '\n') {
+ /* auto-detect line endings, looks like unix-lineendings, not to spec, but it is seem in the wild, a lot */
+ lb_cnt = lb_ptr = 0;
+ scan_stat = 0;
+ ps++, icnt--;
+ break;
} else if (lb_cnt < inst->lbchars_len &&
*ps == (unsigned char)inst->lbchars[lb_cnt]) {
lb_cnt++;
@@ -1085,7 +1100,16 @@ static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *ins
} break;
case 5: {
- if (lb_cnt >= inst->lbchars_len) {
+ if (!inst->lbchars && lb_cnt == 1 && *ps == '\n') {
+ /* auto-detect soft line breaks, found network line break */
+ lb_cnt = lb_ptr = 0;
+ scan_stat = 0;
+ ps++, icnt--; /* consume \n */
+ } else if (!inst->lbchars && lb_cnt > 0) {
+ /* auto-detect soft line breaks, found mac line break */
+ lb_cnt = lb_ptr = 0;
+ scan_stat = 0;
+ } else if (lb_cnt >= inst->lbchars_len) {
/* soft line break */
lb_cnt = lb_ptr = 0;
scan_stat = 0;
@@ -1405,12 +1429,10 @@ static php_conv *php_conv_open(int conv_mode, const HashTable *options, int pers
size_t lbchars_len;
if (options != NULL) {
+ /* If line-break-chars are not specified, filter will attempt to detect line endings (\r, \n, or \r\n) */
GET_STR_PROP(options, lbchars, lbchars_len, "line-break-chars", 0);
- if (lbchars == NULL) {
- lbchars = pestrdup("\r\n", 0);
- lbchars_len = 2;
- }
}
+
retval = pemalloc(sizeof(php_conv_qprint_decode), persistent);
if (lbchars != NULL) {
if (php_conv_qprint_decode_ctor((php_conv_qprint_decode *)retval, lbchars, lbchars_len, 1, persistent)) {
@@ -1795,6 +1817,88 @@ static php_stream_filter_factory strfilter_convert_factory = {
};
/* }}} */
+/* {{{ consumed filter implementation */
+typedef struct _php_consumed_filter_data {
+ int persistent;
+ size_t consumed;
+ off_t offset;
+} php_consumed_filter_data;
+
+static php_stream_filter_status_t consumed_filter_filter(
+ php_stream *stream,
+ php_stream_filter *thisfilter,
+ php_stream_bucket_brigade *buckets_in,
+ php_stream_bucket_brigade *buckets_out,
+ size_t *bytes_consumed,
+ int flags
+ TSRMLS_DC)
+{
+ php_consumed_filter_data *data = (php_consumed_filter_data *)(thisfilter->abstract);
+ php_stream_bucket *bucket;
+ size_t consumed = 0;
+
+ if (data->offset == ~0) {
+ data->offset = php_stream_tell(stream);
+ }
+ while ((bucket = buckets_in->head) != NULL) {
+ php_stream_bucket_unlink(bucket TSRMLS_CC);
+ consumed += bucket->buflen;
+ php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
+ }
+ if (bytes_consumed) {
+ *bytes_consumed = consumed;
+ }
+ if (flags & PSFS_FLAG_FLUSH_CLOSE) {
+ php_stream_seek(stream, data->offset + data->consumed, SEEK_SET);
+ }
+ data->consumed += consumed;
+
+ return PSFS_PASS_ON;
+}
+
+static void consumed_filter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
+{
+ if (thisfilter && thisfilter->abstract) {
+ php_consumed_filter_data *data = (php_consumed_filter_data*)thisfilter->abstract;
+ pefree(data, data->persistent);
+ }
+}
+
+static php_stream_filter_ops consumed_filter_ops = {
+ consumed_filter_filter,
+ consumed_filter_dtor,
+ "consumed"
+};
+
+static php_stream_filter *consumed_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC)
+{
+ php_stream_filter_ops *fops = NULL;
+ php_consumed_filter_data *data;
+
+ if (strcasecmp(filtername, "consumed")) {
+ return NULL;
+ }
+
+ /* Create this filter */
+ data = pecalloc(1, sizeof(php_consumed_filter_data), persistent);
+ if (!data) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %d bytes.", sizeof(php_consumed_filter_data));
+ return NULL;
+ }
+ data->persistent = persistent;
+ data->consumed = 0;
+ data->offset = ~0;
+ fops = &consumed_filter_ops;
+
+ return php_stream_filter_alloc(fops, data, persistent);
+}
+
+php_stream_filter_factory consumed_filter_factory = {
+ consumed_filter_create
+};
+
+/* }}} */
+
static const struct {
php_stream_filter_ops *ops;
php_stream_filter_factory *factory;
@@ -1804,6 +1908,7 @@ static const struct {
{ &strfilter_tolower_ops, &strfilter_tolower_factory },
{ &strfilter_strip_tags_ops, &strfilter_strip_tags_factory },
{ &strfilter_convert_ops, &strfilter_convert_factory },
+ { &consumed_filter_ops, &consumed_filter_factory },
/* additional filters to go here */
{ NULL, NULL }
};
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 926cdaaaa..b6237d008 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -18,7 +18,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.85.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4 2006/03/20 14:10:35 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -611,7 +611,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count
tmp_len = MIN(sizeof(ent->d_name), basename_len - 1);
memcpy(ent->d_name, basename, tmp_len);
- ent->d_name[tmp_len] = '\0';
+ ent->d_name[tmp_len - 1] = '\0';
efree(basename);
/* Trim off trailing whitespace characters */
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 31962c7d3..08e791192 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.111.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: html.c,v 1.111.2.2 2006/02/25 21:32:11 rasmus Exp $ */
/*
* HTML entity resources:
@@ -884,7 +884,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
unsigned char replacement[15];
int replacement_len;
- ret = estrdup(old);
+ ret = estrndup(old, oldlen);
retlen = oldlen;
if (!retlen) {
goto empty_source;
diff --git a/ext/standard/http.c b/ext/standard/http.c
index c4bef796e..af6ec8292 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http.c,v 1.14.2.3 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: http.c,v 1.14.2.4 2006/03/08 22:00:21 mike Exp $ */
#include "php_http.h"
#include "php_ini.h"
@@ -82,7 +82,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) {
if (key_type == HASH_KEY_IS_STRING) {
ekey = php_url_encode(key, key_len, &ekey_len);
- newprefix_len = key_suffix_len + ekey_len + key_prefix_len + 1;
+ newprefix_len = key_suffix_len + ekey_len + key_prefix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -99,13 +99,14 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
memcpy(p, key_suffix, key_suffix_len);
p += key_suffix_len;
}
-
- *(p++) = '[';
+ *(p++) = '%';
+ *(p++) = '5';
+ *(p++) = 'B';
*p = '\0';
} else {
/* Is an integer key */
ekey_len = spprintf(&ekey, 12, "%ld", idx);
- newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 1;
+ newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -125,11 +126,13 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
memcpy(p, key_suffix, key_suffix_len);
p += key_suffix_len;
}
- *(p++) = '[';
+ *(p++) = '%';
+ *(p++) = '5';
+ *(p++) = 'B';
*p = '\0';
}
ht->nApplyCount++;
- php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 0, newprefix, newprefix_len, "]", 1, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata : NULL), arg_sep TSRMLS_CC);
+ php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 0, newprefix, newprefix_len, "%5D", 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata : NULL), arg_sep TSRMLS_CC);
ht->nApplyCount--;
efree(newprefix);
} else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) == IS_RESOURCE) {
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 1254afcf3..ba39b714a 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -19,7 +19,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.99.2.8 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.99.2.12 2006/04/16 17:40:33 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -487,8 +487,13 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
} else {
response_code = 0;
}
+ /* when we request only the header, don't fail even on error codes */
+ if (options & STREAM_ONLY_GET_HEADERS) {
+ reqok = 1;
+ }
switch(response_code) {
case 200:
+ case 206: /* partial content */
case 302:
case 303:
case 301:
@@ -634,10 +639,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
} \
} \
/* check for control characters in login, password & path */
- CHECK_FOR_CNTRL_CHARS(resource->user)
- CHECK_FOR_CNTRL_CHARS(resource->pass)
- CHECK_FOR_CNTRL_CHARS(resource->path)
-
+ if (strncasecmp(new_path, "http://", sizeof("http://") - 1) || strncasecmp(new_path, "https://", sizeof("https://") - 1)) {
+ CHECK_FOR_CNTRL_CHARS(resource->user)
+ CHECK_FOR_CNTRL_CHARS(resource->pass)
+ CHECK_FOR_CNTRL_CHARS(resource->path)
+ }
stream = php_stream_url_wrap_http_ex(wrapper, new_path, mode, options, opened_path, context, --redirect_max, 0 STREAMS_CC TSRMLS_CC);
} else {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed! %s", tmp_line);
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index c55b05c67..50511c01f 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -17,7 +17,7 @@
*/
-/* $Id: incomplete_class.c,v 1.28.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: incomplete_class.c,v 1.28.2.2 2006/01/28 06:14:34 fmk Exp $ */
#include "php.h"
#include "basic_functions.h"
@@ -122,7 +122,7 @@ zend_class_entry *php_create_incomplete_class(TSRMLS_D)
/* {{{ php_lookup_class_name
*/
-char *php_lookup_class_name(zval *object, zend_uint *nlen)
+PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen)
{
zval **val;
char *retval = NULL;
@@ -144,7 +144,7 @@ char *php_lookup_class_name(zval *object, zend_uint *nlen)
/* {{{ php_store_class_name
*/
-void php_store_class_name(zval *object, const char *name, zend_uint len)
+PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len)
{
zval *val;
TSRMLS_FETCH();
diff --git a/ext/standard/info.c b/ext/standard/info.c
index b3c5fc415..fa2afe07d 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.249.2.7 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: info.c,v 1.249.2.10 2006/03/31 11:11:12 tony2001 Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -58,6 +58,23 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv)
PHPAPI extern char *php_ini_opened_path;
PHPAPI extern char *php_ini_scanned_files;
+
+static int php_info_write_wrapper(const char *str, uint str_length)
+{
+ int new_len, written;
+ char *elem_esc;
+
+ TSRMLS_FETCH();
+
+ elem_esc = php_escape_html_entities((char *)str, str_length, &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
+
+ written = php_body_write(elem_esc, new_len TSRMLS_CC);
+
+ efree(elem_esc);
+
+ return written;
+}
+
/* {{{ _display_module_info
*/
@@ -135,30 +152,13 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
PUTS(" => ");
}
if (Z_TYPE_PP(tmp) == IS_ARRAY) {
- zval *tmp3;
-
- MAKE_STD_ZVAL(tmp3);
-
if (!sapi_module.phpinfo_as_text) {
PUTS("<pre>");
- }
- php_start_ob_buffer(NULL, 4096, 1 TSRMLS_CC);
-
- zend_print_zval_r(*tmp, 0 TSRMLS_CC);
-
- php_ob_get_buffer(tmp3 TSRMLS_CC);
- php_end_ob_buffer(0, 0 TSRMLS_CC);
-
- if (!sapi_module.phpinfo_as_text) {
- elem_esc = php_info_html_esc(Z_STRVAL_P(tmp3) TSRMLS_CC);
- PUTS(elem_esc);
- efree(elem_esc);
+ zend_print_zval_ex((zend_write_func_t) php_info_write_wrapper, *tmp, 0);
PUTS("</pre>");
} else {
- PUTS(Z_STRVAL_P(tmp3));
+ zend_print_zval_r(*tmp, 0 TSRMLS_CC);
}
- zval_ptr_dtor(&tmp3);
-
} else if (Z_TYPE_PP(tmp) != IS_STRING) {
tmp2 = **tmp;
zval_copy_ctor(&tmp2);
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 0aad86c06..2f5ee7ba0 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.131.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: math.c,v 1.131.2.2 2006/02/06 11:28:41 tony2001 Exp $ */
#include "php.h"
#include "php_math.h"
@@ -448,7 +448,7 @@ PHP_FUNCTION(pow)
/* calculate pow(long,long) in O(log exp) operations, bail if overflow */
while (i >= 1) {
int overflow;
- double dval;
+ double dval = 0.0;
if (i % 2) {
--i;
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 1badfaed5..e9757f647 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.57.2.3 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: pack.c,v 1.57.2.5 2006/02/26 10:49:50 helly Exp $ */
#include "php.h"
@@ -55,7 +55,7 @@
#endif
#define INC_OUTPUTPOS(a,b) \
- if ((a) < 0 || ((INT_MAX - outputpos)/(b)) < (a)) { \
+ if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow in format string", code); \
RETURN_FALSE; \
} \
@@ -692,7 +692,9 @@ PHP_FUNCTION(unpack)
len = size * 2;
}
- len -= argb % 2;
+ if (argb > 0) {
+ len -= argb % 2;
+ }
buf = emalloc(len + 1);
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index 1ed616a38..b4e6923b4 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_array.h,v 1.50.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_array.h,v 1.50.2.3 2006/06/03 18:59:55 andrei Exp $ */
#ifndef PHP_ARRAY_H
#define PHP_ARRAY_H
@@ -103,4 +103,15 @@ HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **);
PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC);
int multisort_compare(const void *a, const void *b TSRMLS_DC);
+ZEND_BEGIN_MODULE_GLOBALS(array)
+ int *multisort_flags[2];
+ int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
+ZEND_END_MODULE_GLOBALS(array)
+
+#ifdef ZTS
+#define ARRAYG(v) TSRMG(array_globals_id, zend_array_globals *, v)
+#else
+#define ARRAYG(v) (array_globals.v)
+#endif
+
#endif /* PHP_ARRAY_H */
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index 8652fc88c..d26b63269 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ext_syslog.h,v 1.12.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_ext_syslog.h,v 1.12.2.2 2006/03/20 23:03:11 tony2001 Exp $ */
#ifndef PHP_EXT_SYSLOG_H
#define PHP_EXT_SYSLOG_H
@@ -28,6 +28,7 @@
PHP_MINIT_FUNCTION(syslog);
PHP_RINIT_FUNCTION(syslog);
PHP_RSHUTDOWN_FUNCTION(syslog);
+PHP_MSHUTDOWN_FUNCTION(syslog);
PHP_FUNCTION(openlog);
PHP_FUNCTION(syslog);
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index c29a81747..f029f1f5a 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_filestat.h,v 1.24.2.2 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_filestat.h,v 1.24.2.4 2006/03/05 19:01:37 derick Exp $ */
#ifndef PHP_FILESTAT_H
#define PHP_FILESTAT_H
@@ -47,6 +47,12 @@ PHP_FUNCTION(disk_total_space);
PHP_FUNCTION(disk_free_space);
PHP_FUNCTION(chown);
PHP_FUNCTION(chgrp);
+#if HAVE_LCHOWN
+PHP_FUNCTION(lchown);
+#endif
+#if HAVE_LCHOWN
+PHP_FUNCTION(lchgrp);
+#endif
PHP_FUNCTION(chmod);
#if HAVE_UTIME
PHP_FUNCTION(touch);
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index f440c75fe..db2157396 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_fopen_wrapper.c,v 1.45.2.3 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_fopen_wrapper.c,v 1.45.2.4 2006/05/01 16:02:07 helly Exp $ */
#include <stdio.h>
#include <stdlib.h>
@@ -158,9 +158,29 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
int mode_rw = 0;
php_stream * stream = NULL;
char *p, *token, *pathdup;
+ long max_memory;
- if (!strncasecmp(path, "php://", 6))
+ if (!strncasecmp(path, "php://", 6)) {
path += 6;
+ }
+
+ if (!strncasecmp(path, "temp", 4)) {
+ path += 4;
+ max_memory = PHP_STREAM_MAX_MEM;
+ if (!strncasecmp(path, "/maxmemory:", 11)) {
+ path += 11;
+ max_memory = strtol(path, NULL, 10);
+ if (max_memory < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Max memory must be >= 0");
+ return NULL;
+ }
+ }
+ return php_stream_temp_create(TEMP_STREAM_DEFAULT, max_memory);
+ }
+
+ if (!strcasecmp(path, "memory")) {
+ return php_stream_memory_create(TEMP_STREAM_DEFAULT);
+ }
if (!strcasecmp(path, "output")) {
return php_stream_alloc(&php_stream_output_ops, NULL, 0, "wb");
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index be6aba1a1..b0f9f1a3a 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_incomplete_class.h,v 1.17.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_incomplete_class.h,v 1.17.2.2 2006/01/28 06:14:34 fmk Exp $ */
#ifndef PHP_INCOMPLETE_CLASS_H
#define PHP_INCOMPLETE_CLASS_H
@@ -55,8 +55,8 @@ extern "C" {
zend_class_entry *php_create_incomplete_class(TSRMLS_D);
-char *php_lookup_class_name(zval *object, zend_uint *nlen);
-void php_store_class_name(zval *object, const char *name, zend_uint len);
+PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen);
+PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len);
#ifdef __cplusplus
};
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index 805114f9c..19fa2518b 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_math.h,v 1.28.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_math.h,v 1.28.2.2 2006/01/13 13:04:27 tony2001 Exp $ */
#ifndef PHP_MATH_H
#define PHP_MATH_H
@@ -68,8 +68,9 @@ PHP_FUNCTION(rad2deg);
*/
PHP_FUNCTION(hypot);
PHP_FUNCTION(expm1);
+#ifdef HAVE_LOG1P
PHP_FUNCTION(log1p);
-
+#endif
PHP_FUNCTION(sinh);
PHP_FUNCTION(cosh);
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
index 6d28cb4d7..e38ee8d23 100644
--- a/ext/standard/php_smart_str.h
+++ b/ext/standard/php_smart_str.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_smart_str.h,v 1.30.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_smart_str.h,v 1.30.2.3 2006/05/03 13:32:10 iliaa Exp $ */
#ifndef PHP_SMART_STR_H
#define PHP_SMART_STR_H
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
index a50733672..f72476f69 100644
--- a/ext/standard/reg.c
+++ b/ext/standard/reg.c
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.82.2.2 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: reg.c,v 1.82.2.3 2006/02/26 10:49:50 helly Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -355,7 +355,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
walk = replace;
while (*walk) {
- if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
+ if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
}
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index ed0ef42eb..c40a29a63 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: scanf.c,v 1.31.2.2 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: scanf.c,v 1.31.2.3 2006/08/04 20:34:31 tony2001 Exp $ */
/*
scanf.c --
@@ -732,7 +732,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
if (*end == '$') {
format = end+1;
ch = format++;
- objIndex = varStart + value;
+ objIndex = varStart + value - 1;
}
}
@@ -762,7 +762,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
switch (*ch) {
case 'n':
if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
zend_uint refcount;
current = args[objIndex++];
@@ -888,7 +890,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
}
}
if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
zend_uint refcount;
current = args[objIndex++];
@@ -932,7 +936,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
goto done;
}
if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
current = args[objIndex++];
zval_dtor( *current );
ZVAL_STRINGL( *current, string, end-string, 1);
@@ -1089,7 +1095,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
value = (int) (*fn)(buf, NULL, base);
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
sprintf(buf, "%u", value); /* INTL: ISO digit */
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
/* change passed value type to string */
current = args[objIndex++];
convert_to_string( *current );
@@ -1098,7 +1106,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
add_index_string(*return_value, objIndex++, buf, 1);
}
} else {
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
current = args[objIndex++];
convert_to_long( *current );
Z_LVAL(**current) = value;
@@ -1206,7 +1216,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
double dvalue;
*end = '\0';
dvalue = zend_strtod(buf, NULL);
- if (numVars) {
+ if (numVars && objIndex >= argCount) {
+ break;
+ } else if (numVars) {
current = args[objIndex++];
convert_to_double( *current );
Z_DVAL_PP( current ) = dvalue;
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index fe57f511d..05d1efdcd 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.58.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6 2006/04/19 08:43:29 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -207,6 +207,8 @@ PHP_FUNCTION(stream_socket_server)
/* no need to dup; we need to efree buf anyway */
zval_dtor(zerrstr);
ZVAL_STRING(zerrstr, errstr, 0);
+ } else if (errstr) {
+ efree(errstr);
}
RETURN_FALSE;
}
@@ -750,7 +752,15 @@ PHP_FUNCTION(stream_select)
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (sec != NULL) {
- convert_to_long_ex(&sec);
+ convert_to_long(sec);
+
+ if (Z_LVAL_P(sec) < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0.");
+ RETURN_FALSE;
+ } else if (usec < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The microseconds parameter must be greater than 0.");
+ RETURN_FALSE;
+ }
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
@@ -1173,7 +1183,7 @@ PHP_FUNCTION(stream_get_line)
}
if (max_length < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater then or equal to zero.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater than or equal to zero.");
RETURN_FALSE;
}
if (!max_length) {
diff --git a/ext/standard/string.c b/ext/standard/string.c
index a830a6d87..67d6b1cf4 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.6 2006/01/05 20:49:37 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.16 2006/08/10 17:46:43 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -237,7 +237,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior)
}
}
- if (((unsigned) start + (unsigned) len) > len1) {
+ if ((start + len) > len1) {
len = len1 - start;
}
@@ -632,7 +632,8 @@ PHP_FUNCTION(wordwrap)
{
const char *text, *breakchar = "\n";
char *newtext;
- int textlen, breakcharlen = 1, newtextlen, alloced, chk;
+ int textlen, breakcharlen = 1, newtextlen, chk;
+ size_t alloced;
long current = 0, laststart = 0, lastspace = 0;
long linelength = 75;
zend_bool docut = 0;
@@ -676,12 +677,13 @@ PHP_FUNCTION(wordwrap)
/* Multiple character line break or forced cut */
if (linelength > 0) {
chk = (int)(textlen/linelength + 1);
+ newtext = safe_emalloc(chk, breakcharlen, textlen + 1);
alloced = textlen + chk * breakcharlen + 1;
} else {
chk = textlen;
alloced = textlen * (breakcharlen + 1) + 1;
+ newtext = safe_emalloc(textlen, (breakcharlen + 1), 1);
}
- newtext = emalloc(alloced);
/* now keep track of the actual new text length */
newtextlen = 0;
@@ -1166,7 +1168,7 @@ quit_loop:
if (state == 1) {
cend = c;
}
- if (suffix != NULL && sufflen < (cend - comp) &&
+ if (suffix != NULL && sufflen < (uint)(cend - comp) &&
memcmp(cend - sufflen, suffix, sufflen) == 0) {
cend -= sufflen;
}
@@ -1611,10 +1613,18 @@ PHP_FUNCTION(stripos)
RETURN_FALSE;
}
+ if (haystack_len == 0) {
+ RETURN_FALSE;
+ }
+
haystack_dup = estrndup(haystack, haystack_len);
php_strtolower(haystack_dup, haystack_len);
if (Z_TYPE_P(needle) == IS_STRING) {
+ if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) {
+ efree(haystack_dup);
+ RETURN_FALSE;
+ }
needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
php_strtolower(needle_dup, Z_STRLEN_P(needle));
found = php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len);
@@ -1983,7 +1993,7 @@ PHP_FUNCTION(substr)
RETURN_FALSE;
}
- if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(str)) {
+ if ((f + l) > Z_STRLEN_PP(str)) {
l = Z_STRLEN_PP(str) - f;
}
@@ -2080,7 +2090,7 @@ PHP_FUNCTION(substr_replace)
}
}
- if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(str)) {
+ if ((f + l) > Z_STRLEN_PP(str)) {
l = Z_STRLEN_PP(str) - f;
}
if (Z_TYPE_PP(repl) == IS_ARRAY) {
@@ -2176,7 +2186,7 @@ PHP_FUNCTION(substr_replace)
}
}
- if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(tmp_str)) {
+ if ((f + l) > Z_STRLEN_PP(tmp_str)) {
l = Z_STRLEN_PP(tmp_str) - f;
}
@@ -4193,7 +4203,7 @@ PHP_FUNCTION(str_repeat)
zval **input_str; /* Input string */
zval **mult; /* Multiplier */
char *result; /* Resulting string */
- int result_len; /* Length of the resulting string */
+ size_t result_len; /* Length of the resulting string */
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &input_str, &mult) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -4218,11 +4228,7 @@ PHP_FUNCTION(str_repeat)
/* Initialize the result string */
result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult);
- if (result_len < 1 || result_len > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may not create strings longer than 2147483647 bytes");
- RETURN_FALSE;
- }
- result = (char *)emalloc(result_len + 1);
+ result = (char *)safe_emalloc(Z_STRLEN_PP(input_str), Z_LVAL_PP(mult), 1);
/* Heavy optimization for situations where input string is 1 byte long */
if (Z_STRLEN_PP(input_str) == 1) {
@@ -4473,7 +4479,7 @@ PHP_FUNCTION(substr_count)
if (ac > 2) {
convert_to_long_ex(offset);
if (Z_LVAL_PP(offset) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater then or equal to 0.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater than or equal to 0.");
RETURN_FALSE;
}
p += Z_LVAL_PP(offset);
@@ -4653,6 +4659,8 @@ PHP_FUNCTION(str_rot13)
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
WRONG_PARAM_COUNT;
}
+
+ convert_to_string_ex(arg);
RETVAL_ZVAL(*arg, 1, 0);
php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52);
@@ -4881,13 +4889,19 @@ PHP_FUNCTION(substr_compare)
RETURN_FALSE;
}
- if (len && offset >= s1_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length.");
+ if (ZEND_NUM_ARGS() >= 4 && len <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than zero");
RETURN_FALSE;
}
if (offset < 0) {
offset = s1_len + offset;
+ offset = (offset < 0) ? 0 : offset;
+ }
+
+ if ((offset + len) > s1_len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length");
+ RETURN_FALSE;
}
cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index da310ee81..2407fb56a 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: syslog.c,v 1.49.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: syslog.c,v 1.49.2.3 2006/03/21 00:59:08 iliaa Exp $ */
#include "php.h"
@@ -97,6 +97,7 @@ PHP_MINIT_FUNCTION(syslog)
/* AIX doesn't have LOG_PERROR */
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
#endif
+ BG(syslog_device)=NULL;
return SUCCESS;
}
@@ -109,22 +110,26 @@ PHP_RINIT_FUNCTION(syslog)
} else {
BG(syslog_started)=0;
}
- BG(syslog_device)=NULL;
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(syslog)
{
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- }
#ifdef PHP_WIN32
closelog();
#endif
return SUCCESS;
}
+PHP_MSHUTDOWN_FUNCTION(syslog)
+{
+ if (BG(syslog_device)) {
+ free(BG(syslog_device));
+ }
+ return SUCCESS;
+}
+
/* {{{ start_syslog
*/
static void start_syslog(TSRMLS_D)
@@ -224,9 +229,9 @@ PHP_FUNCTION(openlog)
return;
}
if (BG(syslog_device)) {
- efree(BG(syslog_device));
+ free(BG(syslog_device));
}
- BG(syslog_device) = estrndup(ident, ident_len);
+ BG(syslog_device) = zend_strndup(ident, ident_len);
openlog(BG(syslog_device), option, facility);
RETURN_TRUE;
}
@@ -242,7 +247,7 @@ PHP_FUNCTION(closelog)
closelog();
if (BG(syslog_device)) {
- efree(BG(syslog_device));
+ free(BG(syslog_device));
BG(syslog_device)=NULL;
}
RETURN_TRUE;
@@ -262,12 +267,7 @@ PHP_FUNCTION(syslog)
return;
}
- /*
- * CAVEAT: if the message contains patterns such as "%s",
- * this will cause problems.
- */
-
- php_syslog(priority, "%.500s", message);
+ php_syslog(priority, "%s", message);
RETURN_TRUE;
}
/* }}} */
diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt
new file mode 100644
index 000000000..09d148ed0
--- /dev/null
+++ b/ext/standard/tests/array/array_chunk2.phpt
@@ -0,0 +1,146 @@
+--TEST--
+basic array_chunk test
+--FILE--
+<?php
+$input_array = array('a', 'b', 'c', 'd', 'e');
+var_dump(array_chunk($input_array, 0));
+var_dump(array_chunk($input_array, 0, true));
+var_dump(array_chunk($input_array, 1));
+var_dump(array_chunk($input_array, 1, true));
+var_dump(array_chunk($input_array, 2));
+var_dump(array_chunk($input_array, 2, true));
+var_dump(array_chunk($input_array, 10));
+var_dump(array_chunk($input_array, 10, true));
+?>
+--EXPECTF--
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+
+Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
+NULL
+array(5) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ string(1) "c"
+ }
+ [3]=>
+ array(1) {
+ [0]=>
+ string(1) "d"
+ }
+ [4]=>
+ array(1) {
+ [0]=>
+ string(1) "e"
+ }
+}
+array(5) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(1) "a"
+ }
+ [1]=>
+ array(1) {
+ [1]=>
+ string(1) "b"
+ }
+ [2]=>
+ array(1) {
+ [2]=>
+ string(1) "c"
+ }
+ [3]=>
+ array(1) {
+ [3]=>
+ string(1) "d"
+ }
+ [4]=>
+ array(1) {
+ [4]=>
+ string(1) "e"
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "c"
+ [1]=>
+ string(1) "d"
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ string(1) "e"
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ }
+ [1]=>
+ array(2) {
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+ }
+ [2]=>
+ array(1) {
+ [4]=>
+ string(1) "e"
+ }
+}
+array(1) {
+ [0]=>
+ array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+ [4]=>
+ string(1) "e"
+ }
+}
+array(1) {
+ [0]=>
+ array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+ [4]=>
+ string(1) "e"
+ }
+}
diff --git a/ext/standard/tests/array/array_combine.phpt b/ext/standard/tests/array/array_combine.phpt
new file mode 100755
index 000000000..6952b66fb
--- /dev/null
+++ b/ext/standard/tests/array/array_combine.phpt
@@ -0,0 +1,122 @@
+--TEST--
+basic array_combine test
+--FILE--
+<?php
+ $array1 = array('green', 'red', 'yellow');
+ $array2 = array('1', '2', '3');
+ $array3 = array(0, 1, 2);
+ $array4 = array(TRUE, FALSE, NULL);
+ $a = array_combine($array1, $array1);
+ $b = array_combine($array1, $array2);
+ $c = array_combine($array1, $array3);
+ $d = array_combine($array1, $array4);
+ $e = array_combine($array2, $array1);
+ $f = array_combine($array2, $array2);
+ $g = array_combine($array2, $array3);
+ $h = array_combine($array2, $array4);
+ $i = array_combine($array3, $array1);
+ $j = array_combine($array3, $array2);
+ $k = array_combine($array3, $array3);
+ $l = array_combine($array3, $array4);
+ $m = array_combine($array4, $array1);
+ $n = array_combine($array4, $array2);
+ $o = array_combine($array4, $array3);
+ $p = array_combine($array4, $array4);
+ for($letter = "a"; $letter <= "p"; $letter++)
+ {
+ print_r($$letter);
+ }
+?>
+--EXPECT--
+Array
+(
+ [green] => green
+ [red] => red
+ [yellow] => yellow
+)
+Array
+(
+ [green] => 1
+ [red] => 2
+ [yellow] => 3
+)
+Array
+(
+ [green] => 0
+ [red] => 1
+ [yellow] => 2
+)
+Array
+(
+ [green] => 1
+ [red] =>
+ [yellow] =>
+)
+Array
+(
+ [1] => green
+ [2] => red
+ [3] => yellow
+)
+Array
+(
+ [1] => 1
+ [2] => 2
+ [3] => 3
+)
+Array
+(
+ [1] => 0
+ [2] => 1
+ [3] => 2
+)
+Array
+(
+ [1] => 1
+ [2] =>
+ [3] =>
+)
+Array
+(
+ [0] => green
+ [1] => red
+ [2] => yellow
+)
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+)
+Array
+(
+ [0] => 0
+ [1] => 1
+ [2] => 2
+)
+Array
+(
+ [0] => 1
+ [1] =>
+ [2] =>
+)
+Array
+(
+ [1] => green
+ [] => yellow
+)
+Array
+(
+ [1] => 1
+ [] => 3
+)
+Array
+(
+ [1] => 0
+ [] => 2
+)
+Array
+(
+ [1] => 1
+ [] =>
+) \ No newline at end of file
diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt
new file mode 100644
index 000000000..50472179f
--- /dev/null
+++ b/ext/standard/tests/array/array_count_values2.phpt
@@ -0,0 +1,43 @@
+--TEST--
+basic array_count_values test
+--FILE--
+<?php
+$array1 = array(1,
+ "hello",
+ 1,
+ "world",
+ "hello",
+ "",
+ "rabbit",
+ "foo",
+ "Foo",
+ TRUE,
+ FALSE,
+ NULL,
+ 0);
+var_dump(array_count_values($array1));
+?>
+--EXPECTF--
+Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s
+
+Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s
+
+Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %s
+array(8) {
+ [1]=>
+ int(2)
+ ["hello"]=>
+ int(2)
+ ["world"]=>
+ int(1)
+ [""]=>
+ int(1)
+ ["rabbit"]=>
+ int(1)
+ ["foo"]=>
+ int(1)
+ ["Foo"]=>
+ int(1)
+ [0]=>
+ int(1)
+}
diff --git a/ext/standard/tests/array/array_diff_assoc.phpt b/ext/standard/tests/array/array_diff_assoc.phpt
new file mode 100755
index 000000000..32d4758dd
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc.phpt
@@ -0,0 +1,49 @@
+--TEST--
+basic array_diff_assoc test
+--FILE--
+<?php
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red", "");
+$array2 = array("a" => "green", "yellow", "red", TRUE);
+$array3 = array("red", "a"=>"brown", "");
+$result[] = array_diff_assoc($array1, $array2);
+$result[] = array_diff_assoc($array1, $array3);
+$result[] = array_diff_assoc($array2, $array3);
+$result[] = array_diff_assoc($array1, $array2, $array3);
+print_r($result)
+?>
+--EXPECT--
+Array
+(
+ [0] => Array
+ (
+ [b] => brown
+ [c] => blue
+ [0] => red
+ [1] =>
+ )
+
+ [1] => Array
+ (
+ [a] => green
+ [b] => brown
+ [c] => blue
+ )
+
+ [2] => Array
+ (
+ [a] => green
+ [0] => yellow
+ [1] => red
+ [2] => 1
+ )
+
+ [3] => Array
+ (
+ [b] => brown
+ [c] => blue
+ )
+
+)
+
+
+
diff --git a/ext/standard/tests/array/array_diff_key2.phpt b/ext/standard/tests/array/array_diff_key2.phpt
new file mode 100644
index 000000000..ba32b984f
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_key2.phpt
@@ -0,0 +1,44 @@
+--TEST--
+basic array_diff_key test
+--FILE--
+<?php
+$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red", "");
+$array2 = array("a" => "green", "yellow", "red", TRUE);
+$array3 = array("red", "a"=>"brown", "");
+$result[] = array_diff_key($array1, $array2);
+$result[] = array_diff_key($array1, $array3);
+$result[] = array_diff_key($array2, $array3);
+$result[] = array_diff_key($array1, $array2, $array3);
+
+var_dump($result);
+
+?>
+--EXPECT--
+array(4) {
+ [0]=>
+ array(2) {
+ ["b"]=>
+ string(5) "brown"
+ ["c"]=>
+ string(4) "blue"
+ }
+ [1]=>
+ array(2) {
+ ["b"]=>
+ string(5) "brown"
+ ["c"]=>
+ string(4) "blue"
+ }
+ [2]=>
+ array(1) {
+ [2]=>
+ bool(true)
+ }
+ [3]=>
+ array(2) {
+ ["b"]=>
+ string(5) "brown"
+ ["c"]=>
+ string(4) "blue"
+ }
+}
diff --git a/ext/standard/tests/file/bug24313.phpt b/ext/standard/tests/file/bug24313.phpt
index dcea58ffe..4b84bcac4 100644
--- a/ext/standard/tests/file/bug24313.phpt
+++ b/ext/standard/tests/file/bug24313.phpt
@@ -4,7 +4,7 @@ Bug #24313 (file_exists() warning on non-existant files when is open_basedir ena
open_basedir=/tmp
--FILE--
<?php
- var_dump(file_exists("./foobar"));
+ var_dump(file_exists("/tmp/bogus_file_no_such_thing"));
?>
--EXPECT--
bool(false)
diff --git a/ext/standard/tests/file/bug37158.phpt b/ext/standard/tests/file/bug37158.phpt
new file mode 100644
index 000000000..48df46cc6
--- /dev/null
+++ b/ext/standard/tests/file/bug37158.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Bug #37158 (if userspace stream is present, fread() reads in 8192 max, otherwise it works)
+--FILE--
+<?php
+
+class VariableStream {
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ return true;
+ }
+}
+
+stream_wrapper_register("var", "VariableStream");
+
+error_reporting(E_ALL | E_STRICT);
+$file = dirname(__FILE__) . '/footest.txt';
+$x = str_repeat(1, 8192);
+$fp = fopen($file, 'w');
+for ($i = 0; $i < 5; $i++) {
+ fwrite($fp, $x);
+}
+fclose($fp);
+
+$fp = fopen($file, 'r');
+$outsidecontents = fread($fp, 20000);
+fclose($fp);
+var_dump('size of contents 1 = ' . strlen($outsidecontents));
+$outsidecontents = file_get_contents($file);
+var_dump('size of contents 2 = ' . strlen($outsidecontents));
+
+unlink($file);
+
+echo "Done\n";
+?>
+--EXPECT--
+string(26) "size of contents 1 = 20000"
+string(26) "size of contents 2 = 40960"
+Done
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
index 124825f24..9b80508b3 100644
--- a/ext/standard/tests/file/userstreams.phpt
+++ b/ext/standard/tests/file/userstreams.phpt
@@ -211,15 +211,15 @@ for ($i = 0; $i < 256; $i++) {
$whence = $whence_map[array_rand($whence_map, 1)];
switch($whence) {
case SEEK_SET:
- $offset = rand(0, $DATALEN);
+ $offset = rand(0, $DATALEN - 1);
$position = $offset;
break;
case SEEK_END:
- $offset = -rand(0, $DATALEN);
+ $offset = -rand(0, $DATALEN - 1);
$position = $DATALEN + $offset;
break;
case SEEK_CUR:
- $offset = rand(0, $DATALEN);
+ $offset = rand(0, $DATALEN - 1);
$offset -= $position;
$position += $offset;
break;
diff --git a/ext/standard/tests/filters/read.phpt b/ext/standard/tests/filters/read.phpt
new file mode 100644
index 000000000..a2372cf8f
--- /dev/null
+++ b/ext/standard/tests/filters/read.phpt
@@ -0,0 +1,72 @@
+--TEST--
+stream filter - reading
+--FILE--
+<?php
+echo "-TEST\n";
+class filter extends php_user_filter {
+ function filter($in, $out, &$consumed, $closing)
+ {
+ $output = 0;
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $bucket->data = strtoupper($bucket->data);
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ $output = 1;
+ }
+ if ($closing) {
+ $bucket = stream_bucket_new($this->stream, "\n===close===\n");
+ stream_bucket_append($out, $bucket);
+ $output = 1;
+ }
+ return $output ? PSFS_PASS_ON : PSFS_FEED_ME;
+ }
+}
+stream_filter_register("strtoupper", "filter")
+ or die("Failed to register filter");
+
+if ($f = fopen(__FILE__, "rb")) {
+ stream_filter_append($f, "strtoupper");
+ while (!feof($f)) {
+ echo fread($f, 8192);
+ }
+ fclose($f);
+}
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+<?PHP
+ECHO "-TEST\N";
+CLASS FILTER EXTENDS PHP_USER_FILTER {
+ FUNCTION FILTER($IN, $OUT, &$CONSUMED, $CLOSING)
+ {
+ $OUTPUT = 0;
+ WHILE ($BUCKET = STREAM_BUCKET_MAKE_WRITEABLE($IN)) {
+ $BUCKET->DATA = STRTOUPPER($BUCKET->DATA);
+ $CONSUMED += $BUCKET->DATALEN;
+ STREAM_BUCKET_APPEND($OUT, $BUCKET);
+ $OUTPUT = 1;
+ }
+ IF ($CLOSING) {
+ $BUCKET = STREAM_BUCKET_NEW($THIS->STREAM, "\N===CLOSE===\N");
+ STREAM_BUCKET_APPEND($OUT, $BUCKET);
+ $OUTPUT = 1;
+ }
+ RETURN $OUTPUT ? PSFS_PASS_ON : PSFS_FEED_ME;
+ }
+}
+STREAM_FILTER_REGISTER("STRTOUPPER", "FILTER")
+ OR DIE("FAILED TO REGISTER FILTER");
+
+IF ($F = FOPEN(__FILE__, "RB")) {
+ STREAM_FILTER_APPEND($F, "STRTOUPPER");
+ WHILE (!FEOF($F)) {
+ ECHO FREAD($F, 8192);
+ }
+ FCLOSE($F);
+}
+ECHO "DONE\N";
+?>
+
+===close===
+Done
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
index bcd0ef548..e5a294598 100755
--- a/ext/standard/tests/general_functions/bug35229.phpt
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #35229 (call_user_func() crashes when arguement_stack is nearly full)
+Bug #35229 (call_user_func() crashes when argument stack is nearly full)
--FILE--
<?php
class test2 {
diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt
new file mode 100755
index 000000000..08a45014f
--- /dev/null
+++ b/ext/standard/tests/general_functions/bug36011.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Bug #36011 (Strict errormsg wrong for call_user_func() and the likes)
+--FILE--
+<?php
+
+class TestClass
+{
+ static function test()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function whee()
+ {
+ array_map(array('TestClass', 'test'), array('array_value'));
+ }
+
+ function whee4()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+
+ static function whee5()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+}
+
+TestClass::test();
+
+$a = new TestClass();
+$a->whee();
+$a->whee4();
+$a->whee5();
+
+TestClass::whee5();
+
+?>
+===DONE===
+--EXPECTF--
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+TestClass::test()
+===DONE===
diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt
index 23d4df7dd..3ca82b632 100644
--- a/ext/standard/tests/math/bug21523.phpt
+++ b/ext/standard/tests/math/bug21523.phpt
@@ -1,7 +1,8 @@
--TEST--
Bug #21523 (number_format tries to allocate negative amount of memory)
--FILE--
-<?php // $Id: bug21523.phpt,v 1.2 2003/01/23 19:07:25 moriyoshi Exp $ vim600:syn=php
+<?php // $Id: bug21523.phpt,v 1.2.4.1 2006/03/22 19:27:47 tony2001 Exp $ vim600:syn=php
+set_time_limit(5);
var_dump(number_format(-2000, 2768));
echo "OK";
diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt
new file mode 100644
index 000000000..f0c49eb18
--- /dev/null
+++ b/ext/standard/tests/strings/bug33605.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #33605 (substr_compare crashes)
+--FILE--
+<?php
+$res = substr_compare("aa", "a", -99999999, 0, 0);
+var_dump($res);
+
+?>
+--EXPECTF--
+Warning: substr_compare(): The length must be greater than zero in %s on line %d
+bool(false)
diff --git a/ext/standard/tests/strings/bug36148.phpt b/ext/standard/tests/strings/bug36148.phpt
new file mode 100644
index 000000000..06caac333
--- /dev/null
+++ b/ext/standard/tests/strings/bug36148.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of the string)
+--FILE--
+<?php
+$values = array("a", "aa", "aaa", "aaaa");
+foreach ($values as $value) {
+ $a = pack("H*", $value);
+ $b = unpack("H*", $a);
+ echo $value.": ";
+ var_dump($b);
+}
+?>
+--EXPECT--
+a: array(1) {
+ [1]=>
+ string(2) "a0"
+}
+aa: array(1) {
+ [1]=>
+ string(2) "aa"
+}
+aaa: array(1) {
+ [1]=>
+ string(4) "aaa0"
+}
+aaaa: array(1) {
+ [1]=>
+ string(4) "aaaa"
+}
diff --git a/ext/standard/tests/strings/bug36306.phpt b/ext/standard/tests/strings/bug36306.phpt
new file mode 100644
index 000000000..ff6279a2d
--- /dev/null
+++ b/ext/standard/tests/strings/bug36306.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #36306 crc32() 64bit
+--FILE--
+<?php
+
+/* as an example how to write crc32 tests
+ PHP does not have uint values, you cannot
+ display crc32 like a signed integer.
+ Have to find some small strings to truely reproduce
+ the problem, this example being not a problem
+*/
+echo dechex(crc32("platform independant")) . "\n";
+?>
+--EXPECT--
+ccd9fe66
diff --git a/ext/standard/tests/strings/bug36944.phpt b/ext/standard/tests/strings/bug36944.phpt
new file mode 100644
index 000000000..2a43d060e
--- /dev/null
+++ b/ext/standard/tests/strings/bug36944.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #36944 (strncmp & strncasecmp do not return false on negative string length)
+--FILE--
+<?php
+
+var_dump(strncmp("test ", "e", -1));
+var_dump(strncmp("test ", "e", 10));
+var_dump(strncmp("test ", "e", 0));
+
+var_dump(strncasecmp("test ", "E", -1));
+var_dump(strncasecmp("test ", "E", 10));
+var_dump(strncasecmp("test ", "E", 0));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+int(%d)
+int(0)
+
+Warning: Length must be greater than or equal to 0 in %s on line %d
+bool(false)
+int(%d)
+int(0)
+Done
diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt
new file mode 100644
index 000000000..594aed173
--- /dev/null
+++ b/ext/standard/tests/strings/substr_compare.phpt
@@ -0,0 +1,39 @@
+--TEST--
+substr_compare()
+--FILE--
+<?php
+
+var_dump(substr_compare("abcde", "bc", 1, 2));
+var_dump(substr_compare("abcde", "bcg", 1, 2));
+var_dump(substr_compare("abcde", "BC", 1, 2, true));
+var_dump(substr_compare("abcde", "bc", 1, 3));
+var_dump(substr_compare("abcde", "cd", 1, 2));
+var_dump(substr_compare("abcde", "abc", 5, 1));
+
+var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
+echo "Test\n";
+var_dump(substr_compare("abcde", "abc", -1, NULL, -5));
+var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(0)
+int(0)
+int(0)
+int(1)
+int(-1)
+
+Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
+bool(false)
+
+Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d
+bool(false)
+Test
+
+Warning: substr_compare(): The length must be greater than zero in %s on line %d
+bool(false)
+
+Warning: substr_compare() expects parameter 4 to be long, string given in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt
index be95e0294..2d18fa5c0 100644
--- a/ext/standard/tests/strings/url_t.phpt
+++ b/ext/standard/tests/strings/url_t.phpt
@@ -70,6 +70,7 @@ $sample_urls = array (
'http://foo.com#bar',
'scheme:',
'foo+bar://baz@bang/bla',
+'gg:9130731',
);
foreach ($sample_urls as $url) {
@@ -678,6 +679,12 @@ array(4) {
["path"]=>
string(4) "/bla"
}
+array(2) {
+ ["scheme"]=>
+ string(2) "gg"
+ ["path"]=>
+ string(7) "9130731"
+}
string(4) "http"
string(11) "www.php.net"
int(80)
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 6231f28a4..09da50aef 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.86.2.3 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: url.c,v 1.86.2.5 2006/02/12 16:39:44 iliaa Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -25,6 +25,7 @@
#include "php.h"
#include "url.h"
+#include "file.h"
#ifdef _OSD_POSIX
#ifndef APACHE
#error On this EBCDIC platform, PHP is only supported as an Apache module.
@@ -137,7 +138,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
p++;
}
- if ((*p) == '\0' || *p == '/') {
+ if ((*p == '\0' || *p == '/') && (p - e) < 7) {
goto parse_port;
}
@@ -658,7 +659,7 @@ PHP_FUNCTION(get_headers)
{
char *url;
int url_len;
- php_stream_context *context = NULL;
+ php_stream_context *context;
php_stream *stream;
zval **prev_val, **hdr = NULL;
HashPosition pos;
@@ -667,6 +668,7 @@ PHP_FUNCTION(get_headers)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) {
return;
}
+ context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc());
if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) {
RETURN_FALSE;
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index 5a9116b53..fdfcc6ee4 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.11 on Sun Jan 1 14:39:52 2006 */
+/* Generated by re2c 0.9.11 on Tue Feb 28 09:38:22 2006 */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.3 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4 2006/02/28 14:45:18 iliaa Exp $ */
#include "php.h"
@@ -107,41 +107,6 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
q = (p = url->c) + url->len;
scan:
-{
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 128, 128, 128, 128, 0,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
{
YYCTYPE yych;
@@ -150,12 +115,12 @@ scan:
yy0:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) {
- goto yy8;
+ switch(yych){
+ case '#': goto yy6;
+ case ':': goto yy2;
+ case '?': goto yy4;
+ default: goto yy8;
}
- if(yych <= '9') goto yy6;
- if(yych >= ';') goto yy4;
- goto yy2;
yy2: ++YYCURSOR;
goto yy3;
yy3:
@@ -172,14 +137,13 @@ yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
-yy9: if(yybm[0+yych] & 128) {
- goto yy8;
+yy9: switch(yych){
+ case '#': case ':': case '?': goto yy10;
+ default: goto yy8;
}
- goto yy10;
yy10:
{ goto scan; }
}
-}
done:
@@ -347,41 +311,6 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 0, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
{
YYCTYPE yych;
@@ -390,10 +319,10 @@ state_plain:
yy11:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) {
- goto yy15;
+ switch(yych){
+ case '<': goto yy13;
+ default: goto yy15;
}
- goto yy13;
yy13: ++YYCURSOR;
goto yy14;
yy14:
@@ -402,53 +331,17 @@ yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy16;
-yy16: if(yybm[0+yych] & 128) {
- goto yy15;
+yy16: switch(yych){
+ case '<': goto yy17;
+ default: goto yy15;
}
- goto yy17;
yy17:
{ passthru(STD_ARGS); goto state_plain; }
}
-}
state_tag:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
{
YYCTYPE yych;
@@ -457,11 +350,60 @@ state_tag:
yy18:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '@') goto yy22;
- if(yych <= 'Z') goto yy20;
- if(yych <= '`') goto yy22;
- if(yych >= '{') goto yy22;
- goto yy20;
+ switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy20;
+ default: goto yy22;
+ }
yy20: ++YYCURSOR;
yych = *YYCURSOR;
goto yy25;
@@ -475,11 +417,60 @@ yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy25;
-yy25: if(yybm[0+yych] & 128) {
- goto yy24;
+yy25: switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy24;
+ default: goto yy21;
}
- goto yy21;
-}
}
@@ -488,41 +479,6 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
{
YYCTYPE yych;
@@ -531,24 +487,63 @@ state_next_arg:
yy26:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '='){
- if(yych <= 0x0B){
- if(yych <= 0x08) goto yy34;
- goto yy30;
- } else {
- if(yych == ' ') goto yy30;
- goto yy34;
- }
- } else {
- if(yych <= 'Z'){
- if(yych <= '>') goto yy28;
- if(yych <= '@') goto yy34;
- goto yy32;
- } else {
- if(yych <= '`') goto yy34;
- if(yych <= 'z') goto yy32;
- goto yy34;
- }
+ switch(yych){
+ case 0x09:
+ case 0x0A:
+ case 0x0B: case 0x0D: case ' ': goto yy30;
+ case '>': goto yy28;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy32;
+ default: goto yy34;
}
yy28: ++YYCURSOR;
goto yy29;
@@ -571,51 +566,17 @@ yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy37;
-yy37: if(yybm[0+yych] & 128) {
- goto yy36;
+yy37: switch(yych){
+ case 0x09:
+ case 0x0A:
+ case 0x0B: case 0x0D: case ' ': goto yy36;
+ default: goto yy31;
}
- goto yy31;
-}
}
state_arg:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
{
YYCTYPE yych;
@@ -624,11 +585,60 @@ state_arg:
yy38:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '@') goto yy42;
- if(yych <= 'Z') goto yy40;
- if(yych <= '`') goto yy42;
- if(yych >= '{') goto yy42;
- goto yy40;
+ switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy40;
+ default: goto yy42;
+ }
yy40: ++YYCURSOR;
yych = *YYCURSOR;
goto yy45;
@@ -642,51 +652,65 @@ yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy45;
-yy45: if(yybm[0+yych] & 128) {
- goto yy44;
+yy45: switch(yych){
+ case '-': case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy44;
+ default: goto yy41;
}
- goto yy41;
-}
}
state_before_val:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
{
YYCTYPE yych;
@@ -696,14 +720,18 @@ state_before_val:
yy46:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych == ' ') goto yy48;
- if(yych == '=') goto yy50;
- goto yy52;
+ switch(yych){
+ case ' ': goto yy48;
+ case '=': goto yy50;
+ default: goto yy52;
+ }
yy48: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
- goto yy49;
+ switch(yych){
+ case ' ': goto yy55;
+ case '=': goto yy53;
+ default: goto yy49;
+ }
yy49:
{ --YYCURSOR; goto state_next_arg_begin; }
yy50: ++YYCURSOR;
@@ -717,63 +745,29 @@ yy53: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy54;
-yy54: if(yybm[0+yych] & 128) {
- goto yy53;
+yy54: switch(yych){
+ case ' ': goto yy53;
+ default: goto yy51;
}
- goto yy51;
yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy56;
-yy56: if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
- goto yy57;
+yy56: switch(yych){
+ case ' ': goto yy55;
+ case '=': goto yy53;
+ default: goto yy57;
+ }
yy57: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy49;
}
}
-}
state_val:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 160, 160, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 160, 248, 56, 248, 248, 248, 248, 200,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 0, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- };
{
YYCTYPE yych;
@@ -783,29 +777,18 @@ state_val:
yy58:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
- if(yych <= '!'){
- if(yych <= 0x0A){
- if(yych <= 0x08) goto yy63;
- goto yy64;
- } else {
- if(yych == ' ') goto yy64;
- goto yy63;
- }
- } else {
- if(yych <= '\''){
- if(yych <= '"') goto yy60;
- if(yych <= '&') goto yy63;
- goto yy62;
- } else {
- if(yych == '>') goto yy64;
- goto yy63;
- }
+ switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy64;
+ case '"': goto yy60;
+ case '\'': goto yy62;
+ default: goto yy63;
}
yy60: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy77;
yy61:
-{ handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
+{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
yy62: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy69;
@@ -819,38 +802,40 @@ yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy67;
-yy67: if(yybm[0+yych] & 8) {
- goto yy66;
+yy67: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy61;
+ default: goto yy66;
}
- goto yy61;
yy68: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy69;
-yy69: if(yybm[0+yych] & 16) {
- goto yy68;
+yy69: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': goto yy72;
+ case '\'': goto yy70;
+ case '>': goto yy61;
+ default: goto yy68;
}
- if(yych <= '&') goto yy72;
- if(yych >= '(') goto yy61;
- goto yy70;
yy70: ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 8) {
- yych = *YYCURSOR;
- goto yy66;
+ switch((yych = *YYCURSOR)) {
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy71;
+ default: goto yy66;
}
- goto yy71;
yy71:
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy73;
-yy73: if(yybm[0+yych] & 32) {
- goto yy72;
+yy73: switch(yych){
+ case '\'': goto yy75;
+ case '>': goto yy74;
+ default: goto yy72;
}
- if(yych <= '=') goto yy75;
- goto yy74;
yy74: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy61;
@@ -862,34 +847,34 @@ yy76: yyaccept = 0;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy77;
-yy77: if(yybm[0+yych] & 64) {
- goto yy76;
+yy77: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': goto yy80;
+ case '"': goto yy78;
+ case '>': goto yy61;
+ default: goto yy76;
}
- if(yych <= '!') goto yy80;
- if(yych >= '#') goto yy61;
- goto yy78;
yy78: ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 8) {
- yych = *YYCURSOR;
- goto yy66;
+ switch((yych = *YYCURSOR)) {
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy79;
+ default: goto yy66;
}
- goto yy79;
yy79:
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy81;
-yy81: if(yybm[0+yych] & 128) {
- goto yy80;
+yy81: switch(yych){
+ case '"': goto yy82;
+ case '>': goto yy74;
+ default: goto yy80;
}
- if(yych >= '>') goto yy74;
- goto yy82;
yy82: ++YYCURSOR;
yych = *YYCURSOR;
goto yy79;
}
-}
stop:
diff --git a/ext/standard/url_scanner_ex.c.orig b/ext/standard/url_scanner_ex.c.orig
index 2e7e3fed6..083340973 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.9.11 on Sun Jan 1 14:39:52 2006 */
+/* Generated by re2c 0.9.11 on Tue Feb 28 09:38:22 2006 */
#line 1 "ext/standard/url_scanner_ex.re"
/*
+----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.c,v 1.95.2.3 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: url_scanner_ex.c,v 1.95.2.4 2006/02/28 14:45:18 iliaa Exp $ */
#include "php.h"
@@ -109,43 +109,8 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
q = (p = url->c) + url->len;
scan:
-{
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 0, 128, 128, 128, 128, 0,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
-
-#line 149 "ext/standard/url_scanner_ex.c"
+
+#line 114 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
goto yy0;
@@ -153,43 +118,42 @@ scan:
yy0:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) {
- goto yy8;
+ switch(yych){
+ case '#': goto yy6;
+ case ':': goto yy2;
+ case '?': goto yy4;
+ default: goto yy8;
}
- if(yych <= '9') goto yy6;
- if(yych >= ';') goto yy4;
- goto yy2;
yy2: ++YYCURSOR;
goto yy3;
yy3:
#line 115 "ext/standard/url_scanner_ex.re"
{ smart_str_append(dest, url); return; }
-#line 168 "ext/standard/url_scanner_ex.c"
+#line 133 "ext/standard/url_scanner_ex.c"
yy4: ++YYCURSOR;
goto yy5;
yy5:
#line 116 "ext/standard/url_scanner_ex.re"
{ sep = separator; goto scan; }
-#line 174 "ext/standard/url_scanner_ex.c"
+#line 139 "ext/standard/url_scanner_ex.c"
yy6: ++YYCURSOR;
goto yy7;
yy7:
#line 117 "ext/standard/url_scanner_ex.re"
{ bash = p - 1; goto done; }
-#line 180 "ext/standard/url_scanner_ex.c"
+#line 145 "ext/standard/url_scanner_ex.c"
yy8: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
-yy9: if(yybm[0+yych] & 128) {
- goto yy8;
+yy9: switch(yych){
+ case '#': case ':': case '?': goto yy10;
+ default: goto yy8;
}
- goto yy10;
yy10:
#line 118 "ext/standard/url_scanner_ex.re"
{ goto scan; }
-#line 192 "ext/standard/url_scanner_ex.c"
-}
+#line 157 "ext/standard/url_scanner_ex.c"
}
#line 119 "ext/standard/url_scanner_ex.re"
@@ -359,43 +323,8 @@ state_plain_begin:
state_plain:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 0, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- };
-
-#line 399 "ext/standard/url_scanner_ex.c"
+
+#line 328 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
goto yy11;
@@ -403,72 +332,36 @@ state_plain:
yy11:
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
- if(yybm[0+yych] & 128) {
- goto yy15;
+ switch(yych){
+ case '<': goto yy13;
+ default: goto yy15;
}
- goto yy13;
yy13: ++YYCURSOR;
goto yy14;
yy14:
#line 287 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; }
-#line 416 "ext/standard/url_scanner_ex.c"
+#line 345 "ext/standard/url_scanner_ex.c"
yy15: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy16;
-yy16: if(yybm[0+yych] & 128) {
- goto yy15;
+yy16: switch(yych){
+ case '<': goto yy17;
+ default: goto yy15;
}
- goto yy17;
yy17:
#line 288 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain; }
-#line 428 "ext/standard/url_scanner_ex.c"
-}
+#line 357 "ext/standard/url_scanner_ex.c"
}
#line 289 "ext/standard/url_scanner_ex.re"
state_tag:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
-
-#line 472 "ext/standard/url_scanner_ex.c"
+
+#line 365 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
goto yy18;
@@ -476,33 +369,131 @@ state_tag:
yy18:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '@') goto yy22;
- if(yych <= 'Z') goto yy20;
- if(yych <= '`') goto yy22;
- if(yych >= '{') goto yy22;
- goto yy20;
+ switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy20;
+ default: goto yy22;
+ }
yy20: ++YYCURSOR;
yych = *YYCURSOR;
goto yy25;
yy21:
#line 294 "ext/standard/url_scanner_ex.re"
{ handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; }
-#line 491 "ext/standard/url_scanner_ex.c"
+#line 433 "ext/standard/url_scanner_ex.c"
yy22: ++YYCURSOR;
goto yy23;
yy23:
#line 295 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 497 "ext/standard/url_scanner_ex.c"
+#line 439 "ext/standard/url_scanner_ex.c"
yy24: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy25;
-yy25: if(yybm[0+yych] & 128) {
- goto yy24;
+yy25: switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy24;
+ default: goto yy21;
}
- goto yy21;
-}
}
#line 296 "ext/standard/url_scanner_ex.re"
@@ -512,43 +503,8 @@ state_next_arg_begin:
state_next_arg:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
-
-#line 552 "ext/standard/url_scanner_ex.c"
+
+#line 508 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
goto yy26;
@@ -556,102 +512,107 @@ state_next_arg:
yy26:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '='){
- if(yych <= 0x0B){
- if(yych <= 0x08) goto yy34;
- goto yy30;
- } else {
- if(yych == ' ') goto yy30;
- goto yy34;
- }
- } else {
- if(yych <= 'Z'){
- if(yych <= '>') goto yy28;
- if(yych <= '@') goto yy34;
- goto yy32;
- } else {
- if(yych <= '`') goto yy34;
- if(yych <= 'z') goto yy32;
- goto yy34;
- }
+ switch(yych){
+ case 0x09:
+ case 0x0A:
+ case 0x0B: case 0x0D: case ' ': goto yy30;
+ case '>': goto yy28;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy32;
+ default: goto yy34;
}
yy28: ++YYCURSOR;
goto yy29;
yy29:
#line 304 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
-#line 584 "ext/standard/url_scanner_ex.c"
+#line 579 "ext/standard/url_scanner_ex.c"
yy30: ++YYCURSOR;
yych = *YYCURSOR;
goto yy37;
yy31:
#line 305 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg; }
-#line 591 "ext/standard/url_scanner_ex.c"
+#line 586 "ext/standard/url_scanner_ex.c"
yy32: ++YYCURSOR;
goto yy33;
yy33:
#line 306 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
-#line 597 "ext/standard/url_scanner_ex.c"
+#line 592 "ext/standard/url_scanner_ex.c"
yy34: ++YYCURSOR;
goto yy35;
yy35:
#line 307 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_plain_begin; }
-#line 603 "ext/standard/url_scanner_ex.c"
+#line 598 "ext/standard/url_scanner_ex.c"
yy36: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy37;
-yy37: if(yybm[0+yych] & 128) {
- goto yy36;
+yy37: switch(yych){
+ case 0x09:
+ case 0x0A:
+ case 0x0B: case 0x0D: case ' ': goto yy36;
+ default: goto yy31;
}
- goto yy31;
-}
}
#line 308 "ext/standard/url_scanner_ex.re"
state_arg:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 128, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
-
-#line 655 "ext/standard/url_scanner_ex.c"
+
+#line 616 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
goto yy38;
@@ -659,76 +620,139 @@ state_arg:
yy38:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych <= '@') goto yy42;
- if(yych <= 'Z') goto yy40;
- if(yych <= '`') goto yy42;
- if(yych >= '{') goto yy42;
- goto yy40;
+ switch(yych){
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy40;
+ default: goto yy42;
+ }
yy40: ++YYCURSOR;
yych = *YYCURSOR;
goto yy45;
yy41:
#line 313 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; }
-#line 674 "ext/standard/url_scanner_ex.c"
+#line 684 "ext/standard/url_scanner_ex.c"
yy42: ++YYCURSOR;
goto yy43;
yy43:
#line 314 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; }
-#line 680 "ext/standard/url_scanner_ex.c"
+#line 690 "ext/standard/url_scanner_ex.c"
yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy45;
-yy45: if(yybm[0+yych] & 128) {
- goto yy44;
+yy45: switch(yych){
+ case '-': case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z': case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy44;
+ default: goto yy41;
}
- goto yy41;
-}
}
#line 315 "ext/standard/url_scanner_ex.re"
state_before_val:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
-
-#line 732 "ext/standard/url_scanner_ex.c"
+
+#line 756 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -737,91 +761,61 @@ state_before_val:
yy46:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
- if(yych == ' ') goto yy48;
- if(yych == '=') goto yy50;
- goto yy52;
+ switch(yych){
+ case ' ': goto yy48;
+ case '=': goto yy50;
+ default: goto yy52;
+ }
yy48: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
- goto yy49;
+ switch(yych){
+ case ' ': goto yy55;
+ case '=': goto yy53;
+ default: goto yy49;
+ }
yy49:
#line 321 "ext/standard/url_scanner_ex.re"
{ --YYCURSOR; goto state_next_arg_begin; }
-#line 752 "ext/standard/url_scanner_ex.c"
+#line 780 "ext/standard/url_scanner_ex.c"
yy50: ++YYCURSOR;
yych = *YYCURSOR;
goto yy54;
yy51:
#line 320 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; }
-#line 759 "ext/standard/url_scanner_ex.c"
+#line 787 "ext/standard/url_scanner_ex.c"
yy52: yych = *++YYCURSOR;
goto yy49;
yy53: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy54;
-yy54: if(yybm[0+yych] & 128) {
- goto yy53;
+yy54: switch(yych){
+ case ' ': goto yy53;
+ default: goto yy51;
}
- goto yy51;
yy55: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy56;
-yy56: if(yych == ' ') goto yy55;
- if(yych == '=') goto yy53;
- goto yy57;
+yy56: switch(yych){
+ case ' ': goto yy55;
+ case '=': goto yy53;
+ default: goto yy57;
+ }
yy57: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy49;
}
}
-}
#line 322 "ext/standard/url_scanner_ex.re"
state_val:
start = YYCURSOR;
-{
- static unsigned char yybm[] = {
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 160, 160, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 160, 248, 56, 248, 248, 248, 248, 200,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 0, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- 248, 248, 248, 248, 248, 248, 248, 248,
- };
-
-#line 825 "ext/standard/url_scanner_ex.c"
+
+#line 819 "ext/standard/url_scanner_ex.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -830,31 +824,20 @@ state_val:
yy58:
if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
- if(yych <= '!'){
- if(yych <= 0x0A){
- if(yych <= 0x08) goto yy63;
- goto yy64;
- } else {
- if(yych == ' ') goto yy64;
- goto yy63;
- }
- } else {
- if(yych <= '\''){
- if(yych <= '"') goto yy60;
- if(yych <= '&') goto yy63;
- goto yy62;
- } else {
- if(yych == '>') goto yy64;
- goto yy63;
- }
+ switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy64;
+ case '"': goto yy60;
+ case '\'': goto yy62;
+ default: goto yy63;
}
yy60: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy77;
yy61:
#line 330 "ext/standard/url_scanner_ex.re"
-{ handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
-#line 858 "ext/standard/url_scanner_ex.c"
+{ handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
+#line 841 "ext/standard/url_scanner_ex.c"
yy62: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy69;
@@ -865,45 +848,47 @@ yy64: ++YYCURSOR;
yy65:
#line 331 "ext/standard/url_scanner_ex.re"
{ passthru(STD_ARGS); goto state_next_arg_begin; }
-#line 869 "ext/standard/url_scanner_ex.c"
+#line 852 "ext/standard/url_scanner_ex.c"
yy66: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy67;
-yy67: if(yybm[0+yych] & 8) {
- goto yy66;
+yy67: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy61;
+ default: goto yy66;
}
- goto yy61;
yy68: yyaccept = 0;
YYMARKER = ++YYCURSOR;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy69;
-yy69: if(yybm[0+yych] & 16) {
- goto yy68;
+yy69: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': goto yy72;
+ case '\'': goto yy70;
+ case '>': goto yy61;
+ default: goto yy68;
}
- if(yych <= '&') goto yy72;
- if(yych >= '(') goto yy61;
- goto yy70;
yy70: ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 8) {
- yych = *YYCURSOR;
- goto yy66;
+ switch((yych = *YYCURSOR)) {
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy71;
+ default: goto yy66;
}
- goto yy71;
yy71:
#line 329 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
-#line 898 "ext/standard/url_scanner_ex.c"
+#line 883 "ext/standard/url_scanner_ex.c"
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy73;
-yy73: if(yybm[0+yych] & 32) {
- goto yy72;
+yy73: switch(yych){
+ case '\'': goto yy75;
+ case '>': goto yy74;
+ default: goto yy72;
}
- if(yych <= '=') goto yy75;
- goto yy74;
yy74: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy61;
@@ -915,36 +900,36 @@ yy76: yyaccept = 0;
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
goto yy77;
-yy77: if(yybm[0+yych] & 64) {
- goto yy76;
+yy77: switch(yych){
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': goto yy80;
+ case '"': goto yy78;
+ case '>': goto yy61;
+ default: goto yy76;
}
- if(yych <= '!') goto yy80;
- if(yych >= '#') goto yy61;
- goto yy78;
yy78: ++YYCURSOR;
- if(yybm[0+(yych = *YYCURSOR)] & 8) {
- yych = *YYCURSOR;
- goto yy66;
+ switch((yych = *YYCURSOR)) {
+ case 0x09:
+ case 0x0A: case 0x0D: case ' ': case '>': goto yy79;
+ default: goto yy66;
}
- goto yy79;
yy79:
#line 328 "ext/standard/url_scanner_ex.re"
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
-#line 934 "ext/standard/url_scanner_ex.c"
+#line 920 "ext/standard/url_scanner_ex.c"
yy80: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy81;
-yy81: if(yybm[0+yych] & 128) {
- goto yy80;
+yy81: switch(yych){
+ case '"': goto yy82;
+ case '>': goto yy74;
+ default: goto yy80;
}
- if(yych >= '>') goto yy74;
- goto yy82;
yy82: ++YYCURSOR;
yych = *YYCURSOR;
goto yy79;
}
-}
#line 332 "ext/standard/url_scanner_ex.re"
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index c5d60a888..1108af54a 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: url_scanner_ex.re,v 1.76.2.1 2006/01/01 12:26:08 sniper Exp $ */
+/* $Id: url_scanner_ex.re,v 1.76.2.2 2006/02/28 14:45:18 iliaa Exp $ */
#include "php.h"
@@ -302,7 +302,7 @@ state_next_arg:
start = YYCURSOR;
/*!re2c
">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; }
- [ \v\t\n]+ { passthru(STD_ARGS); goto state_next_arg; }
+ [ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; }
alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; }
any { passthru(STD_ARGS); goto state_plain_begin; }
*/
@@ -327,7 +327,7 @@ state_val:
/*!re2c
["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; }
- (any\[ \t\n>])+ { handle_val(STD_ARGS, 0, '\0'); goto state_next_arg_begin; }
+ (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; }
any { passthru(STD_ARGS); goto state_next_arg_begin; }
*/
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index d275f55e4..cffc28dda 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: user_filters.c,v 1.31.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: user_filters.c,v 1.31.2.4 2006/03/30 21:10:23 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -64,6 +64,15 @@ static zend_function_entry user_filter_class_funcs[] = {
static zend_class_entry user_filter_class_entry;
+static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor)
+{
+ php_stream_bucket *bucket = (php_stream_bucket *)rsrc->ptr;
+ if (bucket) {
+ php_stream_bucket_delref(bucket TSRMLS_CC);
+ bucket = NULL;
+ }
+}
+
PHP_MINIT_FUNCTION(user_filters)
{
/* init the filter class ancestor */
@@ -83,7 +92,7 @@ PHP_MINIT_FUNCTION(user_filters)
/* Filters will dispose of their brigades */
le_bucket_brigade = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_BRIGADE_RES_NAME, module_number);
/* Brigades will dispose of their buckets */
- le_bucket = zend_register_list_destructors_ex(NULL, NULL, PHP_STREAM_BUCKET_RES_NAME, module_number);
+ le_bucket = zend_register_list_destructors_ex(php_bucket_dtor, NULL, PHP_STREAM_BUCKET_RES_NAME, module_number);
if (le_bucket_brigade == FAILURE) {
return FAILURE;
@@ -406,7 +415,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
if (!bucket->own_buf) {
bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC);
}
- if (bucket->buflen != Z_STRLEN_PP(pzdata)) {
+ if ((int)bucket->buflen != Z_STRLEN_PP(pzdata)) {
bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent);
bucket->buflen = Z_STRLEN_PP(pzdata);
}
@@ -418,6 +427,12 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
} else {
php_stream_bucket_prepend(brigade, bucket TSRMLS_CC);
}
+ /* This is a hack necessary to accomodate situations where bucket is appended to the stream
+ * multiple times. See bug35916.phpt for reference.
+ */
+ if (bucket->refcount == 1) {
+ bucket->refcount++;
+ }
}
/* }}} */
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 233f318c1..a1311a198 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.203.2.5 2006/01/01 12:50:16 sniper Exp $ */
+/* $Id: var.c,v 1.203.2.7 2006/04/05 02:28:06 iliaa Exp $ */
@@ -221,12 +221,44 @@ static int zval_array_element_dump(zval **zv, int num_args, va_list args, zend_h
return 0;
}
+static int zval_object_property_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
+{
+ int level;
+ char *prop_name, *class_name;
+ TSRMLS_FETCH();
+
+ level = va_arg(args, int);
+
+ if (hash_key->nKeyLength ==0 ) { /* numeric key */
+ php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
+ } else { /* string key */
+ zend_unmangle_property_name_ex(hash_key->arKey, hash_key->nKeyLength, &class_name, &prop_name);
+ if (class_name) {
+ php_printf("%*c[\"%s", level + 1, ' ', prop_name);
+ if (class_name[0]=='*') {
+ ZEND_PUTS(":protected");
+ } else {
+ ZEND_PUTS(":private");
+ }
+ } else {
+ php_printf("%*c[\"%s", level + 1, ' ', hash_key->arKey);
+#ifdef ANDREY_0
+ ZEND_PUTS(":public");
+#endif
+ }
+ ZEND_PUTS("\"]=>\n");
+ }
+ php_debug_zval_dump(zv, level + 2 TSRMLS_CC);
+ return 0;
+}
+
PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC)
{
HashTable *myht = NULL;
char *class_name;
zend_uint class_name_len;
zend_class_entry *ce;
+ int (*zval_element_dump_func)(zval**, int, va_list, zend_hash_key*);
if (level > 1) {
php_printf("%*c", level - 1, ' ');
@@ -257,6 +289,7 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC)
return;
}
php_printf("%sarray(%d) refcount(%u){\n", COMMON, zend_hash_num_elements(myht), Z_REFCOUNT_PP(struc));
+ zval_element_dump_func = zval_array_element_dump;
goto head_done;
case IS_OBJECT:
myht = Z_OBJPROP_PP(struc);
@@ -268,9 +301,10 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level TSRMLS_DC)
Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC);
php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc));
efree(class_name);
+ zval_element_dump_func = zval_object_property_dump;
head_done:
if (myht) {
- zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1));
+ zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_element_dump_func, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1));
}
if (level > 1) {
php_printf("%*c", level-1, ' ');
@@ -781,10 +815,18 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
if (zend_hash_get_current_data_ex(myht,
(void **) &data, &pos) != SUCCESS
|| !data
- || data == struc) {
+ || data == struc
+ || (Z_TYPE_PP(data) == IS_ARRAY && Z_ARRVAL_PP(data)->nApplyCount > 1)
+ ) {
smart_str_appendl(buf, "N;", 2);
} else {
+ if (Z_TYPE_PP(data) == IS_ARRAY) {
+ Z_ARRVAL_PP(data)->nApplyCount++;
+ }
php_var_serialize_intern(buf, data, var_hash TSRMLS_CC);
+ if (Z_TYPE_PP(data) == IS_ARRAY) {
+ Z_ARRVAL_PP(data)->nApplyCount--;
+ }
}
}
}