Merge remote-tracking branch 'php-src/master' into addGeneratorsSupport

Merging master to fix Windows build

Conflicts:
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_vm_def.h
This commit is contained in:
Nikita Popov 2012-08-20 13:37:53 +02:00
commit 1823b16fa1
143 changed files with 2797 additions and 1469 deletions

7
NEWS
View File

@ -55,6 +55,10 @@ PHP NEWS
- Hash
. Added support for PBKDF2 via hash_pbkdf2(). (Anthony Ferrara)
- MCrypt
. mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw
E_DEPRECATED. (GoogleGuy)
- MySQLi
. Dropped support for LOAD DATA LOCAL INFILE handlers when using libmysql.
Known for stability problems. (Andrey)
@ -66,6 +70,9 @@ PHP NEWS
- pgsql
. Added pg_escape_literal() and pg_escape_identifier() (Yasuo)
- Tokenizer:
. Fixed bug #60097 (token_get_all fails to lex nested heredoc). (Nikita Popov)
- Zip:
. Upgraded libzip to 0.10.1 (Anatoliy)

View File

@ -98,7 +98,9 @@ PHP X.Y UPGRADE NOTES
instead.
- IntlDateFormatter::format() and datefmt_format() now also accept an
IntlCalendar object for formatting.
- Deprecated mcrypt_ecb() made to produce E_DEPRECATED.
- mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb() now throw
E_DEPRECATED. Their use was already previously discouraged in the docs,
but that predated the existence of E_DEPRECATED.
- php_logo_guid(), php_egg_logo_guid(), php_real_logo_guid() and
zend_logo_guid() have been removed

View File

@ -1,5 +1,5 @@
--TEST--
Try catch finally
Try catch finally catch(multi catch blocks)
--FILE--
<?php

View File

@ -1,5 +1,5 @@
--TEST--
Try catch finally
Try catch finally (multi catch blocks with return)
--FILE--
<?php

View File

@ -1,5 +1,5 @@
--TEST--
Try catch finally
Try catch finally (re-throw exception in catch block)
--CREDITS--
adoy
--FILE--

View File

@ -0,0 +1,14 @@
--TEST--
Try without catch/finally block
--FILE--
<?php
function foo () {
try {
echo "3";
}
}
foo();
?>
--EXPECTF--
Fatal error: Cannot use try without catch or finally in %stry_finally_004.php on line %d

View File

@ -0,0 +1,17 @@
--TEST--
Finally with long goto
--FILE--
<?php
function foo () {
try {
} finally {
goto label;
}
label:
return 1;
}
foo();
?>
--EXPECTF--
Fatal error: jump out of a finally block is disallowed in %stry_finally_005.php on line %d

View File

@ -0,0 +1,26 @@
--TEST--
Finally with near goto
--FILE--
<?php
function foo () {
$jmp = 1;
try {
} finally {
previous:
if ($jmp) {
goto label;
echo "dummy";
label:
echo "label\n";
$jmp = 0;
goto previous;
}
echo "okey";
}
}
foo();
?>
--EXPECTF--
label
okey

View File

@ -0,0 +1,22 @@
--TEST--
Finally with goto previous label
--FILE--
<?php
function foo () {
try {
label:
echo "label";
try {
} finally {
goto label;
echo "dummy";
}
} catch (Exception $e) {
} finally {
}
}
foo();
?>
--EXPECTF--
Fatal error: jump out of a finally block is disallowed in %stry_finally_007.php on line %d

View File

@ -0,0 +1,21 @@
--TEST--
Finally with jmp (do while)
--FILE--
<?php
function foo () {
do {
try {
try {
} finally {
break;
}
} catch (Exception $e) {
} finally {
}
} while (0);
}
foo();
?>
--EXPECTF--
Fatal error: jump out of a finally block is disallowed in %stry_finally_008.php on line %d

View File

@ -0,0 +1,23 @@
--TEST--
Finally with jmp (for continue)
--FILE--
<?php
function foo () {
for($i = 0; $i < 5; $i++) {
do {
try {
try {
} finally {
}
} catch (Exception $e) {
} finally {
continue;
}
} while (0);
}
}
foo();
?>
--EXPECTF--
Fatal error: jump out of a finally block is disallowed in %stry_finally_009.php on line %d

View File

