Skip to content

Commit 9f345f6

Browse files
committed
Removed 5dd96ce (#202) following 58955e5 (fix #244);
1 parent ec5fb9c commit 9f345f6

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

application/libraries/Format.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,31 +210,23 @@ public function to_csv()
210210
// Encode as JSON
211211
public function to_json()
212212
{
213-
$_numeric = strnatcmp(PHP_VERSION, '5.3.3') >= 0;
214213
$callback = isset($_GET['callback']) ? $_GET['callback'] : '';
215-
216-
// we only honour jsonp callback which are valid javascript identifiers
217214
if ($callback === '')
218215
{
219-
return $_numeric
220-
? json_encode($this->_data, JSON_NUMERIC_CHECK);
221-
: json_encode($this->_data);
216+
return json_encode($this->_data);
222217
}
218+
// we only honour jsonp callback which are valid javascript identifiers
223219
else if (preg_match('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i', $callback))
224220
{
225221
// this is a jsonp request, the content-type must be updated to be text/javascript
226222
header("Content-Type: application/javascript");
227-
return $_numeric
228-
? $callback . "(" . json_encode($this->_data, JSON_NUMERIC_CHECK) . ");";
229-
: $callback . "(" . json_encode($this->_data) . ");";
223+
return $callback . "(" . json_encode($this->_data) . ");";
230224
}
231225
else
232226
{
233227
// we have an invalid jsonp callback identifier, we'll return plain json with a warning field
234228
$this->_data['warning'] = "invalid jsonp callback provided: ".$callback;
235-
return $_numeric
236-
? json_encode($this->_data, JSON_NUMERIC_CHECK);
237-
: json_encode($this->_data);
229+
return json_encode($this->_data);
238230
}
239231
}
240232

0 commit comments

Comments
 (0)