Download & Extend

Gzip outside of root directory?

Project:CSS Gzip
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

When I enable the Gzip functions, I get error messages that the gss.gz file is outside the open base dir. I located the problem at line 61 and 62 of css_gzip.module. The $css_file is something like '/css/827498247923.css.gz'. However, that is outside the server root! I could fix the problem by adding $_SERVER['DOCUMENT_ROOT'] and $path in front of $css_file, like so:

          if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $path . $css_file .'.gz')) {
            file_save_data(gzencode(file_get_contents(file_directory_path() . $css_file), 9), $_SERVER['DOCUMENT_ROOT'] . $path . $css_file .'.gz', FILE_EXISTS_REPLACE);
          }

What could be the real problem? Why does it want to store gzipped css files outside the root dir? The funny thing is, it does actually work with the errors.

Comments

#1

While we are here, I might as well clean this module up. Here's the proposed changes along with the fix.

AttachmentSize
css_gzip-478506.patch 4.39 KB

#2

Status:active» needs review

reminder to self to change readme.txt; remove safari code.

#3

Version:6.x-1.1» 6.x-1.x-dev
AttachmentSize
css_gzip-478506.1.patch 5.07 KB

#4

New iteration of patch. Should be good to go.

AttachmentSize
css_gzip-478506.2.patch 5.13 KB

#5

Status:needs review» fixed

committed

#6

Status:fixed» closed (fixed)

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