@ -2651,11 +2651,9 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
/* Skip leading \ */
if (Z_STRVAL_P(callable)[0] == '\\') {
mlen = Z_STRLEN_P(callable) - 1;
mname = Z_STRVAL_P(callable) + 1;
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 1, mlen);
} else {
mlen = Z_STRLEN_P(callable);
mname = Z_STRVAL_P(callable);
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen);
}
/* Check if function with given name exists.

View File

@ -2732,6 +2732,7 @@ static int zend_add_try_element(zend_uint try_op TSRMLS_DC) /* {{{ */
CG(active_op_array)->try_catch_array = erealloc(CG(active_op_array)->try_catch_array, sizeof(zend_try_catch_element)*CG(active_op_array)->last_try_catch);
CG(active_op_array)->try_catch_array[try_catch_offset].try_op = try_op;
CG(active_op_array)->try_catch_array[try_catch_offset].finally_op = 0;
CG(active_op_array)->try_catch_array[try_catch_offset].finally_end = 0;
return try_catch_offset;
}
/* }}} */
@ -2792,7 +2793,7 @@ void zend_do_try(znode *try_token TSRMLS_DC) /* {{{ */
/* }}} */
void zend_do_finally(znode *finally_token TSRMLS_DC) /* {{{ */ {
finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
finally_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
} /* }}} */
void zend_do_begin_catch(znode *catch_token, znode *class_name, znode *catch_var, znode *first_catch TSRMLS_DC) /* {{{ */
@ -2846,34 +2847,29 @@ void zend_do_end_catch(znode *catch_token TSRMLS_DC) /* {{{ */
/* }}} */
void zend_do_bind_catch(znode *try_token, znode *catch_token TSRMLS_DC) /* {{{ */ {
if (catch_token->op_type != IS_UNUSED) {
zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
}
if (catch_token->op_type != IS_UNUSED) {
zend_add_catch_element(try_token->u.op.opline_num, catch_token->EA TSRMLS_CC);
}
}
/* }}} */
void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC) /* {{{ */
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally");
}
if (finally_token->op_type != IS_UNUSED) {
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
//try_token->u.op.opline_num = catch_token->u.op.opline_num;
opline->opcode = ZEND_LEAVE;
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
}
if (catch_token->op_type == IS_UNUSED) {
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0;
} //else {
// try_token->u.op.opline_num = catch_token->u.op.opline_num;
//}
if (catch_token->op_type == IS_UNUSED && finally_token->op_type == IS_UNUSED) {
zend_error(E_COMPILE_ERROR, "Cannot use try without catch or finally");
}
if (finally_token->op_type != IS_UNUSED) {
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_op = finally_token->u.op.opline_num;
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].finally_end = get_next_op_number(CG(active_op_array));
opline->opcode = ZEND_LEAVE;
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
}
if (catch_token->op_type == IS_UNUSED) {
CG(active_op_array)->try_catch_array[try_token->u.op.opline_num].catch_op = 0;
}
}
/* }}} */
@ -6823,9 +6819,6 @@ again:
case T_OPEN_TAG_WITH_ECHO:
retval = T_ECHO;
break;
case T_END_HEREDOC:
efree(Z_STRVAL(zendlval->u.constant));
break;
}
INIT_PZVAL(&zendlval->u.constant);

View File

@ -80,7 +80,7 @@ typedef union _znode_op {
zend_op *jmp_addr;
zval *zv;
zend_literal *literal;
void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
void *ptr; /* Used for passing pointers from the compile to execution phase, currently used for traits */
} znode_op;
typedef struct _znode { /* used only during compilation */
@ -132,7 +132,8 @@ typedef struct _zend_label {
typedef struct _zend_try_catch_element {
zend_uint try_op;
zend_uint catch_op; /* ketchup! */
zend_uint finally_op;
zend_uint finally_op;
zend_uint finally_end;
} zend_try_catch_element;
#if SIZEOF_LONG == 8
@ -502,6 +503,8 @@ void zend_do_fetch_lexical_variable(znode *varname, zend_bool is_ref TSRMLS_DC);
void zend_do_try(znode *try_token TSRMLS_DC);
void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, znode *first_catch TSRMLS_DC);
void zend_do_end_catch(znode *catch_token TSRMLS_DC);
void zend_do_finally(znode *finally_token TSRMLS_DC);
void zend_do_end_finally(znode *try_token, znode* catch_token, znode *finally_token TSRMLS_DC);
void zend_do_throw(const znode *expr TSRMLS_DC);
ZEND_API int do_bind_function(const zend_op_array *op_array, zend_op *opline, HashTable *function_table, zend_bool compile_time);

View File

@ -89,9 +89,6 @@ struct _zend_compiler_globals {
int zend_lineno;
char *heredoc;
int heredoc_len;
zend_op_array *active_op_array;
HashTable *function_table; /* function symbol table */
@ -297,6 +294,7 @@ struct _zend_php_scanner_globals {
unsigned char *yy_limit;
int yy_state;
zend_stack state_stack;
zend_ptr_stack heredoc_label_stack;
/* original (unfiltered) script */
unsigned char *script_org;

View File

@ -153,8 +153,6 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini
efree(token.value.str.val);
break;
}
} else if (token_type == T_END_HEREDOC) {
efree(token.value.str.val);
}
token.type = 0;
}

View File

@ -318,23 +318,23 @@ unticked_statement:
| T_DECLARE { $1.u.op.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
| ';' /* empty statement */
| T_TRY { zend_do_try(&$1 TSRMLS_CC); } '{' inner_statement_list '}'
catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
catch_statement { zend_do_bind_catch(&$1, &$6 TSRMLS_CC); }
finally_statement { zend_do_end_finally(&$1, &$6, &$8 TSRMLS_CC); }
| T_THROW expr ';' { zend_do_throw(&$2 TSRMLS_CC); }
| T_GOTO T_STRING ';' { zend_do_goto(&$2 TSRMLS_CC); }
;
catch_statement:
/* empty */ { $$.op_type = IS_UNUSED; }
| T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
/* empty */ { $$.op_type = IS_UNUSED; }
| T_CATCH '(' { zend_initialize_try_catch_element(&$1 TSRMLS_CC); }
fully_qualified_class_name { zend_do_first_catch(&$2 TSRMLS_CC); }
T_VARIABLE ')' { zend_do_begin_catch(&$1, &$4, &$6, &$2 TSRMLS_CC); }
'{' inner_statement_list '}' { zend_do_end_catch(&$1 TSRMLS_CC); }
additional_catches { zend_do_mark_last_catch(&$2, &$13 TSRMLS_CC); $$ = $1;}
finally_statement:
/* empty */ { $$.op_type = IS_UNUSED; }
| T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
/* empty */ { $$.op_type = IS_UNUSED; }
| T_FINALLY { zend_do_finally(&$1 TSRMLS_CC); } '{' inner_statement_list '}' { $$ = $1; }
;
additional_catches:
@ -938,8 +938,8 @@ common_scalar:
| T_METHOD_C { $$ = $1; }
| T_FUNC_C { $$ = $1; }
| T_NS_C { $$ = $1; }
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
| T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
| T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
| T_START_HEREDOC T_END_HEREDOC { ZVAL_EMPTY_STRING(&$$.u.constant); INIT_PZVAL(&$$.u.constant); $$.op_type = IS_CONST; }
;
@ -968,7 +968,7 @@ scalar:
| T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy(&(tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant(&$$, NULL, &$2, ZEND_RT, 0 TSRMLS_CC); }
| common_scalar { $$ = $1; }
| '"' encaps_list '"' { $$ = $2; }
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; CG(heredoc) = Z_STRVAL($1.u.constant); CG(heredoc_len) = Z_STRLEN($1.u.constant); }
| T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
| T_CLASS_C { if (Z_TYPE($1.u.constant) == IS_CONSTANT) {zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 TSRMLS_CC);} else {$$ = $1;} }
;

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ typedef struct _zend_lex_state {
unsigned char *yy_limit;
int yy_state;
zend_stack state_stack;
zend_ptr_stack heredoc_label_stack;
zend_file_handle *in;
uint lineno;
@ -50,6 +51,10 @@ typedef struct _zend_lex_state {
const zend_encoding *script_encoding;
} zend_lex_state;
typedef struct _zend_heredoc_label {
char *label;
int length;
} zend_heredoc_label;
BEGIN_EXTERN_C()
int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2);

View File

