@@ -108,16 +108,16 @@ function prepareLine($op1, $op2, $cmp, $operator) {
108
108
$ error = "echo ' " . addcslashes ("$ op1_p $ operator $ op2_p " , "\\' " ) . '\', "\n"; $f++; ' ;
109
109
110
110
$ compare = "@( $ op1_p $ operator $ op2_p) " ;
111
- $ line = "\$c++; try { " ;
111
+ $ line = "\$c++; " ;
112
112
try {
113
113
$ result = makeParam ($ cmp ());
114
- $ line .= "if ( " . ($ result === "(NAN) " ? "!is_nan( $ compare) " : "$ compare !== $ result " ) . ") { $ error } } catch (Error \$ e) { $ error } " ;
114
+ $ line .= "if ( " . ($ result === "(NAN) " ? "!is_nan( $ compare) " : "$ compare !== $ result " ) . ") { $ error } " ;
115
115
} catch (Error $ e ) {
116
116
if (get_class ($ e ) == "Error " ) {
117
117
return "// exempt $ op1_p $ operator $ op2_p from checking, it generates a compile time error " ;
118
118
}
119
119
$ msg = makeParam ($ e ->getMessage ());
120
- $ line .= "$ compare; $ error } catch (Error \$e) { if ( \$e->getMessage() !== $ msg) { $ error } } " ;
120
+ $ line .= "try { $ compare; $ error } catch (Error \$e) { if ( \$e->getMessage() !== $ msg) { $ error } } " ;
121
121
}
122
122
return $ line ;
123
123
}
@@ -130,7 +130,10 @@ fwrite($file, "<?php\n");
130
130
foreach ($ input as $ left ) {
131
131
foreach ($ input as $ right ) {
132
132
foreach ($ operands as $ operand ) {
133
- fwrite ($ file , prepareLine ($ left , $ right , function () use ($ left , $ right , $ operand ) { return eval ("return @( \$left $ operand \$right); " ); }, $ operand ) . "\n" );
133
+ $ line = prepareLine ($ left , $ right , function () use ($ left , $ right , $ operand ) {
134
+ return eval ("return @( \$left $ operand \$right); " );
135
+ }, $ operand );
136
+ fwrite ($ file , $ line . "\n" );
134
137
}
135
138
}
136
139
}
0 commit comments