Piwigo Bugtracker

Piwigo bug tracker has moved to Github

This bugtracker is kept to provide history on old issues.


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003078Piwigopluginspublic2014.05.09 16:402014.10.06 12:58
Reporterkohenkatz 
Assigned Toplg 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.6.2 
Target Version2.7.1Fixed in Version2.7.1 
Summary0003078: ZLib issues on Ubuntu (and other OS's)
DescriptionWhen I installed Piwigo and then tried to install some plugins, I kept getting the message:

    Abort pclzip.lib.php : Missing zlib extensions

Running `php -m` showed that the Zlib extension was, in fact, installed.

This is similar to the problem mentioned in this topic (though the solution proposed in that topic does not work for the reason claimed - it actually works because PHP is compiled against a different version of Zlib.)

The root of the problem lies in the fact that PHP compiled with "large file support" (as PHP on new Ubuntu installs is compiled) names the function `gzopen` as `gzopen64` instead. Piwigo looks for the original function name, and then complains when it cannot be found.

The simplest solution for this problem is to check whether the function exists, and to alias it if it does not. For example, like this:

Code:
    if (!extension_loaded('zlib'))
    {
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }
    if (!function_exists('gzopen') && function_exists('gzopen64'))
    {
      function gzopen(string $filename , string $mode, int $use_include_path = 0) {
        return gzopen64($filename, $mode, $use_include_path)
      }
    }


Another way to do it would be to use a function pointer, like this:

Code:
    if (!extension_loaded('zlib'))
    {
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }
    if (function_exists('gzopen'))
    {
      $this->gzopen_func = 'gzopen';
    }
    elseif (function_exists('gzopen64'))
    {
      $this->gzopen_func = 'gzopen64';
    }
    else
    {
      die('Abort '.basename(__FILE__).' : Could not find gzopen');
    }

Then, instead of saying `gzopen(...)`, you would use this:

Code:
    $gzopen = $this->gzopen_func;
    $gzopen(...)

(Note that this could probably be done in a single line - I just did it in two lines for clarity about what points where.)

Note that I had this issue on Ubuntu, but I found similar reports about gzopen64 on many platforms.
TagsNo tags attached.
browserany
Database engine and version5.5.37-MariaDB-1~trusty-log
PHP version5.5.9-1ubuntu4
Web serverApache 2.4.x
Attached Files

- Relationships

-  Notes
(0007670)
svn (reporter)
2014.10.06 12:45

[Subversion] r29904 by plg on trunk

-----[Subversion commit log]----------------------------------------------------
bug 3078: avoid zlib issue on Ubuntu 14.04 (PHP 5.5) and maybe other systems
(0007671)
svn (reporter)
2014.10.06 12:46

[Subversion] r29905 by plg on branch 2.7

-----[Subversion commit log]----------------------------------------------------
merge r29904 from trunk to branch 2.7

bug 3078: avoid zlib issue on Ubuntu 14.04 (PHP 5.5) and maybe other systems

- Issue History
Date Modified Username Field Change
2014.05.09 16:40 kohenkatz New Issue
2014.05.09 16:40 kohenkatz browser => any
2014.05.09 16:40 kohenkatz Database engine and version => 5.5.37-MariaDB-1~trusty-log
2014.05.09 16:40 kohenkatz PHP version => 5.5.9-1ubuntu4
2014.05.09 16:40 kohenkatz Web server => Apache 2.4.x
2014.05.12 13:43 plg Assigned To => plg
2014.05.12 13:43 plg Status new => assigned
2014.05.12 13:43 plg Target Version => 2.6.3
2014.06.11 09:53 plg Target Version 2.6.3 => 2.6.4
2014.08.10 08:30 plg Target Version 2.6.4 => 2.7.0beta3
2014.08.24 18:55 plg Target Version 2.7.0RC1 => 2.7.0RC2
2014.09.16 12:00 plg Target Version 2.7.0RC2 => 2.7.0
2014.09.24 09:49 plg Target Version 2.7.0 => 2.7.1
2014.10.06 12:45 svn Checkin
2014.10.06 12:45 svn Note Added: 0007670
2014.10.06 12:46 svn Checkin
2014.10.06 12:46 svn Note Added: 0007671
2014.10.06 12:58 plg Status assigned => closed
2014.10.06 12:58 plg Resolution open => fixed
2014.10.06 12:58 plg Fixed in Version => 2.7.1


Copyright © 2000 - 2017 MantisBT Team
Contact
Powered by Mantis Bugtracker