Skip to content

Commit bc475ad

Browse files
committed
Fix non-canonical casts
They may be deprecated, but they should still produce the correct type...
1 parent dc0962c commit bc475ad

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Zend/tests/type_casts/non_canonical_binary_cast.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ var_dump((binary) 42);
88
?>
99
--EXPECTF--
1010
Deprecated: Non-canonical cast (binary) is deprecated, use the (string) cast instead in %s on line %d
11-
int(42)
11+
string(2) "42"

Zend/tests/type_casts/non_canonical_boolean_cast.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ var_dump((boolean) 42);
88
?>
99
--EXPECTF--
1010
Deprecated: Non-canonical cast (boolean) is deprecated, use the (bool) cast instead in %s on line %d
11-
int(42)
11+
bool(true)

Zend/tests/type_casts/non_canonical_double_cast.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ var_dump((double) 42);
88
?>
99
--EXPECTF--
1010
Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead in %s on line %d
11-
int(42)
11+
float(42)

Zend/zend_language_scanner.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16481648
if (PARSER_MODE()) {
16491649
zend_error(E_DEPRECATED, "Non-canonical cast (double) is deprecated, use the (float) cast instead");
16501650
}
1651-
RETURN_TOKEN(T_INT_CAST);
1651+
RETURN_TOKEN(T_DOUBLE_CAST);
16521652
}
16531653

16541654
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"real"{TABS_AND_SPACES}")" {
@@ -1667,7 +1667,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16671667
if (PARSER_MODE()) {
16681668
zend_error(E_DEPRECATED, "Non-canonical cast (binary) is deprecated, use the (string) cast instead");
16691669
}
1670-
RETURN_TOKEN(T_INT_CAST);
1670+
RETURN_TOKEN(T_STRING_CAST);
16711671
}
16721672

16731673
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
@@ -1686,7 +1686,7 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16861686
if (PARSER_MODE()) {
16871687
zend_error(E_DEPRECATED, "Non-canonical cast (boolean) is deprecated, use the (bool) cast instead");
16881688
}
1689-
RETURN_TOKEN(T_INT_CAST);
1689+
RETURN_TOKEN(T_BOOL_CAST);
16901690
}
16911691

16921692
<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" {

0 commit comments

Comments
 (0)