Unexpected "Cannot extract token from" Error Due to Tabs / Newlines [message #4605] |
Sun, 26 October 2014 09:20 |
kong
Messages: 90 Registered: December 2011
|
Member |
|
|
When the library function where2indexedArray($where) is called with $where containing tabs and/or newlines, it sometimes generates error:
"Cannot extract token from ..."
Such error could be avoided by being careful not to use tabs and newlines in the $where string. However, this results in reduced readability of source code, especially with complex $where conditions. So, would like to propose to add one line in function where2indexedArray($where), as follows:
...
$input = $where;
// Add this line to solve "Cannot extract token from" error:
$where = preg_replace("/\s\s+/", " ", $where);
$output = array();
while (!empty($where)) {
...
[Updated on: Sun, 26 October 2014 09:35] Report message to a moderator
|
|
|
|
|
Re: Unexpected "Cannot extract token from" Error Due to Tabs / Newlines / Spaces [message #4611 is a reply to message #4609] |
Sun, 26 October 2014 15:47 |
kong
Messages: 90 Registered: December 2011
|
Member |
|
|
Just discovered another case that my original proposal did not solve.
(With a space before 'test_id')
This results in
Fatal Error: Cannot extract token from: ' test_id < 3' (# 256)
Error in line 6993 of file 'D:\Pet\UwAmp\www\rad186\includes\include.library.inc'.
To take care of such cases, I would like to modify my original proposal to
...
$input = $where;
// Add this line to solve "Cannot extract token from" error:
$where = trim(preg_replace("/\s+/", " ", $where));
$output = array();
while (!empty($where)) {
...
[Updated on: Sun, 26 October 2014 22:27] Report message to a moderator
|
|
|
|