Home

Stefano Mallozzi Professional web developmentStefano Mallozzi Professional web development

Condividi contenuti
  • About me
  • Bookmark
  • Tips and tricks
  • Tutorials
  • Contact me
  • Feed aggregator
Home

Languages

  • Italiano
  • English

Contact me

Tag cloud

connection drupal i18n ics images internet lan network node images photo php seo
More tags

Photo galleries

  • Pictures of Gaeta

Unexpected empty output for regular expressions on PHP 5.2.x

Sat, 28/03/2009 - 01:01 — stefano

Since PHP 5.2.x it may happen to find unexpected empty output on regular expressions (preg_replace, preg_match, etc...) when parsing very long strings. This bug is caused by a restrictive limit of pcre.backtrack_limit directive. The default value is 100000, so it can handle strings up to 100000 characters. It would make more sense to change the limit to a higher value, even 20MB. The same change can be applied to the pcre.recursion_limit directive.

Both directives can be changed in the php.ini file:

pcre.backtrack_limit=20971520
pcre.recursion_limit=20971520

or by ini_set():

ini_set('pcre.backtrack_limit', 20971520);
ini_set('pcre.recursion_limit', 20971520);

Tags:
  • Tips and tricks
  • pcre
  • php
  • regular expressions
»
  • Italiano

© Stefano Mallozzi
P.IVA 02155580596
Valid XHTML 1.0 Strict Valid CSS Valid RSS
Powered by Drupal Powered by Apache Powered by MySQL Powered by PHP