Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/php/php-src into accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
cpriest committed Dec 30, 2012
2 parents 20822c5 + ae5d862 commit 64699ee
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion Zend/zend_highlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ ZEND_API void zend_strip(TSRMLS_D)

case T_END_HEREDOC:
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
efree(token.value.str.val);
/* read the following character, either newline or ; */
if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) {
zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng));
Expand Down
5 changes: 5 additions & 0 deletions ext/filter/logical_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret
break;
}

if (*str == '0' && str + 1 == end) {
/* Special cases: +0 and -0 */
return 1;
}

/* must start with 1..9*/
if (str < end && *str >= '1' && *str <= '9') {
ctx_value = ((sign)?-1:1) * ((*(str++)) - '0');
Expand Down
8 changes: 8 additions & 0 deletions ext/filter/tests/filter_data.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ precision=14
/* Integer */
$data = "-123"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = "0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = "-0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = "+0"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = "123"; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = -123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = 0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = -0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = +0; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = 123; var_dump(filter_var($data, FILTER_VALIDATE_INT));
$data = ""; var_dump(filter_var($data, FILTER_VALIDATE_INT));
echo "\n";
Expand Down Expand Up @@ -46,9 +50,13 @@ $data = ""; var_dump(filter_var($data, FILTER_VALIDATE_BOOLEAN));
--EXPECT--
int(-123)
int(0)
int(0)
int(0)
int(123)
int(-123)
int(0)
int(0)
int(0)
int(123)
bool(false)

Expand Down
16 changes: 16 additions & 0 deletions ext/standard/tests/strings/bug63874.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Bug #63874 (Segfault if php_strip_whitespace has heredoc)
--FILE--
<?php
echo php_strip_whitespace(__FILE__);

return <<<A
a
A;
?>
--EXPECT--
<?php
echo php_strip_whitespace(__FILE__); return <<<A
a
A;
?>

0 comments on commit 64699ee

Please sign in to comment.