We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Warning error with TruncHTML

Development and Programming

Factory Interactive's avatar
Factory Interactive
181 posts
17 years ago
Factory Interactive's avatar Factory Interactive

I’m getting this error with TruncHTML:

Warning: Wrong value for parameter 4 in call to preg_match_all() in /public_html/ee/plugins/pi.trunchtml.php on line 63

Using PHP 4.3.2.

I’ve contacted the developer but he hasn’t come back with anything…

Anyone seen this before?

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz

I have no PHP version older than 4.3.2.2 where it works. There is a bug report on PHP.net for 4.3.2 about this funtion, though.

Try this:

Open pi.trunchtml.php in a text editor. Find PREG_OFFSET_CAPTURE in line 63. Replace it with PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER.

The line should then read:

if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x;[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER)) {
       
Factory Interactive's avatar
Factory Interactive
181 posts
17 years ago
Factory Interactive's avatar Factory Interactive

Great! That seemed to solve it.

Is PREG_OFFSET_CAPTURE something new to the latest versions of PHP?

At any rate, it’s working well. Great plugin. Thanks for writing it.

You should really give people a way to make donations on your website. I’d give a few dollars.

If you get that set up, shoot me a note.

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz

That flag was introduced in 4.3.0. That was in Dec. 2002 by the way, so not exactly recent 😉

Usually, and according to the manual, you don’t have to specify PREG_PATTERN_ORDER as it is the deafult sort order. Turns out there were one or two builds where you have to nonetheless, otherwise you get that warning.

You got one of those, me thinks.

I will add that to the next version. It’s superfluous but it doesn’t hurt.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.