Plugin

Archived
Forum
(read-only)

CE String

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Causing Effect

     

Conflict with built-in Markdown plugin

Bug (Resolved)

Eli Van Zoeren
Eli Van Zoeren

This just started recently, and I’m actually not sure why it wasn’t happening before… It seems that CE String’s copy of Markdown is now being loaded before EE 2.7’s. So when EE tries to load its own copy, I get a “cannot redeclare method” error. Maybe you can check if EE >= 2.7 and use the built in copy of the library instead?

Fatal errorCannot redeclare Markdown() (previously declared in 
/[redacted]/third_party/ce_str/libraries/php_markdown_extra_1.2.5/markdown.php:52in 
/[redacted]/expressionengine/libraries/typography/Markdown/markdown.php on line 72 
Causing Effect - Aaron Waldon
# 1
Developer
Causing Effect - Aaron Waldon

Hi Eli!

Were you at EECI?

Wouldn’t this be an EE bug? I check if Markdown exists, but they don’t seem to be doing that. I cannot wait until namespacing is added into EE.

So does changing this in CE String:

if ( ! function_exists'Markdown' ) )
  
{
   
require PATH_THIRD 'ce_str/libraries/php_markdown_extra_1.2.5/markdown.php';
  

to this:

if ( ! function_exists'Markdown' ) )
  
{
   
if ( version_compareAPP_VER'2.7.0''>=' ) )
   
{
    
require APPPATH 'libraries/typography/Markdown/markdown.php';
   
}
   
else
   
{
    
require PATH_THIRD 'ce_str/libraries/php_markdown_extra_1.2.5/markdown.php';
   
}
  } 

resolve the issue?

Eli Van Zoeren
# 2
Eli Van Zoeren

Aaron,

Sadly, I wasn’t. The one time a conference I want to attend takes place 2 hours from home, and I had to be on the East Coast. I’m going to make a real effort to come up for one of the EEPDX meetings soon, though.

Technically it’s probably an EE bug, but on the other hand they can’t count on loading your copy of Markdown, whereas you can count on theirs being available post-2.7. Plus you’re more responsive to requests :)

Anyway, yes, that code fixes it. I had hotfixed something similar in the mean time (actually just disabling your Markdown filter >2.7 and using the native tags instead), but this seems to take care of it for real.

Hope to see you soon!
-E

Causing Effect - Aaron Waldon
# 3
Developer
Causing Effect - Aaron Waldon

I’m happy to hear that fixed it. Thanks for trying it out. That change will be included in the next release of CE String.

Too bad it didn’t work out for us to see each other last week! My family and I just recently moved to Florida, so I won’t be at the EEPDX meetings any more. Perhaps next year we can meet up for EECI. They are thinking about hosting it in Washington DC.

Eli Van Zoeren
# 4
Eli Van Zoeren

Oh, damn! I missed that change… too bad (for us meeting up, I mean - I’m sure Florida is nice). Next year!

Causing Effect - Aaron Waldon
# 5
Developer
Causing Effect - Aaron Waldon

Haha. Yeah, next year it is.

I used two of your wonderful add-ons on a recent project. Thanks for the awesome work and keep in touch!

Eli Van Zoeren
# 6
Eli Van Zoeren

Looks like EllisLab changed the Markdown library again in 2.9. I fixed the loader by adding the following extra conditional on line 852:

if ( version_compareAPP_VER'2.9.0''>=' ) )
    
{
        
require APPPATH 'libraries/typography/Markdown/Michelf/Markdown.inc.php';
    
}
    
elseif ( version_compareAPP_VER'2.7.0''>=' ) )
    .... 
Causing Effect - Aaron Waldon
# 7
Developer
Causing Effect - Aaron Waldon

Hi Eli!

Thanks for the heads up! I ran into the same issue when testing for my own site. I had to make another change to the 2.9+ markdown method to prevent smartypants from running after markdown. I just pushed up the latest version of CE String which should take care of the issue.

Thanks again man. I hope you and your family are well. :)

Eli Van Zoeren
# 8
Eli Van Zoeren

Yeah, I realized later that it still wasn’t working, but hadn’t figured out why yet. I’ll try your new version. Thanks!

Everything is good out here. How’s Florida?

Causing Effect - Aaron Waldon
# 9
Developer
Causing Effect - Aaron Waldon

That’s great. No complaints here either. :)