mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Merge branch 'master' into resource-api
This commit is contained in:
commit
38829b3b4b
2
NEWS
2
NEWS
@ -132,6 +132,8 @@
|
||||
. Remove string category support in setlocale(). (Nikita)
|
||||
. Remove set_magic_quotes_runtime() and its alias magic_quotes_runtime().
|
||||
(Nikita)
|
||||
. Fixed bug #65272 (flock() out parameter not set correctly in windows).
|
||||
(Daniel Lowrey)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #68532 (convert.base64-encode omits padding bytes).
|
||||
|
@ -34,7 +34,7 @@ API adjustment to the old output control code:
|
||||
php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
|
||||
|
||||
Flushing one output buffer:
|
||||
// php_ob_end_buffer(1, 1 TSRMLS_CC);
|
||||
// php_end_ob_buffer(1, 1 TSRMLS_CC);
|
||||
php_output_flush(TSRMLS_C);
|
||||
|
||||
Flushing all output buffers:
|
||||
|
16
Zend/tests/globals_005.phpt
Normal file
16
Zend/tests/globals_005.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
$GLOBALS resize
|
||||
--FILE--
|
||||
<?php
|
||||
function foo() {
|
||||
for ($i = 0; $i < 100; $i++) {
|
||||
$GLOBALS["A". $i] = 1; //trigger resize
|
||||
}
|
||||
return "ops";
|
||||
}
|
||||
|
||||
$GLOBALS[foo()] = "ops";
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
@ -1029,7 +1029,7 @@ void zend_do_early_binding(void) /* {{{ */
|
||||
zend_class_entry *ce;
|
||||
|
||||
parent_name = CT_CONSTANT(fetch_class_opline->op2);
|
||||
if (((ce = zend_lookup_class(Z_STR_P(parent_name))) == NULL) ||
|
||||
if (((ce = zend_lookup_class_ex(Z_STR_P(parent_name), parent_name + 1, 0)) == NULL) ||
|
||||
((CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES) &&
|
||||
(ce->type == ZEND_INTERNAL_CLASS))) {
|
||||
if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) {
|
||||
@ -1083,7 +1083,8 @@ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array) /* {{
|
||||
|
||||
CG(in_compilation) = 1;
|
||||
while (opline_num != (uint32_t)-1) {
|
||||
if ((ce = zend_lookup_class(Z_STR_P(RT_CONSTANT(op_array, op_array->opcodes[opline_num-1].op2)))) != NULL) {
|
||||
zval *parent_name = RT_CONSTANT(op_array, op_array->opcodes[opline_num-1].op2);
|
||||
if ((ce = zend_lookup_class_ex(Z_STR_P(parent_name), parent_name + 1, 0)) != NULL) {
|
||||
do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0);
|
||||
}
|
||||
opline_num = op_array->opcodes[opline_num].result.opline_num;
|
||||
@ -1789,8 +1790,16 @@ static inline zend_op *zend_delayed_emit_op(znode *result, zend_uchar opcode, zn
|
||||
zend_op tmp_opline;
|
||||
init_op(&tmp_opline);
|
||||
tmp_opline.opcode = opcode;
|
||||
SET_NODE(tmp_opline.op1, op1);
|
||||
SET_NODE(tmp_opline.op2, op2);
|
||||
if (op1 == NULL) {
|
||||
SET_UNUSED(tmp_opline.op1);
|
||||
} else {
|
||||
SET_NODE(tmp_opline.op1, op1);
|
||||
}
|
||||
if (op2 == NULL) {
|
||||
SET_UNUSED(tmp_opline.op2);
|
||||
} else {
|
||||
SET_NODE(tmp_opline.op2, op2);
|
||||
}
|
||||
if (result) {
|
||||
zend_make_var_result(result, &tmp_opline);
|
||||
}
|
||||
@ -1984,7 +1993,7 @@ static int zend_try_compile_cv(znode *result, zend_ast *ast) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */
|
||||
{
|
||||
zend_ast *name_ast = ast->child[0];
|
||||
znode name_node;
|
||||
@ -2003,7 +2012,11 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
|
||||
convert_to_string(&name_node.u.constant);
|
||||
}
|
||||
|
||||
opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
|
||||
if (delayed) {
|
||||
opline = zend_delayed_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
|
||||
} else {
|
||||
opline = zend_emit_op(result, ZEND_FETCH_R, &name_node, NULL);
|
||||
}
|
||||
|
||||
opline->extended_value = ZEND_FETCH_LOCAL;
|
||||
if (name_node.op_type == IS_CONST) {
|
||||
@ -2016,10 +2029,10 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
static void zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */
|
||||
{
|
||||
if (zend_try_compile_cv(result, ast) == FAILURE) {
|
||||
zend_op *opline = zend_compile_simple_var_no_cv(result, ast, type);
|
||||
zend_op *opline = zend_compile_simple_var_no_cv(result, ast, type, delayed);
|
||||
zend_adjust_for_fetch_type(opline, type);
|
||||
}
|
||||
}
|
||||
@ -2151,7 +2164,7 @@ void zend_compile_prop(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
zend_op *zend_compile_static_prop_common(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
zend_op *zend_compile_static_prop_common(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */
|
||||
{
|
||||
zend_ast *class_ast = ast->child[0];
|
||||
zend_ast *prop_ast = ast->child[1];
|
||||
@ -2168,7 +2181,11 @@ zend_op *zend_compile_static_prop_common(znode *result, zend_ast *ast, uint32_t
|
||||
|
||||
zend_compile_expr(&prop_node, prop_ast);
|
||||
|
||||
opline = zend_emit_op(result, ZEND_FETCH_R, &prop_node, NULL);
|
||||
if (delayed) {
|
||||
opline = zend_delayed_emit_op(result, ZEND_FETCH_R, &prop_node, NULL);
|
||||
} else {
|
||||
opline = zend_emit_op(result, ZEND_FETCH_R, &prop_node, NULL);
|
||||
}
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
zend_alloc_polymorphic_cache_slot(opline->op1.constant);
|
||||
}
|
||||
@ -2185,9 +2202,9 @@ zend_op *zend_compile_static_prop_common(znode *result, zend_ast *ast, uint32_t
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
void zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
void zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */
|
||||
{
|
||||
zend_op *opline = zend_compile_static_prop_common(result, ast, type);
|
||||
zend_op *opline = zend_compile_static_prop_common(result, ast, type, delayed);
|
||||
zend_adjust_for_fetch_type(opline, type);
|
||||
}
|
||||
/* }}} */
|
||||
@ -2291,7 +2308,7 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
|
||||
|
||||
if (zend_is_assign_to_self(var_ast, expr_ast)) {
|
||||
/* $a[0] = $a should evaluate the right $a first */
|
||||
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R);
|
||||
zend_compile_simple_var_no_cv(&expr_node, expr_ast, BP_VAR_R, 0);
|
||||
} else {
|
||||
zend_compile_expr(&expr_node, expr_ast);
|
||||
}
|
||||
@ -3088,7 +3105,7 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */
|
||||
opline = zend_emit_op(NULL, ZEND_UNSET_VAR, &var_node, NULL);
|
||||
opline->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
|
||||
} else {
|
||||
opline = zend_compile_simple_var_no_cv(NULL, var_ast, BP_VAR_UNSET);
|
||||
opline = zend_compile_simple_var_no_cv(NULL, var_ast, BP_VAR_UNSET, 0);
|
||||
opline->opcode = ZEND_UNSET_VAR;
|
||||
}
|
||||
return;
|
||||
@ -3101,7 +3118,7 @@ void zend_compile_unset(zend_ast *ast) /* {{{ */
|
||||
opline->opcode = ZEND_UNSET_OBJ;
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
opline = zend_compile_static_prop_common(NULL, var_ast, BP_VAR_UNSET);
|
||||
opline = zend_compile_static_prop_common(NULL, var_ast, BP_VAR_UNSET, 0);
|
||||
opline->opcode = ZEND_UNSET_VAR;
|
||||
return;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
@ -5613,7 +5630,7 @@ void zend_compile_isset_or_empty(znode *result, zend_ast *ast) /* {{{ */
|
||||
opline = zend_emit_op(result, ZEND_ISSET_ISEMPTY_VAR, &var_node, NULL);
|
||||
opline->extended_value = ZEND_FETCH_LOCAL | ZEND_QUICK_SET;
|
||||
} else {
|
||||
opline = zend_compile_simple_var_no_cv(result, var_ast, BP_VAR_IS);
|
||||
opline = zend_compile_simple_var_no_cv(result, var_ast, BP_VAR_IS, 0);
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_VAR;
|
||||
}
|
||||
break;
|
||||
@ -5626,7 +5643,7 @@ void zend_compile_isset_or_empty(znode *result, zend_ast *ast) /* {{{ */
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_PROP_OBJ;
|
||||
break;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
opline = zend_compile_static_prop_common(result, var_ast, BP_VAR_IS);
|
||||
opline = zend_compile_static_prop_common(result, var_ast, BP_VAR_IS, 0);
|
||||
opline->opcode = ZEND_ISSET_ISEMPTY_VAR;
|
||||
break;
|
||||
EMPTY_SWITCH_DEFAULT_CASE()
|
||||
@ -5650,7 +5667,7 @@ void zend_compile_silence(znode *result, zend_ast *ast) /* {{{ */
|
||||
if (expr_ast->kind == ZEND_AST_VAR) {
|
||||
/* For @$var we need to force a FETCH instruction, otherwise the CV access will
|
||||
* happen outside the silenced section. */
|
||||
zend_compile_simple_var_no_cv(result, expr_ast, BP_VAR_R);
|
||||
zend_compile_simple_var_no_cv(result, expr_ast, BP_VAR_R, 0 );
|
||||
} else {
|
||||
zend_compile_expr(result, expr_ast);
|
||||
}
|
||||
@ -6406,7 +6423,7 @@ void zend_compile_var(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
{
|
||||
switch (ast->kind) {
|
||||
case ZEND_AST_VAR:
|
||||
zend_compile_simple_var(result, ast, type);
|
||||
zend_compile_simple_var(result, ast, type, 0);
|
||||
return;
|
||||
case ZEND_AST_DIM:
|
||||
zend_compile_dim(result, ast, type);
|
||||
@ -6415,7 +6432,7 @@ void zend_compile_var(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
|
||||
zend_compile_prop(result, ast, type);
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
zend_compile_static_prop(result, ast, type);
|
||||
zend_compile_static_prop(result, ast, type, 0);
|
||||
return;
|
||||
case ZEND_AST_CALL:
|
||||
zend_compile_call(result, ast, type);
|
||||
@ -6447,6 +6464,9 @@ void zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type) /* {{
|
||||
{
|
||||
zend_op *opline;
|
||||
switch (ast->kind) {
|
||||
case ZEND_AST_VAR:
|
||||
zend_compile_simple_var(result, ast, type, 1);
|
||||
return;
|
||||
case ZEND_AST_DIM:
|
||||
opline = zend_delayed_compile_dim(result, ast, type);
|
||||
zend_adjust_for_fetch_type(opline, type);
|
||||
@ -6455,6 +6475,9 @@ void zend_delayed_compile_var(znode *result, zend_ast *ast, uint32_t type) /* {{
|
||||
opline = zend_delayed_compile_prop(result, ast, type);
|
||||
zend_adjust_for_fetch_type(opline, type);
|
||||
return;
|
||||
case ZEND_AST_STATIC_PROP:
|
||||
zend_compile_static_prop(result, ast, type, 1);
|
||||
return;
|
||||
default:
|
||||
zend_compile_var(result, ast, type);
|
||||
return;
|
||||
|
@ -37,13 +37,8 @@ typedef int64_t zend_off_t;
|
||||
# define ZEND_LONG_MAX INT64_MAX
|
||||
# define ZEND_LONG_MIN INT64_MIN
|
||||
# define ZEND_ULONG_MAX UINT64_MAX
|
||||
# ifdef _WIN64
|
||||
# define Z_L(i) i##i64
|
||||
# define Z_UL(i) i##Ui64
|
||||
# else
|
||||
# define Z_L(i) i##LL
|
||||
# define Z_UL(i) i##ULL
|
||||
# endif
|
||||
# define Z_L(i) INT64_C(i)
|
||||
# define Z_UL(i) UINT64_C(i)
|
||||
# define SIZEOF_ZEND_LONG 8
|
||||
#else
|
||||
typedef int32_t zend_long;
|
||||
|
@ -838,6 +838,7 @@ static PHP_FUNCTION(json_decode)
|
||||
JSON_G(error_code) = 0;
|
||||
|
||||
if (!str_len) {
|
||||
JSON_G(error_code) = PHP_JSON_ERROR_SYNTAX;
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,16 @@ json_decode("invalid json");
|
||||
var_dump(json_last_error());
|
||||
|
||||
|
||||
json_decode("\001 invalid json");
|
||||
var_dump(json_last_error());
|
||||
|
||||
|
||||
json_decode("");
|
||||
var_dump(json_last_error());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
int(0)
|
||||
int(4)
|
||||
int(0)
|
||||
int(4)
|
||||
int(3)
|
||||
int(4)
|
||||
|
11
ext/json/tests/bug68938.phpt
Normal file
11
ext/json/tests/bug68938.phpt
Normal file
@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #68938 (json_decode() decodes empty string without indicating error)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("json")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
json_decode("");
|
||||
var_dump(json_last_error());
|
||||
?>
|
||||
--EXPECT--
|
||||
int(4)
|
@ -4195,7 +4195,7 @@ PHP_FUNCTION(pg_copy_to)
|
||||
PHP_FUNCTION(pg_copy_from)
|
||||
{
|
||||
zval *pgsql_link = NULL, *pg_rows;
|
||||
zval *tmp;
|
||||
zval *value;
|
||||
char *table_name, *pg_delim = NULL, *pg_null_as = NULL;
|
||||
size_t table_name_len, pg_delim_len, pg_null_as_len;
|
||||
int pg_null_as_free = 0;
|
||||
@ -4245,39 +4245,49 @@ PHP_FUNCTION(pg_copy_from)
|
||||
int command_failed = 0;
|
||||
PQclear(pgsql_result);
|
||||
#if HAVE_PQPUTCOPYDATA
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) {
|
||||
convert_to_string_ex(tmp);
|
||||
query = (char *)emalloc(Z_STRLEN_P(tmp) + 2);
|
||||
strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2);
|
||||
if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
|
||||
strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), value) {
|
||||
zval tmp;
|
||||
ZVAL_DUP(&tmp, value);
|
||||
convert_to_string_ex(&tmp);
|
||||
query = (char *)emalloc(Z_STRLEN(tmp) + 2);
|
||||
strlcpy(query, Z_STRVAL(tmp), Z_STRLEN(tmp) + 2);
|
||||
if(Z_STRLEN(tmp) > 0 && *(query + Z_STRLEN(tmp) - 1) != '\n') {
|
||||
strlcat(query, "\n", Z_STRLEN(tmp) + 2);
|
||||
}
|
||||
if (PQputCopyData(pgsql, query, (int)strlen(query)) != 1) {
|
||||
efree(query);
|
||||
zval_dtor(&tmp);
|
||||
PHP_PQ_ERROR("copy failed: %s", pgsql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(query);
|
||||
zval_dtor(&tmp);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (PQputCopyEnd(pgsql, NULL) != 1) {
|
||||
PHP_PQ_ERROR("putcopyend failed: %s", pgsql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) {
|
||||
convert_to_string_ex(tmp);
|
||||
query = (char *)emalloc(Z_STRLEN_P(tmp) + 2);
|
||||
strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2);
|
||||
if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
|
||||
strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), value) {
|
||||
zval tmp;
|
||||
ZVAL_DUP(&tmp, value);
|
||||
convert_to_string_ex(&tmp);
|
||||
query = (char *)emalloc(Z_STRLEN(tmp) + 2);
|
||||
strlcpy(query, Z_STRVAL(tmp), Z_STRLEN(tmp) + 2);
|
||||
if(Z_STRLEN(tmp) > 0 && *(query + Z_STRLEN(tmp) - 1) != '\n') {
|
||||
strlcat(query, "\n", Z_STRLEN(tmp) + 2);
|
||||
}
|
||||
if (PQputline(pgsql, query)==EOF) {
|
||||
efree(query);
|
||||
zval_dtor(&tmp);
|
||||
PHP_PQ_ERROR("copy failed: %s", pgsql);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(query);
|
||||
zval_dtor(&tmp);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if (PQputline(pgsql, "\\.\n") == EOF) {
|
||||
PHP_PQ_ERROR("putline failed: %s", pgsql);
|
||||
RETURN_FALSE;
|
||||
|
40
ext/pgsql/tests/bug65119.phpt
Normal file
40
ext/pgsql/tests/bug65119.phpt
Normal file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Bug #65119 (pg_copy_from() modifies input array variable)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include("skipif.inc");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
function test(Array $values, $conn_str) {
|
||||
$connection = pg_pconnect($conn_str, PGSQL_CONNECT_FORCE_NEW);
|
||||
pg_query("begin");
|
||||
pg_query("CREATE TABLE bug65119 (i INTEGER)");
|
||||
pg_copy_from($connection, "bug65119", $values, "\t", "NULL");
|
||||
pg_query("rollback");
|
||||
}
|
||||
|
||||
$values = Array(1,2,3);
|
||||
var_dump($values);
|
||||
test($values, $conn_str);
|
||||
var_dump($values);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
@ -159,6 +159,7 @@ static void ps_files_open(ps_files *data, const char *key)
|
||||
#if !defined(O_NOFOLLOW) || !defined(PHP_WIN32)
|
||||
struct stat sbuf;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
|
||||
if (data->lastkey) {
|
||||
@ -201,7 +202,9 @@ static void ps_files_open(ps_files *data, const char *key)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
flock(data->fd, LOCK_EX);
|
||||
do {
|
||||
ret = flock(data->fd, LOCK_EX);
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
|
||||
#ifdef F_SETFD
|
||||
# ifndef FD_CLOEXEC
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$2" = "" ]] || [[ "$3" = "" ]]; then
|
||||
echo "Usage: $0 BASE_DIRECTORY DEPTH HASH_BITS"
|
||||
@ -61,5 +61,5 @@ echo "Creating session path in $directory with a depth of $depth for session.has
|
||||
for i in $hash_chars; do
|
||||
newpath="$directory/$i"
|
||||
mkdir $newpath || exit 1
|
||||
/bin/bash $0 $newpath `expr $depth - 1` $hashbits recurse
|
||||
bash $0 $newpath `expr $depth - 1` $hashbits recurse
|
||||
done
|
||||
|
@ -356,13 +356,13 @@ PS_READ_FUNC(mm)
|
||||
|
||||
/* If there is an ID and strict mode, verify existence */
|
||||
if (PS(use_strict_mode)
|
||||
&& ps_mm_key_exists(data, key) == FAILURE) {
|
||||
&& ps_mm_key_exists(data, key->val) == FAILURE) {
|
||||
/* key points to PS(id), but cannot change here. */
|
||||
if (key) {
|
||||
efree(PS(id));
|
||||
PS(id) = NULL;
|
||||
}
|
||||
PS(id) = PS(mod)->s_create_sid((void **)&data, NULL);
|
||||
PS(id) = PS(mod)->s_create_sid((void **)&data);
|
||||
if (!PS(id)) {
|
||||
return FAILURE;
|
||||
}
|
||||
@ -373,12 +373,9 @@ PS_READ_FUNC(mm)
|
||||
PS(session_status) = php_session_active;
|
||||
}
|
||||
|
||||
sd = ps_sd_lookup(data, PS(id), 0);
|
||||
sd = ps_sd_lookup(data, PS(id)->val, 0);
|
||||
if (sd) {
|
||||
*vallen = sd->datalen;
|
||||
*val = emalloc(sd->datalen + 1);
|
||||
memcpy(*val, sd->data, sd->datalen);
|
||||
(*val)[sd->datalen] = '\0';
|
||||
*val = zend_string_init(sd->data, sd->datalen, 0);
|
||||
ret = SUCCESS;
|
||||
}
|
||||
|
||||
@ -394,18 +391,18 @@ PS_WRITE_FUNC(mm)
|
||||
|
||||
mm_lock(data->mm, MM_LOCK_RW);
|
||||
|
||||
sd = ps_sd_lookup(data, key, 1);
|
||||
sd = ps_sd_lookup(data, key->val, 1);
|
||||
if (!sd) {
|
||||
sd = ps_sd_new(data, key);
|
||||
ps_mm_debug(("new entry for %s\n", key));
|
||||
sd = ps_sd_new(data, key->val);
|
||||
ps_mm_debug(("new entry for %s\n", key->val));
|
||||
}
|
||||
|
||||
if (sd) {
|
||||
if (vallen >= sd->alloclen) {
|
||||
if (val->len >= sd->alloclen) {
|
||||
if (data->mm) {
|
||||
mm_free(data->mm, sd->data);
|
||||
}
|
||||
sd->alloclen = vallen + 1;
|
||||
sd->alloclen = val->len + 1;
|
||||
sd->data = mm_malloc(data->mm, sd->alloclen);
|
||||
|
||||
if (!sd->data) {
|
||||
@ -415,8 +412,8 @@ PS_WRITE_FUNC(mm)
|
||||
}
|
||||
}
|
||||
if (sd) {
|
||||
sd->datalen = vallen;
|
||||
memcpy(sd->data, val, vallen);
|
||||
sd->datalen = val->len;
|
||||
memcpy(sd->data, val->val, val->len);
|
||||
time(&sd->ctime);
|
||||
}
|
||||
}
|
||||
@ -433,7 +430,7 @@ PS_DESTROY_FUNC(mm)
|
||||
|
||||
mm_lock(data->mm, MM_LOCK_RW);
|
||||
|
||||
sd = ps_sd_lookup(data, key, 0);
|
||||
sd = ps_sd_lookup(data, key->val, 0);
|
||||
if (sd) {
|
||||
ps_sd_destroy(data, sd);
|
||||
}
|
||||
@ -478,16 +475,16 @@ PS_GC_FUNC(mm)
|
||||
|
||||
PS_CREATE_SID_FUNC(mm)
|
||||
{
|
||||
char *sid;
|
||||
zend_string *sid;
|
||||
int maxfail = 3;
|
||||
PS_MM_DATA;
|
||||
|
||||
do {
|
||||
sid = php_session_create_id((void **)&data, newlen);
|
||||
sid = php_session_create_id((void **)&data);
|
||||
/* Check collision */
|
||||
if (ps_mm_key_exists(data, sid) == SUCCESS) {
|
||||
if (ps_mm_key_exists(data, sid->val) == SUCCESS) {
|
||||
if (sid) {
|
||||
efree(sid);
|
||||
zend_string_release(sid);
|
||||
sid = NULL;
|
||||
}
|
||||
if (!(maxfail--)) {
|
||||
|
@ -186,8 +186,7 @@ typedef struct _php_ps_globals {
|
||||
zend_bool auto_start;
|
||||
zend_bool use_cookies;
|
||||
zend_bool use_only_cookies;
|
||||
zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
|
||||
zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */
|
||||
zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */
|
||||
|
||||
zend_long hash_func;
|
||||
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
|
||||
|
@ -93,6 +93,8 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
|
||||
return FAILURE; \
|
||||
}
|
||||
|
||||
#define APPLY_TRANS_SID (PS(use_trans_sid) && !PS(use_only_cookies))
|
||||
|
||||
static void php_session_send_cookie(void);
|
||||
|
||||
/* Dispatched by RINIT and by php_session_destroy */
|
||||
@ -535,13 +537,6 @@ static void php_session_initialize(void) /* {{{ */
|
||||
php_session_decode(val);
|
||||
zend_string_release(val);
|
||||
}
|
||||
|
||||
if (!PS(use_cookies) && PS(send_cookie)) {
|
||||
if (PS(use_trans_sid) && !PS(use_only_cookies)) {
|
||||
PS(apply_trans_sid) = 1;
|
||||
}
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1463,7 +1458,7 @@ PHPAPI void php_session_reset_id(void) /* {{{ */
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
|
||||
/* if the SID constant exists, destroy it. */
|
||||
/* If the SID constant exists, destroy it. */
|
||||
/* We must not delete any items in EG(zend_contants) */
|
||||
/* zend_hash_str_del(EG(zend_constants), "sid", sizeof("sid") - 1); */
|
||||
sid = zend_get_constant_str("SID", sizeof("SID") - 1);
|
||||
@ -1491,8 +1486,8 @@ PHPAPI void php_session_reset_id(void) /* {{{ */
|
||||
}
|
||||
}
|
||||
|
||||
if (PS(apply_trans_sid)) {
|
||||
php_url_scanner_reset_vars();
|
||||
if (APPLY_TRANS_SID) {
|
||||
/* php_url_scanner_reset_vars(); */
|
||||
php_url_scanner_add_var(PS(session_name), strlen(PS(session_name)), PS(id)->val, PS(id)->len, 1);
|
||||
}
|
||||
}
|
||||
@ -1506,12 +1501,6 @@ PHPAPI void php_session_start(void) /* {{{ */
|
||||
int nrand;
|
||||
size_t lensess;
|
||||
|
||||
if (PS(use_only_cookies)) {
|
||||
PS(apply_trans_sid) = 0;
|
||||
} else {
|
||||
PS(apply_trans_sid) = PS(use_trans_sid);
|
||||
}
|
||||
|
||||
switch (PS(session_status)) {
|
||||
case php_session_active:
|
||||
php_error(E_NOTICE, "A session had already been started - ignoring session_start()");
|
||||
@ -1540,14 +1529,20 @@ PHPAPI void php_session_start(void) /* {{{ */
|
||||
|
||||
default:
|
||||
case php_session_none:
|
||||
PS(define_sid) = 1;
|
||||
PS(send_cookie) = 1;
|
||||
/* Setup internal flags */
|
||||
PS(define_sid) = !PS(use_only_cookies); /* SID constant is defined when non-cookie ID is used */
|
||||
PS(send_cookie) = PS(use_cookies) || PS(use_only_cookies);
|
||||
}
|
||||
|
||||
lensess = strlen(PS(session_name));
|
||||
|
||||
/* Cookies are preferred, because initially
|
||||
* cookie and get variables will be available. */
|
||||
/*
|
||||
* Cookies are preferred, because initially cookie and get
|
||||
* variables will be available.
|
||||
* URL/POST session ID may be used when use_only_cookies=Off.
|
||||
* session.use_strice_mode=On prevents session adoption.
|
||||
* Session based file upload progress uses non-cookie ID.
|
||||
*/
|
||||
|
||||
if (!PS(id)) {
|
||||
if (PS(use_cookies) && (data = zend_hash_str_find(&EG(symbol_table).ht, "_COOKIE", sizeof("_COOKIE") - 1)) &&
|
||||
@ -1555,11 +1550,10 @@ PHPAPI void php_session_start(void) /* {{{ */
|
||||
(ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess))
|
||||
) {
|
||||
ppid2sid(ppid);
|
||||
PS(apply_trans_sid) = 0;
|
||||
PS(define_sid) = 0;
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
|
||||
if (!PS(use_only_cookies) && !PS(id) &&
|
||||
if (PS(define_sid) && !PS(id) &&
|
||||
(data = zend_hash_str_find(&EG(symbol_table).ht, "_GET", sizeof("_GET") - 1)) &&
|
||||
Z_TYPE_P(data) == IS_ARRAY &&
|
||||
(ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess))
|
||||
@ -1567,50 +1561,42 @@ PHPAPI void php_session_start(void) /* {{{ */
|
||||
ppid2sid(ppid);
|
||||
}
|
||||
|
||||
if (!PS(use_only_cookies) && !PS(id) &&
|
||||
if (PS(define_sid) && !PS(id) &&
|
||||
(data = zend_hash_str_find(&EG(symbol_table).ht, "_POST", sizeof("_POST") - 1)) &&
|
||||
Z_TYPE_P(data) == IS_ARRAY &&
|
||||
(ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess))
|
||||
) {
|
||||
ppid2sid(ppid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the REQUEST_URI symbol for a string of the form
|
||||
* '<session-name>=<session-id>' to allow URLs of the form
|
||||
* http://yoursite/<session-name>=<session-id>/script.php */
|
||||
|
||||
if (!PS(use_only_cookies) && !PS(id) && !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) &&
|
||||
/* Check the REQUEST_URI symbol for a string of the form
|
||||
* '<session-name>=<session-id>' to allow URLs of the form
|
||||
* http://yoursite/<session-name>=<session-id>/script.php */
|
||||
if (PS(define_sid) && !PS(id) &&
|
||||
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "REQUEST_URI", sizeof("REQUEST_URI") - 1)) &&
|
||||
Z_TYPE_P(data) == IS_STRING &&
|
||||
(p = strstr(Z_STRVAL_P(data), PS(session_name))) &&
|
||||
p[lensess] == '='
|
||||
) {
|
||||
char *q;
|
||||
|
||||
p += lensess + 1;
|
||||
if ((q = strpbrk(p, "/?\\"))) {
|
||||
PS(id) = zend_string_init(p, q - p, 0);
|
||||
PS(send_cookie) = 0;
|
||||
) {
|
||||
char *q;
|
||||
p += lensess + 1;
|
||||
if ((q = strpbrk(p, "/?\\"))) {
|
||||
PS(id) = zend_string_init(p, q - p, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check whether the current request was referred to by
|
||||
* an external site which invalidates the previously found id. */
|
||||
|
||||
if (PS(id) &&
|
||||
/* Check whether the current request was referred to by
|
||||
* an external site which invalidates the previously found id. */
|
||||
if (PS(define_sid) && PS(id) &&
|
||||
PS(extern_referer_chk)[0] != '\0' &&
|
||||
!Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) &&
|
||||
(data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) &&
|
||||
Z_TYPE_P(data) == IS_STRING &&
|
||||
Z_STRLEN_P(data) != 0 &&
|
||||
strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL
|
||||
) {
|
||||
zend_string_release(PS(id));
|
||||
PS(id) = NULL;
|
||||
PS(send_cookie) = 1;
|
||||
if (PS(use_trans_sid) && !PS(use_only_cookies)) {
|
||||
PS(apply_trans_sid) = 1;
|
||||
) {
|
||||
zend_string_release(PS(id));
|
||||
PS(id) = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1669,10 +1655,13 @@ static void php_session_reset(void) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* This API is not used by any PHP modules including session currently.
|
||||
session_adapt_url() may be used to set Session ID to target url without
|
||||
starting "URL-Rewriter" output handler. */
|
||||
PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen) /* {{{ */
|
||||
{
|
||||
if (PS(apply_trans_sid) && (PS(session_status) == php_session_active)) {
|
||||
*new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id)->val, newlen);
|
||||
if (APPLY_TRANS_SID && (PS(session_status) == php_session_active)) {
|
||||
*new = php_url_scanner_adapt_single_url(url, urllen, PS(session_name), PS(id)->val, newlen, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -2021,6 +2010,7 @@ static PHP_FUNCTION(session_id)
|
||||
static PHP_FUNCTION(session_regenerate_id)
|
||||
{
|
||||
zend_bool del_ses = 0;
|
||||
zend_string *data = NULL;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &del_ses) == FAILURE) {
|
||||
return;
|
||||
@ -2031,26 +2021,31 @@ static PHP_FUNCTION(session_regenerate_id)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (PS(session_status) == php_session_active) {
|
||||
if (PS(id)) {
|
||||
if (del_ses && PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) {
|
||||
php_error_docref(NULL, E_WARNING, "Session object destruction failed");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
zend_string_release(PS(id));
|
||||
PS(id) = NULL;
|
||||
}
|
||||
|
||||
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
|
||||
if (PS(id)) {
|
||||
PS(send_cookie) = 1;
|
||||
php_session_reset_id();
|
||||
RETURN_TRUE;
|
||||
} else {
|
||||
PS(id) = STR_EMPTY_ALLOC();
|
||||
}
|
||||
if (PS(session_status) != php_session_active) {
|
||||
php_error_docref(NULL, E_WARNING, "Cannot regenerate session id - session is not active");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_FALSE;
|
||||
|
||||
/* Keep current session data */
|
||||
data = php_session_encode();
|
||||
|
||||
if (del_ses && PS(mod)->s_destroy(&PS(mod_data), PS(id)) == FAILURE) {
|
||||
php_error_docref(NULL, E_WARNING, "Session object destruction failed");
|
||||
}
|
||||
php_rshutdown_session_globals();
|
||||
php_rinit_session_globals();
|
||||
|
||||
php_session_initialize();
|
||||
/* Restore session data */
|
||||
if (data) {
|
||||
if (PS(session_vars)) {
|
||||
zend_string_release(PS(session_vars));
|
||||
PS(session_vars) = NULL;
|
||||
}
|
||||
php_session_decode(data);
|
||||
zend_string_release(data);
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -2206,6 +2201,11 @@ static PHP_FUNCTION(session_start)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (PS(id) && !(PS(id)->len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot start session with empty session ID");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* set options */
|
||||
if (options) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), num_idx, str_idx, value) {
|
||||
@ -2872,7 +2872,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
smart_str_appendl(&progress->key, *data->value, value_len);
|
||||
smart_str_0(&progress->key);
|
||||
|
||||
progress->apply_trans_sid = PS(use_trans_sid);
|
||||
progress->apply_trans_sid = APPLY_TRANS_SID;
|
||||
php_session_rfc1867_early_find_sid(progress);
|
||||
}
|
||||
}
|
||||
@ -2911,7 +2911,11 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo
|
||||
|
||||
php_rinit_session(0);
|
||||
PS(id) = zend_string_init(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0);
|
||||
PS(apply_trans_sid) = progress->apply_trans_sid;
|
||||
if (progress->apply_trans_sid) {
|
||||
/* Enable trans sid by modifying flags */
|
||||
PS(use_trans_sid) = 1;
|
||||
PS(use_only_cookies) = 0;
|
||||
}
|
||||
PS(send_cookie) = 0;
|
||||
}
|
||||
|
||||
|
27
ext/session/tests/bug61470.phpt
Normal file
27
ext/session/tests/bug61470.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #61470 (session_regenerate_id() does not create session file)
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
--FILE--
|
||||
<?php
|
||||
ob_start();
|
||||
ini_set('session.save_path', __DIR__);
|
||||
$path = ini_get('session.save_path') . '/sess_';
|
||||
session_start();
|
||||
// starts session & creates and locks file
|
||||
$file1 = $path . session_id();
|
||||
var_dump(is_file($file1));
|
||||
|
||||
session_regenerate_id();
|
||||
// starts new session, but file is not create!
|
||||
$file2 = $path . session_id();
|
||||
var_dump(is_file($file2));
|
||||
|
||||
// cleanup
|
||||
unlink($file1);
|
||||
unlink($file2);
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
20
ext/session/tests/bug68063.phpt
Normal file
20
ext/session/tests/bug68063.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #68063 (Empty session IDs do still start sessions)
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--INI--
|
||||
--FILE--
|
||||
<?php
|
||||
// Could also be set with a cookie like "PHPSESSID=; path=/"
|
||||
session_id('');
|
||||
|
||||
// Will still start the session and return true
|
||||
var_dump(session_start());
|
||||
|
||||
// Returns an empty string
|
||||
var_dump(session_id());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: session_start(): Cannot start session with empty session ID in %s on line %d
|
||||
bool(false)
|
||||
string(0) ""
|
248
ext/session/tests/session_basic3.phpt
Normal file
248
ext/session/tests/session_basic3.phpt
Normal file
@ -0,0 +1,248 @@
|
||||
--TEST--
|
||||
Test basic function : variation3 use_trans_sid
|
||||
--INI--
|
||||
session.use_strict_mode=0
|
||||
session.use_only_cookies=0
|
||||
session.use_trans_sid=1
|
||||
session.save_handler=files
|
||||
session.hash_bits_per_character=4
|
||||
session.hash_function=0
|
||||
session.gc_probability=1
|
||||
session.gc_divisor=1000
|
||||
session.gc_maxlifetime=300
|
||||
session.save_path=
|
||||
session.name=PHPSESSID
|
||||
--XFAIL--
|
||||
Waiting url_scanner_ex.re fix. https://bugs.php.net/bug.php?id=68970
|
||||
--SKIPIF--
|
||||
<?php include('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
|
||||
/*
|
||||
* Prototype : session.use_trans_sid=1
|
||||
* Description : Test basic functionality.
|
||||
* Source code : ext/session/session.c
|
||||
*/
|
||||
|
||||
echo "*** Testing basic session functionality : variation3 use_trans_sid ***\n";
|
||||
|
||||
/*
|
||||
echo "*** test output_add_rewrite_var() ***\n";
|
||||
output_add_rewrite_var('var', 'value');
|
||||
echo '
|
||||
<a href="/">test</a>
|
||||
<a href="/#bar">test</a>
|
||||
<a href="/?foo">test</a>
|
||||
<a href="/?foo#bar">test</a>
|
||||
<a href="/?foo=var">test</a>
|
||||
<a href="/?foo=var#bar">test</a>
|
||||
<a href="file.php">test</a>
|
||||
<a href="file.php?foo">test</a>
|
||||
<a href="file.php?foo=var">test</a>
|
||||
<a href="http://php.net">test</a>
|
||||
<a href="http://php.net/">test</a>
|
||||
<a href="http://php.net/#bar">test</a>
|
||||
<a href="http://php.net/?foo">test</a>
|
||||
<a href="http://php.net/?foo#bar">test</a>
|
||||
<a href="http://php.net/?foo=var">test</a>
|
||||
<a href="http://php.net/?foo=var#bar">test</a>
|
||||
<a href="http://php.net/file.php">test</a>
|
||||
<a href="http://php.net/file.php#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo">test</a>
|
||||
<a href="http://php.net/file.php?foo#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="http://php.net/some/path/file.php">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net">test</a>
|
||||
<a href="https://php.net/">test</a>
|
||||
<a href="https://php.net/?foo=var#bar">test</a>
|
||||
<a href="https://php.net/file.php">test</a>
|
||||
<a href="https://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net/some/path/file.php">test</a>
|
||||
<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443">test</a>
|
||||
<a href="https://php.net:8443/">test</a>
|
||||
<a href="https://php.net:8443/?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/file.php">test</a>
|
||||
<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net">test</a>
|
||||
<a href="//php.net/">test</a>
|
||||
<a href="//php.net/#bar">test</a>
|
||||
<a href="//php.net/?foo">test</a>
|
||||
<a href="//php.net/?foo#bar">test</a>
|
||||
<a href="//php.net/?foo=var">test</a>
|
||||
<a href="//php.net/?foo=var#bar">test</a>
|
||||
<a href="//php.net/file.php">test</a>
|
||||
<a href="//php.net/file.php#bar">test</a>
|
||||
<a href="//php.net/file.php?foo">test</a>
|
||||
<a href="//php.net/file.php?foo#bar">test</a>
|
||||
<a href="//php.net/file.php?foo=var">test</a>
|
||||
<a href="//php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net/some/path/file.php">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<form action="script.php" method="post">
|
||||
<input type="text" name="test1"></input>
|
||||
<input type="text" name="test2" />
|
||||
</form>
|
||||
';
|
||||
output_reset_rewrite_vars();
|
||||
*/
|
||||
|
||||
echo "*** Test trans sid ***\n";
|
||||
ob_start();
|
||||
$session_id = 'testid';
|
||||
session_id($session_id);
|
||||
session_start();
|
||||
// Should add session ID to relative URL only for SECURITY
|
||||
echo '
|
||||
<a href="/">test</a>
|
||||
<a href="/#bar">test</a>
|
||||
<a href="/?foo">test</a>
|
||||
<a href="/?foo#bar">test</a>
|
||||
<a href="/?foo=var">test</a>
|
||||
<a href="/?foo=var#bar">test</a>
|
||||
<a href="file.php">test</a>
|
||||
<a href="file.php?foo">test</a>
|
||||
<a href="file.php?foo=var">test</a>
|
||||
<a href="http://php.net">test</a>
|
||||
<a href="http://php.net/">test</a>
|
||||
<a href="http://php.net/#bar">test</a>
|
||||
<a href="http://php.net/?foo">test</a>
|
||||
<a href="http://php.net/?foo#bar">test</a>
|
||||
<a href="http://php.net/?foo=var">test</a>
|
||||
<a href="http://php.net/?foo=var#bar">test</a>
|
||||
<a href="http://php.net/file.php">test</a>
|
||||
<a href="http://php.net/file.php#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo">test</a>
|
||||
<a href="http://php.net/file.php?foo#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="http://php.net/some/path/file.php">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net">test</a>
|
||||
<a href="https://php.net/">test</a>
|
||||
<a href="https://php.net/?foo=var#bar">test</a>
|
||||
<a href="https://php.net/file.php">test</a>
|
||||
<a href="https://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net/some/path/file.php">test</a>
|
||||
<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443">test</a>
|
||||
<a href="https://php.net:8443/">test</a>
|
||||
<a href="https://php.net:8443/?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/file.php">test</a>
|
||||
<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net">test</a>
|
||||
<a href="//php.net/">test</a>
|
||||
<a href="//php.net/#bar">test</a>
|
||||
<a href="//php.net/?foo">test</a>
|
||||
<a href="//php.net/?foo#bar">test</a>
|
||||
<a href="//php.net/?foo=var">test</a>
|
||||
<a href="//php.net/?foo=var#bar">test</a>
|
||||
<a href="//php.net/file.php">test</a>
|
||||
<a href="//php.net/file.php#bar">test</a>
|
||||
<a href="//php.net/file.php?foo">test</a>
|
||||
<a href="//php.net/file.php?foo#bar">test</a>
|
||||
<a href="//php.net/file.php?foo=var">test</a>
|
||||
<a href="//php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net/some/path/file.php">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<form action="script.php" method="post">
|
||||
<input type="text" name="test1"></input>
|
||||
<input type="text" name="test2" />
|
||||
</form>
|
||||
';
|
||||
var_dump(session_commit());
|
||||
|
||||
echo "*** Cleanup ***\n";
|
||||
var_dump(session_start());
|
||||
var_dump(session_id());
|
||||
var_dump(session_destroy());
|
||||
|
||||
ob_end_flush();
|
||||
?>
|
||||
--EXPECT--
|
||||
*** Testing basic session functionality : variation3 use_trans_sid ***
|
||||
*** Test trans sid ***
|
||||
|
||||
<a href="/?PHPSESSID=testid">test</a>
|
||||
<a href="/?PHPSESSID=testid#bar">test</a>
|
||||
<a href="/?foo&PHPSESSID=testid">test</a>
|
||||
<a href="/?foo&PHPSESSID=testid#bar">test</a>
|
||||
<a href="/?foo=var&PHPSESSID=testid">test</a>
|
||||
<a href="/?foo=var&PHPSESSID=testid#bar">test</a>
|
||||
<a href="file.php?PHPSESSID=testid">test</a>
|
||||
<a href="file.php?foo&PHPSESSID=testid">test</a>
|
||||
<a href="file.php?foo=var&PHPSESSID=testid">test</a>
|
||||
<a href="http://php.net">test</a>
|
||||
<a href="http://php.net/">test</a>
|
||||
<a href="http://php.net/#bar">test</a>
|
||||
<a href="http://php.net/?foo">test</a>
|
||||
<a href="http://php.net/?foo#bar">test</a>
|
||||
<a href="http://php.net/?foo=var">test</a>
|
||||
<a href="http://php.net/?foo=var#bar">test</a>
|
||||
<a href="http://php.net/file.php">test</a>
|
||||
<a href="http://php.net/file.php#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo">test</a>
|
||||
<a href="http://php.net/file.php?foo#bar">test</a>
|
||||
<a href="http://php.net/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="http://php.net/some/path/file.php">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net">test</a>
|
||||
<a href="https://php.net/">test</a>
|
||||
<a href="https://php.net/?foo=var#bar">test</a>
|
||||
<a href="https://php.net/file.php">test</a>
|
||||
<a href="https://php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net/some/path/file.php">test</a>
|
||||
<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443">test</a>
|
||||
<a href="https://php.net:8443/">test</a>
|
||||
<a href="https://php.net:8443/?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/file.php">test</a>
|
||||
<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php">test</a>
|
||||
<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net">test</a>
|
||||
<a href="//php.net/">test</a>
|
||||
<a href="//php.net/#bar">test</a>
|
||||
<a href="//php.net/?foo">test</a>
|
||||
<a href="//php.net/?foo#bar">test</a>
|
||||
<a href="//php.net/?foo=var">test</a>
|
||||
<a href="//php.net/?foo=var#bar">test</a>
|
||||
<a href="//php.net/file.php">test</a>
|
||||
<a href="//php.net/file.php#bar">test</a>
|
||||
<a href="//php.net/file.php?foo">test</a>
|
||||
<a href="//php.net/file.php?foo#bar">test</a>
|
||||
<a href="//php.net/file.php?foo=var">test</a>
|
||||
<a href="//php.net/file.php?foo=var#bar">test</a>
|
||||
<a href="//php.net/some/path/file.php">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var">test</a>
|
||||
<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
|
||||
<form action="script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /><input type="hidden" name="PHPSESSID" value="testid" />
|
||||
<input type="text" name="test1"></input>
|
||||
<input type="text" name="test2" />
|
||||
</form>
|
||||
NULL
|
||||
*** Cleanup ***
|
||||
bool(true)
|
||||
string(6) "testid"
|
||||
bool(true)
|
@ -31,12 +31,16 @@ ob_end_flush();
|
||||
--EXPECTF--
|
||||
*** Testing session_regenerate_id() : basic functionality ***
|
||||
string(0) ""
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
string(0) ""
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "%s"
|
||||
bool(true)
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
string(0) ""
|
||||
Done
|
||||
|
@ -96,63 +96,103 @@ ob_end_flush();
|
||||
*** Testing session_regenerate_id() : error functionality ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
@ -161,9 +201,13 @@ Warning: session_regenerate_id() expects parameter 1 to be boolean, object given
|
||||
NULL
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
@ -31,12 +31,16 @@ ob_end_flush();
|
||||
--EXPECTF--
|
||||
*** Testing session_regenerate_id() : variation ***
|
||||
string(0) ""
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
string(0) ""
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "%s"
|
||||
bool(true)
|
||||
|
||||
Warning: session_regenerate_id(): Cannot regenerate session id - session is not active in %s on line %d
|
||||
bool(false)
|
||||
string(0) ""
|
||||
Done
|
||||
|
@ -362,7 +362,11 @@ PHP_FUNCTION(flock)
|
||||
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
|
||||
act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0);
|
||||
if (php_stream_lock(stream, act)) {
|
||||
#ifdef PHP_WIN32
|
||||
if (operation && errno == ERROR_INVALID_BLOCK && wouldblock) {
|
||||
#else
|
||||
if (operation && errno == EWOULDBLOCK && wouldblock) {
|
||||
#endif
|
||||
ZVAL_LONG(wouldblock, 1);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
|
26
ext/standard/tests/file/bug65272.phpt
Normal file
26
ext/standard/tests/file/bug65272.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #65272: flock() correctly sets wouldblock out param in windows
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (stripos(PHP_OS, 'win') !== 0) die("skip windows required");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$file = dirname(__FILE__)."/flock.dat";
|
||||
|
||||
$fp1 = fopen($file, "w");
|
||||
var_dump(flock($fp1, LOCK_SH));
|
||||
|
||||
$fp2 = fopen($file, "r");
|
||||
var_dump(flock($fp2, LOCK_EX|LOCK_NB, $wouldblock));
|
||||
var_dump($wouldblock);
|
||||
|
||||
@unlink($file);
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(false)
|
||||
int(1)
|
||||
Done
|
@ -123,38 +123,38 @@ scan:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const 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,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 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,
|
||||
};
|
||||
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
@ -378,38 +378,38 @@ state_plain:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const 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,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 128, 128, 128, 128,
|
||||
128, 128, 128, 128, 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,
|
||||
};
|
||||
if (YYLIMIT <= YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
@ -441,38 +441,38 @@ state_tag:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const 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, 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, 128, 128, 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,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 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, 128, 128, 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,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
@ -519,38 +519,38 @@ state_next_arg:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 128, 128, 0, 128, 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,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 128, 128, 128, 0, 128, 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,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
@ -629,38 +629,38 @@ state_arg:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const 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,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 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,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
@ -701,38 +701,38 @@ state_before_val:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const 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,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
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,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
@ -787,38 +787,38 @@ state_val:
|
||||
{
|
||||
YYCTYPE yych;
|
||||
static const unsigned char yybm[] = {
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 192, 192, 224, 224, 192, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
192, 224, 64, 224, 224, 224, 224, 128,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 0, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 192, 192, 224, 224, 192, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
192, 224, 64, 224, 224, 224, 224, 128,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 0, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
224, 224, 224, 224, 224, 224, 224, 224,
|
||||
};
|
||||
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
|
||||
yych = *YYCURSOR;
|
||||
@ -918,18 +918,32 @@ stop:
|
||||
ctx->buf.s->len = rest;
|
||||
}
|
||||
|
||||
char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen)
|
||||
|
||||
PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode)
|
||||
{
|
||||
char *result;
|
||||
smart_str surl = {0};
|
||||
smart_str buf = {0};
|
||||
smart_str url_app = {0};
|
||||
zend_string *encoded;
|
||||
|
||||
smart_str_setl(&surl, url, urllen);
|
||||
smart_str_appendl(&surl, url, urllen);
|
||||
|
||||
smart_str_appends(&url_app, name);
|
||||
if (urlencode) {
|
||||
encoded = php_raw_url_encode(name, strlen(name));
|
||||
smart_str_appendl(&url_app, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_appends(&url_app, name);
|
||||
}
|
||||
smart_str_appendc(&url_app, '=');
|
||||
smart_str_appends(&url_app, value);
|
||||
if (urlencode) {
|
||||
encoded = php_raw_url_encode(value, strlen(value));
|
||||
smart_str_appendl(&url_app, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_appends(&url_app, value);
|
||||
}
|
||||
|
||||
append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
|
||||
|
||||
@ -1028,7 +1042,8 @@ static void php_url_scanner_output_handler(char *output, size_t output_len, char
|
||||
|
||||
PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode)
|
||||
{
|
||||
smart_str val = {0};
|
||||
smart_str sname = {0};
|
||||
smart_str svalue = {0};
|
||||
zend_string *encoded;
|
||||
|
||||
if (!BG(url_adapt_state_ex).active) {
|
||||
@ -1037,32 +1052,34 @@ PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, siz
|
||||
BG(url_adapt_state_ex).active = 1;
|
||||
}
|
||||
|
||||
|
||||
if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) {
|
||||
smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
|
||||
}
|
||||
|
||||
if (urlencode) {
|
||||
encoded = php_url_encode(value, value_len);
|
||||
smart_str_setl(&val, encoded->val, encoded->len);
|
||||
encoded = php_raw_url_encode(name, name_len);
|
||||
smart_str_appendl(&sname, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
encoded = php_raw_url_encode(value, value_len);
|
||||
smart_str_appendl(&svalue, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_setl(&val, value, value_len);
|
||||
smart_str_appendl(&sname, name, name_len);
|
||||
smart_str_appendl(&svalue, value, value_len);
|
||||
}
|
||||
|
||||
smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &sname);
|
||||
smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &svalue);
|
||||
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
|
||||
smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &sname);
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &svalue);
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
|
||||
|
||||
if (urlencode) {
|
||||
zend_string_free(encoded);
|
||||
}
|
||||
smart_str_free(&val);
|
||||
smart_str_free(&sname);
|
||||
smart_str_free(&svalue);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ PHP_MSHUTDOWN_FUNCTION(url_scanner_ex);
|
||||
PHP_RINIT_FUNCTION(url_scanner_ex);
|
||||
PHP_RSHUTDOWN_FUNCTION(url_scanner_ex);
|
||||
|
||||
PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen);
|
||||
PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode);
|
||||
PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode);
|
||||
PHPAPI int php_url_scanner_reset_vars(void);
|
||||
|
||||
|
@ -370,18 +370,32 @@ stop:
|
||||
ctx->buf.s->len = rest;
|
||||
}
|
||||
|
||||
char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen)
|
||||
|
||||
PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int urlencode)
|
||||
{
|
||||
char *result;
|
||||
smart_str surl = {0};
|
||||
smart_str buf = {0};
|
||||
smart_str url_app = {0};
|
||||
zend_string *encoded;
|
||||
|
||||
smart_str_setl(&surl, url, urllen);
|
||||
smart_str_appendl(&surl, url, urllen);
|
||||
|
||||
smart_str_appends(&url_app, name);
|
||||
if (urlencode) {
|
||||
encoded = php_raw_url_encode(name, strlen(name));
|
||||
smart_str_appendl(&url_app, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_appends(&url_app, name);
|
||||
}
|
||||
smart_str_appendc(&url_app, '=');
|
||||
smart_str_appends(&url_app, value);
|
||||
if (urlencode) {
|
||||
encoded = php_raw_url_encode(value, strlen(value));
|
||||
smart_str_appendl(&url_app, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_appends(&url_app, value);
|
||||
}
|
||||
|
||||
append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);
|
||||
|
||||
@ -480,7 +494,8 @@ static void php_url_scanner_output_handler(char *output, size_t output_len, char
|
||||
|
||||
PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, size_t value_len, int urlencode)
|
||||
{
|
||||
smart_str val = {0};
|
||||
smart_str sname = {0};
|
||||
smart_str svalue = {0};
|
||||
zend_string *encoded;
|
||||
|
||||
if (!BG(url_adapt_state_ex).active) {
|
||||
@ -489,32 +504,34 @@ PHPAPI int php_url_scanner_add_var(char *name, size_t name_len, char *value, siz
|
||||
BG(url_adapt_state_ex).active = 1;
|
||||
}
|
||||
|
||||
|
||||
if (BG(url_adapt_state_ex).url_app.s && BG(url_adapt_state_ex).url_app.s->len != 0) {
|
||||
smart_str_appends(&BG(url_adapt_state_ex).url_app, PG(arg_separator).output);
|
||||
}
|
||||
|
||||
if (urlencode) {
|
||||
encoded = php_url_encode(value, value_len);
|
||||
smart_str_setl(&val, encoded->val, encoded->len);
|
||||
encoded = php_raw_url_encode(name, name_len);
|
||||
smart_str_appendl(&sname, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
encoded = php_raw_url_encode(value, value_len);
|
||||
smart_str_appendl(&svalue, encoded->val, encoded->len);
|
||||
zend_string_free(encoded);
|
||||
} else {
|
||||
smart_str_setl(&val, value, value_len);
|
||||
smart_str_appendl(&sname, name, name_len);
|
||||
smart_str_appendl(&svalue, value, value_len);
|
||||
}
|
||||
|
||||
smart_str_appendl(&BG(url_adapt_state_ex).url_app, name, name_len);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &sname);
|
||||
smart_str_appendc(&BG(url_adapt_state_ex).url_app, '=');
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &val);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).url_app, &svalue);
|
||||
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "<input type=\"hidden\" name=\"");
|
||||
smart_str_appendl(&BG(url_adapt_state_ex).form_app, name, name_len);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &sname);
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" value=\"");
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &val);
|
||||
smart_str_append_smart_str(&BG(url_adapt_state_ex).form_app, &svalue);
|
||||
smart_str_appends(&BG(url_adapt_state_ex).form_app, "\" />");
|
||||
|
||||
if (urlencode) {
|
||||
zend_string_free(encoded);
|
||||
}
|
||||
smart_str_free(&val);
|
||||
smart_str_free(&sname);
|
||||
smart_str_free(&svalue);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -423,8 +423,6 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
|
||||
} else {
|
||||
PG(internal_encoding) = SG(default_charset);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -436,8 +434,6 @@ static PHP_INI_MH(OnUpdateInputEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
|
||||
} else {
|
||||
PG(input_encoding) = SG(default_charset);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -449,8 +445,6 @@ static PHP_INI_MH(OnUpdateOutputEncoding)
|
||||
{
|
||||
if (new_value) {
|
||||
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
|
||||
} else {
|
||||
PG(output_encoding) = SG(default_charset);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -562,7 +556,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_append_file, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals)
|
||||
STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals)
|
||||
STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals)
|
||||
STD_PHP_INI_ENTRY("internal_encoding", NULL, PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("input_encoding", NULL, PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals)
|
||||
|
27
tests/basic/bug67988.phpt
Normal file
27
tests/basic/bug67988.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Bug #67988 (htmlspecialchars() does not respect default_charset specified by ini_set)
|
||||
--INI--
|
||||
default_charset=UTF-8
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set('default_charset', 'cp1252');
|
||||
|
||||
var_dump(ini_get('default_charset'));
|
||||
var_dump(ini_get('internal_encoding'));
|
||||
var_dump(ini_get('input_encoding'));
|
||||
var_dump(ini_get('output_encoding'));
|
||||
|
||||
var_dump(htmlentities("\xA3", ENT_HTML5));
|
||||
var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
|
||||
|
||||
var_dump(bin2hex(html_entity_decode("£", ENT_HTML5)));
|
||||
var_dump(bin2hex(html_entity_decode("£", ENT_HTML5, 'cp1252')));
|
||||
--EXPECT--
|
||||
string(6) "cp1252"
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(7) "£"
|
||||
string(7) "£"
|
||||
string(2) "a3"
|
||||
string(2) "a3"
|
@ -14,14 +14,14 @@ var_dump(ini_get('input_encoding'));
|
||||
var_dump(ini_get('internal_encoding'));
|
||||
var_dump(ini_get('output_encoding'));
|
||||
|
||||
var_dump(ini_set('input_encoding', 'ISO-8859-1'));
|
||||
var_dump(ini_set('internal_encoding', 'ISO-8859-1'));
|
||||
var_dump(ini_set('output_encoding', 'ISO-8859-1'));
|
||||
var_dump(ini_set('input_encoding', 'EUC-JP'));
|
||||
var_dump(ini_set('internal_encoding', 'EUC-JP'));
|
||||
var_dump(ini_set('output_encoding', 'EUC-JP'));
|
||||
var_dump(ini_get('input_encoding'));
|
||||
var_dump(ini_get('internal_encoding'));
|
||||
var_dump(ini_get('output_encoding'));
|
||||
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
string(5) "UTF-8"
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
@ -34,6 +34,6 @@ string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(10) "ISO-8859-1"
|
||||
string(10) "ISO-8859-1"
|
||||
string(10) "ISO-8859-1"
|
||||
string(6) "EUC-JP"
|
||||
string(6) "EUC-JP"
|
||||
string(6) "EUC-JP"
|
||||
|
Loading…
Reference in New Issue
Block a user