After upgrading to the latest version... I get the following errors after clicking on a node:

Parse error: syntax error, unexpected T_LNUMBER in /home/mysite/public_html/modules/nodewords/nodewords.module(812) : regexp code on line 1

Fatal error: preg_replace() [function.preg-replace]: Failed evaluating code: Studio 72 - Nocturnal in /home/mysite/public_html/modules/nodewords/nodewords.module on line 812

Comments

MasterSolution’s picture

I can confirm this issue. Started to happen after upgrade to 1.6 to nodes with custom views.

It doesn't happen on every node though, some of them just work fine.

As If’s picture

Similar problem here, except I didn't upgrade. This is my first install:

Parse error: parse error, unexpected T_STRING in /home/mysite.com/httpdocs/modules/nodewords/nodewords.module(812) : regexp code on line 1

Fatal error: Failed evaluating code: 632.jpg in /home/mysite.com/httpdocs/modules/nodewords/nodewords.module on line 812

632.jpg is a real file, and it appears normally in the View just preceding (including) this Node.

Again, most nodes are fine. Just this one freaky one so far.

Robrecht Jacques’s picture

What PHP version do you use? You can see that on admin/logs/status.

As If’s picture

4.3.9.

And here's some more info: I just managed to replicate this bug on a node that had previously been working fine.

I uploaded a picture to it via CCK imagefield. No problem. Then I deleted that picture and uploaded another one where the filename (preceding the .jpg) was a NUMBER, and it choked.

In every instance of failure, the filename is a number.jpg

As If’s picture

[duplicate post removed]

Robrecht Jacques’s picture

Try to replace:

 $pattern = '/<img\s[^>]*alt=["\']([^"\']*)["\'][^>]*>/e';
 $replacement = '${1}';
 $text = preg_replace($pattern, $replacement, $text);

with

 $pattern = '/<img\s[^>]*alt=["\']([^"\']*)["\'][^>]*>/i';
 $replacement = '${1}';
 $text = preg_replace($pattern, $replacement, $text);

around line 812 (in function function _nodewords_check_content($text) {) of nodewords.module.

In the first line: replace "e" with "i" at the end.

Tell me if that worked.

As If’s picture

YES. You nailed it.

Robrecht Jacques’s picture

Yeah, stupid typo. Only tested it with non-number filenames.

When I get home later today I'll release a new version.

Devis’s picture

Was having same problem after the upgrade, solved editing the pattern too, the "e" modifier makes preg_replace treat the replacement parameter as php code.
The error was present also with "alt" containing non-php valid chars like " " and "!", for example
<img src="xxx" alt="blank space" />
and
<img src="xxx" alt="exclamationmark!" />

Anonymous’s picture

+1

Had this same issue happen to me on my upgrade and the solution in #6 fixed the problem.

Thanks,
txcrew

Robrecht Jacques’s picture

Status: Active » Fixed

Fixed in 5.x-1.7.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.