@ -178,22 +178,23 @@ static void yy_scan_buffer(char *str, unsigned int len TSRMLS_DC)
void startup_scanner(TSRMLS_D)
{
CG(parse_error) = 0;
CG(heredoc) = NULL;
CG(heredoc_len) = 0;
CG(doc_comment) = NULL;
CG(doc_comment_len) = 0;
zend_stack_init(&SCNG(state_stack));
zend_ptr_stack_init(&SCNG(heredoc_label_stack));
}
static void heredoc_label_dtor(zend_heredoc_label *heredoc_label) {
efree(heredoc_label->label);
}
void shutdown_scanner(TSRMLS_D)
{
if (CG(heredoc)) {
efree(CG(heredoc));
CG(heredoc_len)=0;
}
CG(parse_error) = 0;
zend_stack_destroy(&SCNG(state_stack));
RESET_DOC_COMMENT();
zend_stack_destroy(&SCNG(state_stack));
zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
}
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
@ -208,6 +209,9 @@ ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
lex_state->state_stack = SCNG(state_stack);
zend_stack_init(&SCNG(state_stack));
lex_state->heredoc_label_stack = SCNG(heredoc_label_stack);
zend_ptr_stack_init(&SCNG(heredoc_label_stack));
lex_state->in = SCNG(yy_in);
lex_state->yy_state = YYSTATE;
lex_state->filename = zend_get_compiled_filename(TSRMLS_C);
@ -234,6 +238,10 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
zend_stack_destroy(&SCNG(state_stack));
SCNG(state_stack) = lex_state->state_stack;
zend_ptr_stack_clean(&SCNG(heredoc_label_stack), (void (*)(void *)) &heredoc_label_dtor, 1);
zend_ptr_stack_destroy(&SCNG(heredoc_label_stack));
SCNG(heredoc_label_stack) = lex_state->heredoc_label_stack;
SCNG(yy_in) = lex_state->in;
YYSETCONDITION(lex_state->yy_state);
CG(zend_lineno) = lex_state->lineno;
@ -250,12 +258,6 @@ ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state TSRMLS_DC)
SCNG(input_filter) = lex_state->input_filter;
SCNG(output_filter) = lex_state->output_filter;
SCNG(script_encoding) = lex_state->script_encoding;
if (CG(heredoc)) {
efree(CG(heredoc));
CG(heredoc) = NULL;
CG(heredoc_len) = 0;
}
}
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC)
@ -2113,38 +2115,35 @@ inline_html:
<ST_IN_SCRIPTING>b?"<<<"{TABS_AND_SPACES}({LABEL}|([']{LABEL}['])|(["]{LABEL}["])){NEWLINE} {
char *s;
int bprefix = (yytext[0] != '<') ? 1 : 0;
/* save old heredoc label */
Z_STRVAL_P(zendlval) = CG(heredoc);
Z_STRLEN_P(zendlval) = CG(heredoc_len);
zend_heredoc_label *heredoc_label = emalloc(sizeof(zend_heredoc_label));
CG(zend_lineno)++;
CG(heredoc_len) = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
heredoc_label->length = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0);
s = yytext+bprefix+3;
while ((*s == ' ') || (*s == '\t')) {
s++;
CG(heredoc_len)--;
heredoc_label->length--;
}
if (*s == '\'') {
s++;
CG(heredoc_len) -= 2;
heredoc_label->length -= 2;
BEGIN(ST_NOWDOC);
} else {
if (*s == '"') {
s++;
CG(heredoc_len) -= 2;
heredoc_label->length -= 2;
}
BEGIN(ST_HEREDOC);
}
CG(heredoc) = estrndup(s, CG(heredoc_len));
heredoc_label->label = estrndup(s, heredoc_label->length);
/* Check for ending label on the next line */
if (CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, CG(heredoc_len))) {
YYCTYPE *end = YYCURSOR + CG(heredoc_len);
if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@ -2155,6 +2154,8 @@ inline_html:
}
}
zend_ptr_stack_push(&SCNG(heredoc_label_stack), (void *) heredoc_label);
return T_START_HEREDOC;
}
@ -2166,13 +2167,14 @@ inline_html:
<ST_END_HEREDOC>{ANY_CHAR} {
YYCURSOR += CG(heredoc_len) - 1;
yyleng = CG(heredoc_len);
zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
YYCURSOR += heredoc_label->length - 1;
yyleng = heredoc_label->length;
heredoc_label_dtor(heredoc_label);
efree(heredoc_label);
Z_STRVAL_P(zendlval) = CG(heredoc);
Z_STRLEN_P(zendlval) = CG(heredoc_len);
CG(heredoc) = NULL;
CG(heredoc_len) = 0;
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
}
@ -2292,6 +2294,8 @@ double_quotes_scan_done:
<ST_HEREDOC>{ANY_CHAR} {
int newline = 0;
zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
if (YYCURSOR > YYLIMIT) {
return 0;
}
@ -2307,8 +2311,8 @@ double_quotes_scan_done:
/* fall through */
case '\n':
/* Check for ending label on the next line */
if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
YYCTYPE *end = YYCURSOR + CG(heredoc_len);
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;
@ -2364,6 +2368,8 @@ heredoc_scan_done:
<ST_NOWDOC>{ANY_CHAR} {
int newline = 0;
zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
if (YYCURSOR > YYLIMIT) {
return 0;
}
@ -2379,8 +2385,8 @@ heredoc_scan_done:
/* fall through */
case '\n':
/* Check for ending label on the next line */
if (IS_LABEL_START(*YYCURSOR) && CG(heredoc_len) < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, CG(heredoc), CG(heredoc_len))) {
YYCTYPE *end = YYCURSOR + CG(heredoc_len);
if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) {
YYCTYPE *end = YYCURSOR + heredoc_label->length;
if (*end == ';') {
end++;

View File

@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 on Mon Aug 13 16:40:42 2012 */
/* Generated by re2c 0.13.5 on Mon Aug 20 13:34:50 2012 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {

View File

@ -485,6 +485,24 @@ static void zend_extension_op_array_handler(zend_extension *extension, zend_op_a
}
}
static void zend_check_finally_breakout(zend_op_array *op_array, zend_op *opline, zend_uint dst_num TSRMLS_DC) {
zend_uint i, op_num = opline - op_array->opcodes;
for (i=0; i < op_array->last_try_catch; i++) {
if (op_array->try_catch_array[i].try_op > op_num) {
break;
}
if ((op_num >= op_array->try_catch_array[i].finally_op
&& op_num < op_array->try_catch_array[i].finally_end)
&& (dst_num >= op_array->try_catch_array[i].finally_end
|| dst_num < op_array->try_catch_array[i].finally_op)) {
CG(in_compilation) = 1;
CG(active_op_array) = op_array;
CG(zend_lineno) = opline->lineno;
zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
}
}
}
ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
{
zend_op *opline, *end;
@ -528,8 +546,30 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
}
/* break omitted intentionally */
case ZEND_JMP:
if (op_array->last_try_catch) {
zend_check_finally_breakout(op_array, opline, opline->op1.opline_num TSRMLS_CC);
}
opline->op1.jmp_addr = &op_array->opcodes[opline->op1.opline_num];
break;
case ZEND_BRK:
case ZEND_CONT:
if (op_array->last_try_catch) {
int nest_levels, array_offset;
zend_brk_cont_element *jmp_to;
nest_levels = Z_LVAL_P(opline->op2.zv);
array_offset = opline->op1.opline_num;
do {
jmp_to = &op_array->brk_cont_array[array_offset];
if (nest_levels > 1) {
array_offset = jmp_to->parent;
}
} while (--nest_levels > 0);
if (op_array->last_try_catch) {
zend_check_finally_breakout(op_array, opline, jmp_to->brk TSRMLS_CC);
}
}
break;
case ZEND_JMPZ:
case ZEND_JMPNZ:
case ZEND_JMPZ_EX:

View File

@ -111,6 +111,11 @@ static zend_always_inline void *zend_ptr_stack_pop(zend_ptr_stack *stack)
return *(--stack->top_element);
}
static inline void *zend_ptr_stack_top(zend_ptr_stack *stack)
{
return stack->elements[stack->top - 1];
}
#endif /* ZEND_PTR_STACK_H */
/*

View File

@ -1187,18 +1187,18 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
EX_T(opline->op1.var).var.ptr_ptr) {
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
}
if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1();
} else {
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
}
if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1();
} else {
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
}
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@ -2133,9 +2133,9 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
USE_OPLINE
SAVE_OPLINE();
if (EG(exception)) {
zend_exception_save(TSRMLS_C);
}
if (EG(exception)) {
zend_exception_save(TSRMLS_C);
}
if (OP2_TYPE == IS_UNUSED) {
EX_T(opline->result.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
CHECK_EXCEPTION();
@ -2854,9 +2854,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
FREE_OP1();
}
} else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */
if (*EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
if (*EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
if (OP1_TYPE == IS_CONST ||
(PZVAL_IS_REF(retval_ptr) && Z_REFCOUNT_P(retval_ptr) > 0)) {
zval *ret;
@ -2878,9 +2878,9 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
} else {
zval *ret;
if (*EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
if (*EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, retval_ptr);
@ -2888,49 +2888,49 @@ ZEND_VM_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
}
FREE_OP1_IF_VAR();
if (!(EG(active_op_array)->last_try_catch)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
} else {
zend_uint i, op_num = opline - EX(op_array)->opcodes;
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(prev_exception)) {
/* leaving */
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
if (!(EG(active_op_array)->last_try_catch)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
} else {
zend_uint i, op_num = opline - EX(op_array)->opcodes;
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(prev_exception)) {
/* leaving */
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (EX(leaving)) {
ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (EX(leaving)) {
ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
}
}
ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
@ -2943,9 +2943,9 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
SAVE_OPLINE();
do {
if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
}
if (OP1_TYPE == IS_CONST || OP1_TYPE == IS_TMP_VAR) {
/* Not supposed to happen, but we'll allow it */
@ -3003,49 +3003,49 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
FREE_OP1_IF_VAR();
if (!(EG(active_op_array)->last_try_catch)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
} else {
zend_uint i, op_num = opline - EX(op_array)->opcodes;
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(prev_exception)) {
/* leaving */
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
if (!(EG(active_op_array)->last_try_catch)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
} else {
zend_uint i, op_num = opline - EX(op_array)->opcodes;
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(prev_exception)) {
/* leaving */
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (EX(leaving)) {
ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
EX(leaving) = 1;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else if (EX(leaving)) {
ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
}
}
ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
@ -3826,7 +3826,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
zend_op_array *new_op_array=NULL;
zend_free_op free_op1;
zval *inc_filename;
zval *tmp_inc_filename = NULL;
zval *tmp_inc_filename = NULL;
zend_bool failure_retval=0;
SAVE_OPLINE();
@ -5138,14 +5138,14 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
/* further blocks will not be relevant... */
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EX(op_array)->try_catch_array[i].catch_op;
catched = i + 1;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
finally = i + 1;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EX(op_array)->try_catch_array[i].finally_op;
finally = i + 1;
}
}
while (EX(fbc)) {
@ -5205,28 +5205,28 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
EX(old_error_reporting) = NULL;
if (catched && finally) {
if (finally_op_num > catch_op_num) {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else {
zend_exception_save(TSRMLS_C);
EX(leaving) = finally;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catched) {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally) {
zend_exception_save(TSRMLS_C);
EX(leaving) = finally;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
if (finally_op_num > catch_op_num) {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else {
zend_exception_save(TSRMLS_C);
EX(leaving) = finally;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catched) {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally) {
zend_exception_save(TSRMLS_C);
EX(leaving) = finally;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
}
ZEND_VM_HANDLER(146, ZEND_VERIFY_ABSTRACT_CLASS, ANY, ANY)
@ -5331,8 +5331,8 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
SAVE_OPLINE();
var_ptr = EX_T(opline->op1.var).var.ptr;
if (Z_TYPE_P(var_ptr) != IS_OBJECT &&
!PZVAL_IS_REF(var_ptr) &&
Z_REFCOUNT_P(var_ptr) > 1) {
!PZVAL_IS_REF(var_ptr) &&
Z_REFCOUNT_P(var_ptr) > 1) {
Z_DELREF_P(var_ptr);
ALLOC_ZVAL(new_zv);
@ -5344,50 +5344,50 @@ ZEND_VM_HANDLER(156, ZEND_SEPARATE, VAR, UNUSED)
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY) {
ZEND_VM_HANDLER(159, ZEND_LEAVE, ANY, ANY)
{
USE_OPLINE;
USE_OPLINE
zend_uint i, op_num = opline - EG(active_op_array)->opcodes;
SAVE_OPLINE();
zend_uint i, op_num = opline - EG(active_op_array)->opcodes;
zend_exception_restore(TSRMLS_C);
if (EX(leaving)) {
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i = 0; i < EX(leaving); i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(exception)) {
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
zend_exception_restore(TSRMLS_C);
if (EX(leaving)) {
zend_uint catch_op_num = 0, finally_op_num = 0;
for (i = 0; i < EX(leaving); i++) {
if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
break;
}
if (op_num < EG(active_op_array)->try_catch_array[i].finally_op) {
finally_op_num = EG(active_op_array)->try_catch_array[i].finally_op;
}
if (EG(exception)) {
if (op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
catch_op_num = EG(active_op_array)->try_catch_array[i].catch_op;
}
}
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
} else {
ZEND_VM_NEXT_OPCODE();
}
if (catch_op_num && finally_op_num) {
if (catch_op_num > finally_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
EX(leaving) = 0;
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
}
} else if (catch_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
ZEND_VM_CONTINUE();
} else if (finally_op_num) {
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[finally_op_num]);
ZEND_VM_CONTINUE();
} else {
ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
}
} else {
ZEND_VM_NEXT_OPCODE();
}
}
ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED)

File diff suppressed because it is too large Load Diff

View File

@ -1920,9 +1920,9 @@ PHP_FUNCTION(curl_copy_handle)
dupch->uses = 0;
ch->uses++;
if (ch->handlers->write->stream) {
Z_ADDREF_P(dupch->handlers->write->stream);
dupch->handlers->write->stream = ch->handlers->write->stream;
Z_ADDREF_P(ch->handlers->write->stream);
}
dupch->handlers->write->stream = ch->handlers->write->stream;
dupch->handlers->write->method = ch->handlers->write->method;
if (ch->handlers->read->stream) {
Z_ADDREF_P(ch->handlers->read->stream);

View File

@ -0,0 +1,18 @@
--TEST--
Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip";
?>
--FILE--
<?php
$curl = curl_init();
$fd = fopen('/tmp/test', 'wb');
curl_setopt($curl, CURLOPT_FILE, $fd);
curl_copy_handle($curl);
echo 'DONE!';
?>
--EXPECTF--
DONE!

View File

@ -11,15 +11,15 @@ if ($curl_version['version_number'] < 0x070e01) {
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C1=v1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net');
curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C2=v2; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.php.net');
curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C1=v1; expires=Thu, 31-Dec-2037 23:59:59 GMT; path=/; domain=.php.net');
curl_setopt($ch, CURLOPT_COOKIELIST, 'Set-Cookie: C2=v2; expires=Thu, 31-Dec-2037 23:59:59 GMT; path=/; domain=.php.net');
var_dump(curl_getinfo($ch, CURLINFO_COOKIELIST));
?>
--EXPECT--
array(2) {
[0]=>
string(38) ".php.net TRUE / FALSE 2147368447 C1 v1"
string(38) ".php.net TRUE / FALSE 2145916799 C1 v1"
[1]=>
string(38) ".php.net TRUE / FALSE 2147368447 C2 v2"
string(38) ".php.net TRUE / FALSE 2145916799 C2 v2"
}

View File

@ -2467,6 +2467,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
convert_to_long(*z_timezone_type);
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
convert_to_string(*z_timezone);
switch (Z_LVAL_PP(z_timezone_type)) {
@ -2474,9 +2477,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
case TIMELIB_ZONETYPE_ABBR: {
char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC);
efree(tmp);
return 1;
break;
}
case TIMELIB_ZONETYPE_ID:
@ -2490,10 +2493,15 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
return 1;
break;
default:
zend_restore_error_handling(&error_handling TSRMLS_CC);
return 0;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
return 1;
}
}
}

View File

@ -0,0 +1,15 @@
--TEST--
Bug #62852 (Unserialize invalid DateTime causes crash)
--INI--
date.timezone=GMT
--FILE--
<?php
try {
$datetime = unserialize('O:8:"DateTime":3:{s:4:"date";s:20:"10007-06-07 03:51:49";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}');
var_dump($datetime);
} catch (Exception $e) {
var_dump($e->getMessage());
}
?>
--EXPECTF--
string(%d) "DateTime::__wakeup(): Failed to parse time string (%s) at position 12 (0): Double time specification"

View File

@ -832,7 +832,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
}
if (errorcode == 0 && is_xmlns == 0) {
attr = xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value);
xmlSetNsProp(elemp, nsptr, (xmlChar *)localname, (xmlChar *)value);
}
} else {
name_valid = xmlValidateName((xmlChar *) localname, 0);
@ -844,7 +844,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) {
node_list_unlink(attr->children TSRMLS_CC);
}
attr = xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value);
xmlSetProp(elemp, (xmlChar *)localname, (xmlChar *)value);
}
}
}

View File

@ -730,6 +730,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
if (sugg) {
zval_dtor(sugg);
array_init(sugg);
}
PHP_ENCHANT_GET_DICT;
@ -743,8 +744,6 @@ PHP_FUNCTION(enchant_dict_quick_check)
RETURN_FALSE;
}
array_init(sugg);
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
if (suggs && n_sugg) {

View File

@ -12,7 +12,7 @@ var_dump(exif_read_data($infile));
?>
===DONE===
--EXPECTF--
Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(x%x + x%x = x%x > x%x) in %s on line %d
Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(%s) in %s on line %d
Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeDoubleIntl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(1) "1"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:3:"1.1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeDoubleIntl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(3) "1.1"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeDoubleIntl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(7) "SFD1.00"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #4
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.10";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeDoubleIntl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(7) "SFD1.10"
}
== didn't crash ==

View File

@ -0,0 +1,49 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// port of Symfony's Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest#testFormatTypeInt32Intl
// Crashes on Windows
// Windows note: the popup '...program has stopped working'(AEDebug Popup)
// doesn't always show if you're rapidly running this test repeatedly.
// regardless of that, the test always crashes every time.
// (it will show up the first time, or if you wait a while before running it again.)
// (the popup may also be disabled, which can be done with a registry setting.)
// you can confirm it crashed by checking the exit code OR
// the message this test prints at the very end (expected output for pass).
//
// Get Exit Code
// Linux: echo $?
// Windows: echo %ErrorLevel%
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(1) "1"
}
== didn't crash ==

View File

@ -0,0 +1,33 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// StubNumberFormatterTest#testFormatTypeInt32Intl is tested many times, each with different args.
// there are 7 sets of args that crash PHP (and other args that don't), each of those 7 is now a separate PHPT test
// to ensure that each of the 7 args are always tested.
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(1) "1"
}
== didn't crash ==

View File

@ -0,0 +1,32 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:14:"-2,147,483,648";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(4) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(2147483648)
[2]=>
string(14) "-2,147,483,648"
[3]=>
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(7) "SFD1.00"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(7) "SFD1.00"
}
== didn't crash ==

