Ticket #305 (closed defect: fixed)

Opened 13 months ago

Last modified 10 months ago

Problems using Plug-in Installer on Servers with PHP Safe Mode

Reported by: enzo Owned by: alex94040
Priority: must Milestone: 1.1
Component: Plugin Manager Version:
Keywords: Plugin Installer Cc:

Description

Hello folks

I had some troubles trying install some plug-ins in a server with PHP Safe Mode enabled, because the installer check some paths outside the document root.

So, I created a new patch in order to start checking of files at document root.

After this patch now my server is working well with plug-in installer.

Enjoy IT.

enzo

Attachments

QPluginIntallerBase-EnableToUseWithModePHPSafe.patch (1.5 kB) - added by enzo 13 months ago.
ticket305.patch (0.9 kB) - added by VexedPanda 11 months ago.
mkdir has a recursive flag in PHP 5.0.0 and above. Hopefully this removes the need for the out-of-webroot checks entirely.

Change History

Changed 13 months ago by VexedPanda

Hmm, I dunno. If someone moves something like their includes directory out of webroot (which we want to support), it should still try and write there. If their server doesn't allow it, I vote we just spit out a notice saying something like:
"In order to finish the install, the following steps must be performed manually:
Copy {original file} to {destination}"

Changed 12 months ago by alex94040

Can we somehow reconcile two desires here? Can we have a fork in the code that says

- if not in safe mode, do X
- if in safe mode, do Y;
- if in safe mode and the includes are outside of the docroot, give up and give an error message?

Changed 12 months ago by VexedPanda

I don't think it needs to be that complex.
Simply doing error handling and displaying an error in case of failure should be enough.

Changed 12 months ago by alex94040

Vexed - but see, this essentially would mean that the developer can't automatically install plugins on a PHP Safe Mode box... That'd be kind of bad, no? The whole point of the plugins framework is to allow for nice and easy install/uninstall..

Changed 12 months ago by VexedPanda

I guess I don't understand quite what's going on here. By default, shouldn't all plugins stay within docroot anyhow? So shouldn't this only come up when they've moved includes (or another directory) out of docroot anyhow?

Changed 12 months ago by alex94040

  • status changed from new to infoneeded_new

Plugins go into the /includes and /assets folders. By default - if you don't move the /includes outside of the docroot - plugins should go right inside the docroot. Enzo, however, is suggesting that this somehow still didn't work out of the box - I'm not sure why, I don't have a PHP Safe Mode install handy. Enzo, can you comment?

Changed 12 months ago by alex94040

We should close this ticket as "works for me" if we don't hear back in the next week.

Changed 11 months ago by VexedPanda

  • status changed from infoneeded_new to new

So the issue seems to be that in safe mode (or any strict environment), php doesn't have access to do a is_dir check of the directory structure outside of webroot.

My suggestion is we simply reverse this process. Check the deepest first, and only go as far up as needed to create the missing directory.

This way, it will only throw an error when it actually needs to create or read a specific directory it doesn't have access to.

The second step would be to catch this error, and present it nicely to the user.

Changed 11 months ago by VexedPanda

mkdir has a recursive flag in PHP 5.0.0 and above. Hopefully this removes the need for the out-of-webroot checks entirely.

Changed 11 months ago by VexedPanda

  • status changed from new to in_QA

Still need friendly errors, but that's perhaps a seperate issue.

Changed 10 months ago by enzo

  • status changed from in_QA to closed
  • resolution set to fixed

(In [539]) Fixes #305 Validate if php_safe is on and generate a warning in installation

Changed 10 months ago by alex94040

  • status changed from closed to new
  • resolution fixed deleted

What enzo checked in is not the same as the patch that is attached to this bug. Enzo checked in a friendly warning in the config checker; the other patch still needs to be applied.

Changed 10 months ago by alex94040

  • status changed from new to in_QA

Changed 10 months ago by alex94040

  • status changed from in_QA to closed
  • resolution set to fixed

(In [540]) Fixes #305 (Problems using Plug-in Installer on Servers with PHP Safe Mode).

Also fixes PHP 5.3 compatibility in 1.1 plugin installer around ereg_replace being deprecated.

Changed 10 months ago by alex94040

On a second thought, an install-time warning should probably be enough. My last patch fixes formatting / other stuff in the earlier checkin, we can consider this closed.

Note: See TracTickets for help on using tickets.