modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

MODX 3: error log filled with - PHP notice: Only variables should be passed by reference #13943

Closed gadgetto closed 3 years ago

gadgetto commented 6 years ago

Summary

The MODX error log is filled with these warnings:

[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2104) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2271) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 362) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 392) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 1751) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2104) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2271) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 362) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 392) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 1751) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2104) PHP notice: Only variables should be passed by reference
[2018-07-02 16:16:02] (WARN @ /Users/mgartner/ProjekteWEB/modx3/core/model/modx/sources/modmediasource.class.php : 2271) PHP notice: Only variables should be passed by reference

Step to reproduce

Set log-level to 3 and open MODX error log.

Environment

MAMP Pro local site with HTTPS enabled MODX version: MODX 3 alpha PHP Version: 7.1.12

Mark-H commented 6 years ago

What's your php version? Could be relevant to an issue like this.

gadgetto commented 6 years ago

That's true Mark! Updated my issue.

Mark-H commented 6 years ago

Thanks!

sergant210 commented 5 years ago

A link must be passed to the function (it's true for all version of PHP)

array_pop ( array &$array ) : mixed

This code is weird

// modmediasource.class.php

$ext = strtolower(array_pop(explode(DIRECTORY_SEPARATOR, trim($file, DIRECTORY_SEPARATOR))));

It can be replaced by pathinfo().

JoshuaLuckers commented 5 years ago

A link must be passed to the function (it's true for all version of PHP)

array_pop ( array &$array ) : mixed

This code is weird

// modmediasource.class.php

$ext = strtolower(array_pop(explode(DIRECTORY_SEPARATOR, trim($file, DIRECTORY_SEPARATOR))));

It can be replaced by pathinfo().

Feel free to submit a PR 😄

sergant210 commented 5 years ago

Would do if I got enough time