View File

@ -0,0 +1,32 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:21:"(SFD2,147,483,648.00)";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(4) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(2147483648)
[2]=>
string(21) "(SFD2,147,483,648.00)"
[3]=>
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
}
== didn't crash ==

View File

@ -0,0 +1,32 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:19:"SFD2,147,483,647.00";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt32Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(4) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(-2147483649)
[2]=>
string(19) "SFD2,147,483,647.00"
[3]=>
string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
//$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(1) "1"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #2
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(1) "1"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #3
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:13:"2,147,483,648";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(2147483648)
[2]=>
string(13) "2,147,483,648"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #4
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:14:"-2,147,483,649";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(-2147483649)
[2]=>
string(14) "-2,147,483,649"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #5
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
int(1)
[2]=>
string(7) "SFD1.00"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #6
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(1.1)
[2]=>
string(7) "SFD1.00"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #7
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:19:"SFD2,147,483,648.00";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(2147483648)
[2]=>
string(19) "SFD2,147,483,648.00"
}
== didn't crash ==

View File

@ -0,0 +1,30 @@
--TEST--
Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #8
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:21:"(SFD2,147,483,649.00)";}');
var_dump($unit_test_args);
// execute the code from #testFormatTypeInt64Intl
$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
echo "== didn't crash ==".PHP_EOL;
?>
--EXPECT--
array(3) {
[0]=>
object(NumberFormatter)#1 (0) {
}
[1]=>
float(-2147483649)
[2]=>
string(21) "(SFD2,147,483,649.00)"
}
== didn't crash ==

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::__construct() should not be callable
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator: clone handler
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::current(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator factories: basic tests
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator factory methods: argument errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::first(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::first()/last()/previous()/current(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::following(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::following()/preceding()/isBoundary(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getLocale(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getLocale(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getPartsIterator(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::getText(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::getText(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::isBoundary(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::last(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::next(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::next(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::preceding(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::previous(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,6 +1,7 @@
--TEST--
IntlBreakIterator::setText(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--

View File

@ -1,5 +1,9 @@
--TEST--
IntlBreakIterator::setText(): arg errors
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::__construct(): bad timezone or calendar
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: several forms of the calendar arg
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::getCalendarObject(): bad args
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::getTimeZone(): bad args
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: setCalendar()/getCalendar()/getCalendarObject()
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: get/setTimeZone()
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: setTimeZoneID() deprecation
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter::setTimeZone() bad args
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlDateFormatter: several forms of the timezone arg
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::__construct: basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRuleStatusVec(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRuleStatus(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -1,5 +1,9 @@
--TEST--
IntlRuleBasedBreakIterator::getRules(): basic test
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);

View File

@ -90,10 +90,10 @@ $arr = json_decode($test, true);
var_dump($arr);
echo "ENCODE: FROM OBJECT\n";
$obj_enc = json_encode($obj);
$obj_enc = json_encode($obj, JSON_PARTIAL_OUTPUT_ON_ERROR);
echo $obj_enc . "\n";
echo "ENCODE: FROM ARRAY\n";
$arr_enc = json_encode($arr);
$arr_enc = json_encode($arr, JSON_PARTIAL_OUTPUT_ON_ERROR);
echo $arr_enc . "\n";
echo "DECODE AGAIN: AS OBJECT\n";

View File

@ -239,9 +239,9 @@ ZEND_END_ARG_INFO()
const zend_function_entry mcrypt_functions[] = { /* {{{ */
PHP_DEP_FE(mcrypt_ecb, arginfo_mcrypt_ecb)
PHP_FE(mcrypt_cbc, arginfo_mcrypt_cbc)
PHP_FE(mcrypt_cfb, arginfo_mcrypt_cfb)
PHP_FE(mcrypt_ofb, arginfo_mcrypt_ofb)
PHP_DEP_FE(mcrypt_cbc, arginfo_mcrypt_cbc)
PHP_DEP_FE(mcrypt_cfb, arginfo_mcrypt_cfb)
PHP_DEP_FE(mcrypt_ofb, arginfo_mcrypt_ofb)
PHP_FE(mcrypt_get_key_size, arginfo_mcrypt_get_key_size)
PHP_FE(mcrypt_get_block_size, arginfo_mcrypt_get_block_size)
PHP_FE(mcrypt_get_cipher_name, arginfo_mcrypt_get_cipher_name)

View File

@ -18,6 +18,12 @@ echo trim(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT);
--EXPECTF--
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
PHP Testfest 2008
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommend in %s on line %d

View File

@ -72,16 +72,24 @@ function special_var_dump($str) {
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=24
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
string(32) "736563726574206d6573736167650000"
@ -89,14 +97,20 @@ string(32) "736563726574206d6573736167650000"
iv length=4
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(32) "736563726574206d6573736167650000"
iv length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(32) "736563726574206d6573736167650000"
iv length=9
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(32) "736563726574206d6573736167650000"
===DONE===

View File

@ -55,16 +55,24 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "082b437d039d09418e20dc9de1dafa7ed6da5c6335b78950968441da1faf40c1f886e04da8ca177b80b376811e138c1bf51cb48dae2e7939"
key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "0627351e0f8a082bf7981ae2c700a43fd3d44b270ac67b00fded1c5796eea935be0fef2a23da0b3f5e243929e62ac957bf0bf463aa90fc4f"
key length=24
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
@ -72,14 +80,20 @@ string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b6
iv length=4
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
iv length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
string(112) "bac347506bf092c5557c4363c301745d78f047028e2953e84fd66b30aeb6005812dadbe8baa871b83278341599b0c448ddaaa52b5a378ce5"
iv length=9
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
===DONE===

View File

@ -41,11 +41,15 @@ var_dump( mcrypt_cbc($cipher, $key, $data) );
-- Testing mcrypt_cbc() function with more than expected no. of arguments --
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc() expects at most 5 parameters, 6 given in %s on line %d
NULL
-- Testing mcrypt_cbc() function with less than expected no. of arguments --
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc() expects at least 4 parameters, 3 given in %s on line %d
NULL
===DONE===

View File

@ -124,106 +124,132 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--int indexed array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--associative array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--nested arrays--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, array given, %s(%d)
NULL
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, object given, %s(%d)
NULL
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Module initialization failed, %s(%d)
bool(false)
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 1 to be string, resource given, %s(%d)
NULL
===DONE===

View File

@ -124,87 +124,112 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "d109b7973383127002474ae731c4b3a8"
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "3e82a931cedb03a38b91a637ff8c9f9e"
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "de71833586c1d7132a289960ebeeca7a"
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "7d0489dd2e99ae910ecc015573f3dd16"
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "978055b42c0506a8947e3c3c8d994baf"
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "4aa84ba400c2b8ef467d4d98372b4f4e"
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "e731dc5059b84e0c8774ac490f77d6e6"
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--associative array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "bc27b3a4e33b531d5983fc7df693cd09"
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "19420fa26f561ee82ed84abbcd2d284b"
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, object given, %s(%d)
string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "be722a5ffc361d721fbcab1eacc6acf5"
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 2 to be string, resource given, %s(%d)
string(0) ""
===DONE===

View File

@ -124,87 +124,112 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "ce5fcfe737859795"
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "905ab1ae27ee9991"
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "5835174e9c67c3e7"
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "28ff0601ad9e47fa"
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "ce9f2b6e2fc3d9f7"
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "24eb882ce9763e4018fba9b7f01b0c3e"
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5eed30e428f32de1d7a7064d0ed4d3eb"
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "bebf2a13676e1e30"
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--associative array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "84df495f6cd82dd9"
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "7c91cdf8f8c51485034a9ee528eb016b"
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, object given, %s(%d)
string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(16) "206f6d3617a5ab32"
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 3 to be string, resource given, %s(%d)
string(0) ""
===DONE===

View File

@ -124,82 +124,108 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--int indexed array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--associative array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--nested arrays--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--mixed case string--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--heredoc--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 8 - Object of class classWithoutToString could not be converted to int, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "5f781523f696d596e4b809d72197a0cc"
--resource--
string(%d) %s
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
string(32) "983d5edc5f77fe42e2372a0339dc22b0"
===DONE===

View File

@ -124,106 +124,132 @@ fclose($fp);
*** Testing mcrypt_cbc() : usage variation ***
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--int indexed array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--associative array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--nested arrays--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, object given, %s(%d)
string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
string(32) "6438db90653c4d3080c3ceab43618c05"
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc() expects parameter 5 to be string, resource given, %s(%d)
string(0) ""
===DONE===

View File

@ -1,5 +1,5 @@
--TEST--
mcrypt_cbf
mcrypt_cfb
--SKIPIF--
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
@ -8,7 +8,7 @@ $key = "FooBar";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CFB), MCRYPT_RAND);
$enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
// we have to trim as AES rounds the blocks and decrypt doesnt detect that
@ -18,6 +18,12 @@ echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT);
--EXPECTF--
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
PHP Testfest 2008
Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend in %s on line %d

View File

@ -5,13 +5,13 @@ mcrypt_create_iv
--FILE--
<?php
$iv1 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_RAND);
$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_192, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);
$iv2 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM);
$iv3 = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_RANDOM);
echo strlen($iv1) . "\n";
echo strlen($iv2) . "\n";
echo strlen($iv3) . "\n";
--EXPECT--
16
24
32
16
16

Some files were not shown because too many files have changed in this diff Show More