Note that there are some explanatory texts on larger screens.

plurals
  1. POpreg_match() fails silently while checking a very long string
    text
    copied!<p>I am using Zend Framework in one of my projects and the file Zend/Uri/Http.php has a function validateQuery which validates a given query using preg_match.</p> <p>It works fine normally but I have a paypal url query string which is very long, around 1 500 Characters, and the <code>preg_match</code> function fails silently for this query.</p> <p>I am using PHP ver. 5.4.7 hence I don't have the limit of pcre.backtrack_limit=100000.</p> <p>Right now I have modified the file in Zendframework to not validate any queries above 1000 characters but this obviously isn't the right solution. </p> <p>Following one of comments I tried to use another very long query with preg_match in a standalone page and I have the same error, I am pasting my test data below for reference.</p> <pre><code>$query = 'search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8&amp;search?q=very+long+query+string+example&amp;aq=f&amp;oq=very+long+query+string+example&amp;aqs=chrome.0.57j62l3.5553j0&amp;sourceid=chrome&amp;ie=UTF-8'; $pattern = "/^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:@&amp;=+$,])*$/"; echo preg_match( $pattern, $query ); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload