php - preg_match() fails silently while checking a very long string -


i using zend framework in 1 of projects , file zend/uri/http.php has function validatequery validates given query using preg_match.

it works fine have paypal url query string long, around 1 500 characters, , preg_match function fails silently query.

i using php ver. 5.4.7 hence don't have limit of pcre.backtrack_limit=100000.

right have modified file in zendframework not validate queries above 1000 characters isn't right solution.

following 1 of comments tried use long query preg_match in standalone page , have same error, pasting test data below reference.

$query = 'search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8&search?q=very+long+query+string+example&aq=f&oq=very+long+query+string+example&aqs=chrome.0.57j62l3.5553j0&sourceid=chrome&ie=utf-8';  $pattern = "/^(?:%[[:xdigit:]]{2}|[a-za-z0-9-_.!~*'()\[\];\/?:@&=+$,])*$/";  echo preg_match( $pattern, $query ); 

right have modified file in zendframework not validate queries above 1000 characters isn't right solution.

well, not sound too wrong me. 1000 characters sounds sane limit allow url input , deny larger that. large urls seem exploit validator, therefore filter them out until software vendor has fixed flaw in library.

check vendor support options case you've found potential bug or flaw. related validation , has security implications i'm pretty sure vendor happy learn problem.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -