PHP 5.5.11 issue

Piwik 2.1.0 (and 2.2.0) is not fully compatible with php 5.5.11 due to the following PHP issue [PHP-BUG] Bug #67043 [NEW]: substr_compare falsely reports equality on negative offset - Grokbase.

The following files are impacted: ProxyHttp.php, StylesheetUIAssetMerger.php, ZipArchive.php and EndsWith.php

There is a workaround that consists of adding the length parameter to the substr_compare function. Can you confirm its implementation in the sub-mentioned files ?

ProxyHttp


if (substr_compare(PHP_SAPI, '-fcgi', -5, 5)) {

StylesheetUIAssetMerger


if ($rootDirectory != '/' && substr_compare($rootDirectory, '/', -1, 1)) {

ZipArchive


if (substr_compare($pathExtracted, '/', -1, 1))

EndsWith


$compiler
            ->raw('(0 === substr_compare(')
            ->subcompile($this->getNode('left'))
            ->raw(', ')
            ->subcompile($this->getNode('right'))
            ->raw(', -strlen(')
            ->subcompile($this->getNode('right'))
            ->raw('), strlen(')
            ->subcompile($this->getNode('right'))
            ->raw(')))')
;

Thanks for the report, I created a ticket: Incompatibility with PHP 5.5.11 due to bug in this php version · Issue #5060 · matomo-org/matomo · GitHub
please CC yourself there for updates!

Could you please try this patch and confirm it works for you? Refs #5060 Remove use of substr_compare as it's buggy in 5.5.11 with … · matomo-org/matomo@f7f5296 · GitHub

thanks

I will test this patch after updating to 2.2.0 but I don’t know when.

Also there is no patch for Endwith.php ? May be it is not required but I’m just asking cause I don’t know what this part of the code is usefull for yet.

the bug was fixed by PHP team in 5.5.12