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

MSM PHP errors on second site but not original

Development and Programming

readio's avatar
readio
12 posts
about 14 years ago
readio's avatar readio

Hi

I have recently set up MSM and duplicated across all the channels/content to the second site.

On some pages I am getting the below error on the new site but not on the old. As far as I can see the pages are identical.

A PHP Error was encountered

Severity: Warning

Message: preg_replace() [function.preg-replace]: Unknown modifier '/'

Filename: core/Security.php

Line Number: 610

A PHP Error was encountered

Severity: Warning

Message: preg_replace() [function.preg-replace]: Unknown modifier '/'

Filename: core/Security.php

Line Number: 610

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at/system/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 405

Any ideas what could be causing this issue?

Cheers Darren

       
Dan Decker's avatar
Dan Decker
7,338 posts
about 14 years ago
Dan Decker's avatar Dan Decker

Hi readio,

I’m sorry you have encountered these errors!

In order to get you the best response possible, I need to know the version of ExpressionEngine and MSM that you are running here.

Cheers,

       
readio's avatar
readio
12 posts
about 14 years ago
readio's avatar readio

EE version is 2.4.0

MSM is 2.1.2

       
readio's avatar
readio
12 posts
about 14 years ago
readio's avatar readio

Looking at this in more detail, the pages that are showing those errors have a ‘TM’ entity within the copy.

Could this be causing it? Although it seems strange that the original site does not show any errors and has the same content.

       
Dan Decker's avatar
Dan Decker
7,338 posts
about 14 years ago
Dan Decker's avatar Dan Decker

Hi readio,

Ok - I need you to dig in to /system/codeigniter/Security.php and let me know what you find on line 610.

It should look exactly like this:

$str = preg_replace("/<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)/i", '<$1$2$4$5', $str, -1, $count);

Also, can you post the template for the affected pages, and sample content from an entry that is causing this problem?

It is odd that it only affects one site and not the other.

Cheers,

       
readio's avatar
readio
12 posts
about 14 years ago
readio's avatar readio

Hi Dan

I do have that line of code in Security.php - the paths is slightly different /system/codeigniter/core/Security.php

Is there any way this thread can be made private or I can PM you? I’m not too sure about posting content/templates on a public forum.

       
Dan Decker's avatar
Dan Decker
7,338 posts
about 14 years ago
Dan Decker's avatar Dan Decker

Hi readio,

Indeed, sorry about the incorrect path!

Be on the lookout for an email from us.

Cheers,

       
bluesonora's avatar
bluesonora
90 posts
13 years ago
bluesonora's avatar bluesonora

hi- i’m seeing this error too, on first site, in MSM, same EE + MSM versions as above. my security.php has line 610 as you have it, too.

       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

Hi littlered,

Sorry for the trouble you are having with this!

Are you trying to use special characters as well?

I checked for the follow up on this issue, but it literally fixed itself for the original poster.

Can you tell me a little about your server environment? PHP/MySQL version, etc.

Cheers,

       
Adam Christianson's avatar
Adam Christianson
115 posts
13 years ago
Adam Christianson's avatar Adam Christianson

I’m also seeing these errors on occasion in a 2.4.0 install, but no MSM. The issue seems to be the delimiters conflicting possibly with $str that is being passed to that function. I’m guessing URLs? (http://) where the regex doesn’t have the slashes escaped? Changing the delimiters in the preg_replace() call on line 610 of the core/Security.php file makes the warning go away. As a test I change the line to:

$str = preg_replace("#<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)#i", '<$1$2$4$5', $str, -1, $count);

from

$str = preg_replace("/<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)/i", '<$1$2$4$5', $str, -1, $count);

basically replacing the ‘/’ delimiters with ‘#’ ones. I’ll probably go check the 2.5.0 changlog, but is it possible this is a bug that was fixed?

IMPORTANT: I made this change as just a test. I would personally NEVER modify a core file and don’t recommend that you do either.

       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

Hi Adam,

Thanks for your sleuthing, input and caveat!

Indeed, modifying Core files is not recommended.

Cheers,

       
Adam Christianson's avatar
Adam Christianson
115 posts
13 years ago
Adam Christianson's avatar Adam Christianson

So Dan, is this something that would be fixed in 2.5.0?

       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

Hi Adam,

I do hesitate to say for sure. The affected files are in CodeIgnter and those changes aren’t tracked in the ExpressionEngine change log.

I haven’t experienced this in 2.5.x, but I didn’t run into it in the affected versions either, so I’m not a good test.

Cheers,

       
Adam Christianson's avatar
Adam Christianson
115 posts
13 years ago
Adam Christianson's avatar Adam Christianson

Any word on this? These errors are holding me up on a project,

       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

Hi Adam,

Looking into ExpressionEngine 2.5.2:

$str = preg_replace("/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(".implode('|', $attribs).")(.*?)([\s><])([><]*)/i", '<$1 $3$5$6$7', $str, -1, $count);

So the line is still the same. I wonder if this would be related to the way PHP is configured? Simply because on my X 10.7.4 homebrew setup, I do not have this issue. Nor does the vast majority of our Community, or we would hear much more about it.

Cheers,

       
1 2

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.