File tree 2 files changed +30
-1
lines changed
spec/cc/engine/analyzers/php
vendor/php-parser/lib/PhpParser/Serializer
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 56
56
expect ( result ) . to match "\" type\" :\" issue\" "
57
57
end
58
58
59
+ it "handles INF & NAN constants" do
60
+ create_source_file ( "foo.php" , <<-EOPHP )
61
+ <?php
62
+ function f1($name) {
63
+ // the php-parser lib turns this into INF, but writing INF directly gets emitted differently
64
+ if (empty($name)) {
65
+ return 646e444;
66
+ } else {
67
+ return 0;
68
+ }
69
+ }
70
+
71
+ function f2($name) {
72
+ if (empty($name)) {
73
+ return 646e444;
74
+ } else {
75
+ return 0;
76
+ }
77
+ }
78
+ EOPHP
79
+
80
+ result = run_engine ( engine_conf ) . strip
81
+ expect ( result ) . to match "\" type\" :\" issue\" "
82
+ end
83
+
59
84
it "skips unparsable files" do
60
85
create_source_file ( "foo.php" , <<-EOPHP )
61
86
<?php blorb &; "fee
Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ protected function _serialize($node) {
29
29
}
30
30
31
31
foreach ($ node as $ name => $ subNode ) {
32
- if (is_string ($ subNode )) {
32
+ if (INF === $ subNode ) {
33
+ $ doc [$ name ] = "_PHP:CONST:INF " ;
34
+ } elseif (NaN === $ subNode ) {
35
+ $ doc [$ name ] = "_PHP:CONST:NaN " ;
36
+ } elseif (is_string ($ subNode )) {
33
37
$ doc [$ name ] = utf8_encode ($ subNode );
34
38
} elseif (is_int ($ subNode )) {
35
39
$ doc [$ name ] = $ subNode ;
You can’t perform that action at this time.
0 commit comments