Problem with symlinked plugin directory

Author Posts

ddenev

Hi,

I have to ask my question from an image – https://www.dropbox.com/s/pzp6nyaudwfc4gx/microthemer_symlinks_question.jpg?dl=0

since if I write it here I always get this error when I submit it:
“A potentially unsafe operation has been detected in your request to this site”

Sorry about that but I struggled more than an hour to try to submit it 🙂

Here is the link from the question: https://bugs.php.net/bug.php?id=46260


Sebastian

Hey,

Thanks for alerting me to the forum submission issue. It seems like our firewall wrongly interpreted your post as an attempt to inject code.

To be honest, I’m reluctant to change the code for establishing the /wp-content directory path for your use case because the current code has evolved over many years to provide maximum compatibility with various server environments and WP configurations.

And I agree with this behaviour being flagged as a PHP bug. Do you know if it has it been fixed on newer version of PHP e.g. PHP7?

Cheers,
Sebastian


ddenev

Hi,

Unfortunately, there is no sign that the PHP bug is going to be fixed anytime soon.

I understand you being cautious about changing the code. You know better what problems you stumbled upon during the years.

Keep in mind though that I have other plugins setup in the same way with symlinks and they do not have this problem they write to wp-content just fine (e.g. Duplicator, WP Rocket, Updraft). These plugins are also heavily used by the community and they do well in this setup 🙂

There are several workaround ideas, please consider them 🙂 :

  • Add a config option to Preferences, e.g. “Plugin is installed in a symlinked location”
  • Add detection for symlinked plugin location, i.e. compare the root path of __FILE__ with ABSPATH and if they differ then use the code I suggested, otherwise use the original code

How does this sound? 🙂

Best regards,
Drago


Sebastian

You have yourself a deal Drago. I’ll do a check for symlinking, and use ABSPATH if it returns true 🙂


ddenev

You are a real gem, Sebastian, you should know this! 🙂

Thanks a bunch!

You must login or register to reply to this topic.