Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible PHP7 issues (php7cc report) #12797

Closed
exside opened this issue Dec 2, 2015 · 11 comments
Closed

Possible PHP7 issues (php7cc report) #12797

exside opened this issue Dec 2, 2015 · 11 comments
Milestone

Comments

@exside
Copy link
Contributor

exside commented Dec 2, 2015

I ran the PHP7 Compatibility Checker https://github.com/sstalle/php7cc against the MODX git repository, the following report was the result. Not sure if all of that is actually a problem or relevant, just thought I'll post it here for reference.

> php7cc /Git/MODX/revolution

File: /Git/MODX/revolution/core/model/aws/lib/yaml/lib/sfYamlParser.php
> Line 96: Possible object property creation during by-reference assignment
    $parser->refs =& $this->refs;
> Line 108: Possible object property creation during by-reference assignment
    $parser->refs =& $this->refs;
> Line 150: Possible object property creation during by-reference assignment
    $parser->refs =& $this->refs;
> Line 202: Possible object property creation during by-reference assignment
    $parser->refs =& $this->refs;


File: /Git/MODX/revolution/core/model/aws/sdk.class.php
> Line 880: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 1227: Possible object property creation during by-reference assignment
    $this->batch_object =& $this->internal_batch_object;
> Line 1232: Possible object property creation during by-reference assignment
    $this->batch_object =& $this->internal_batch_object;


File: /Git/MODX/revolution/core/model/aws/services/cloudfront.class.php
> Line 147: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();


File: /Git/MODX/revolution/core/model/aws/services/s3.class.php
> Line 355: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();


File: /Git/MODX/revolution/core/model/modx/mail/phpmailer/class.phpmailer.php
> Line 2222: Removed function "set_magic_quotes_runtime" called
    set_magic_quotes_runtime(0);
> Line 2231: Removed function "set_magic_quotes_runtime" called
    set_magic_quotes_runtime($magic_quotes);


File: /Git/MODX/revolution/core/model/modx/modcachemanager.class.php
> Line 36: Possible object property creation during by-reference assignment
    $this->modx =& $this->xpdo;


File: /Git/MODX/revolution/core/model/modx/modelement.class.php
> Line 139: Nested by-reference foreach loop, make sure there is no iteration over the same array
    foreach ($property['options'] as &$option) {
    }


File: /Git/MODX/revolution/core/model/modx/modmanagercontroller.class.php
> Line 891: Possible object property creation during by-reference assignment
    $this->workingContext =& $this->modx->context;


File: /Git/MODX/revolution/core/model/modx/modpropertyset.class.php
> Line 67: Nested by-reference foreach loop, make sure there is no iteration over the same array
    foreach ($property['options'] as &$option) {
    }


File: /Git/MODX/revolution/core/model/modx/modtemplatevar.class.php
> Line 1106: Possible object property creation during by-reference assignment
    $this->modx =& $tv->xpdo;
> Line 1223: Possible object property creation during by-reference assignment
    $this->xpdo =& $this->modx;
> Line 1267: Possible object property creation during by-reference assignment
    $this->xpdo =& $this->modx;


File: /Git/MODX/revolution/core/model/modx/modx.class.php
> Line 341: Possible adding to array on the last iteration of a by-reference foreach loop
    $target[$key] = stripslashes($value);
> Line 343: Possible adding to array on the last iteration of a by-reference foreach loop
    $target[$key] = $value;
> Line 1591: Possible object property creation during by-reference assignment
    $this->Event =& $this->event;
> Line 2309: Possible object property creation during by-reference assignment
    $this->aliasMap =& $this->context->aliasMap;
> Line 2310: Possible object property creation during by-reference assignment
    $this->resourceMap =& $this->context->resourceMap;
> Line 2311: Possible object property creation during by-reference assignment
    $this->eventMap =& $this->context->eventMap;
> Line 2312: Possible object property creation during by-reference assignment
    $this->pluginCache =& $this->context->pluginCache;
> Line 2411: Check that callbacks that are passed to "session_set_save_handler" and return false or -1 (if any) operate correctly
    session_set_save_handler(array(&$sh, 'open'), array(&$sh, 'close'), array(&$sh, 'read'), array(&$sh, 'write'), array(&$sh, 'destroy'), array(&$sh, 'gc'));


File: /Git/MODX/revolution/core/model/modx/processors/security/user/_validation.php
> Line 19: Possible object property creation during by-reference assignment
    $this->modx =& $processor->modx;


File: /Git/MODX/revolution/core/model/modx/sources/modfilemediasource.class.php
> Line 26: Possible object property creation during by-reference assignment
    $this->ctx =& $this->xpdo->context;


File: /Git/MODX/revolution/core/model/modx/sources/modmediasource.class.php
> Line 477: Nested by-reference foreach loop, make sure there is no iteration over the same array
    foreach ($property['options'] as &$option) {
    }


File: /Git/MODX/revolution/core/model/phpthumb/modphpthumb.class.php
> Line 160: Removed function "ereg" called
    ereg('^' . preg_quote($nice_docroot) . '(.*)$', $nice_cachefile, $matches);
> Line 183: Removed function "eregi" called
    eregi('\\.ico$', $this->cache_filename);
> Line 186: Removed function "ereg" called
    ereg('^' . preg_quote($nice_docroot) . '(.*)$', $nice_cachefile, $matches);


File: /Git/MODX/revolution/core/model/phpthumb/phpthumb.bmp.php
> Line 23: PHP 4 constructors are now deprecated
    function phpthumb_bmp()
    {
    }


File: /Git/MODX/revolution/core/model/phpthumb/phpthumb.filters.php
> Line 16: PHP 4 constructors are now deprecated
    function phpthumb_filters()
    {
    }


File: /Git/MODX/revolution/core/model/phpthumb/phpthumb.gif.php
> Line 173: PHP 4 constructors are now deprecated
    function CGIFLZW()
    {
    }
> Line 387: PHP 4 constructors are now deprecated
    function CGIFCOLORTABLE()
    {
    }
> Line 490: PHP 4 constructors are now deprecated
    function CGIFFILEHEADER()
    {
    }
> Line 566: PHP 4 constructors are now deprecated
    function CGIFIMAGEHEADER()
    {
    }
> Line 636: PHP 4 constructors are now deprecated
    function CGIFIMAGE()
    {
    }
> Line 804: PHP 4 constructors are now deprecated
    function CGIF()
    {
    }


File: /Git/MODX/revolution/core/model/phpthumb/phpthumb.ico.php
> Line 15: PHP 4 constructors are now deprecated
    function phpthumb_ico()
    {
    }


File: /Git/MODX/revolution/core/model/smarty/Config_File.class.php
> Line 72: PHP 4 constructors are now deprecated
    function Config_File($config_path = NULL)
    {
    }


File: /Git/MODX/revolution/core/model/smarty/plugins/modifier.capitalize.php
> Line 26: Removed regular expression modifier "e" used
    preg_replace('!(^|[^\\p{L}\'])([\\p{Ll}])!ue', '\'\\1\'.ucfirst(\'\\2\')', $upper_string);


File: /Git/MODX/revolution/core/model/smarty/Smarty_Compiler.class.php
> Line 81: PHP 4 constructors are now deprecated
    function Smarty_Compiler()
    {
    }


File: /Git/MODX/revolution/core/model/smarty/sysplugins/smarty_internal_data.php
> Line 158: Possible array element creation during by-reference assignment
    $this->tpl_vars[$tpl_var]->value[$_key] =& $value[$_key];


File: /Git/MODX/revolution/core/model/smarty/sysplugins/smarty_internal_templatecompilerbase.php
> Line 183: Indirect variable, property or method access
    $this->smarty->registered_plugins[$type][$tag][0][0]->{$function[1]}($new_args, $this);


File: /Git/MODX/revolution/core/xpdo/cache/xpdocachemanager.class.php
> Line 359: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(3);
> Line 407: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(3);
> Line 482: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(2);
> Line 483: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(3);


File: /Git/MODX/revolution/core/xpdo/compression/pclzip.lib.php
> Line 215: PHP 4 constructors are now deprecated
    function PclZip($p_zipname)
    {
    }
> Line 288: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 471: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 728: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 885: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 1027: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();
> Line 5347: Removed function "set_magic_quotes_runtime" called
    set_magic_quotes_runtime(0);
> Line 5378: Removed function "set_magic_quotes_runtime" called
    set_magic_quotes_runtime($this->magic_quotes_status);


File: /Git/MODX/revolution/core/xpdo/json/JSON.php
> Line 135: PHP 4 constructors are now deprecated
    function Services_JSON($use = 0)
    {
    }
> Line 785: PHP 4 constructors are now deprecated
    function Services_JSON_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null)
    {
    }
> Line 800: PHP 4 constructors are now deprecated
    function Services_JSON_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null)
    {
    }


File: /Git/MODX/revolution/core/xpdo/om/xpdoobject.class.php
> Line 674: Possible array element creation during by-reference assignment
    $this->_fields[$alias] =& $this->_fields[$field];


File: /Git/MODX/revolution/core/xpdo/xpdo.class.php
> Line 455: Possible object property creation during by-reference assignment
    $this->pdo =& $this->connection->pdo;


File: /Git/MODX/revolution/manager/controllers/default/header.php
> Line 53: Possible object property creation during by-reference assignment
    $this->modx =& $controller->modx;


File: /Git/MODX/revolution/manager/min/lib/FirePHP.php
> Line 505: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(1);
> Line 516: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(1);
> Line 519: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(1);
> Line 524: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(2);
> Line 525: Function argument(s) returned by "func_get_arg" might have been modified
    func_get_arg(1);


File: /Git/MODX/revolution/manager/min/lib/JSMinPlus.php
> Line 1674: Function argument(s) returned by "func_get_args" might have been modified
    func_get_args();


File: /Git/MODX/revolution/setup/includes/config/modconfigreader.class.php
> Line 36: Possible object property creation during by-reference assignment
    $this->xpdo =& $install->xpdo;


File: /Git/MODX/revolution/setup/includes/drivers/modinstalldriver.class.php
> Line 42: Possible object property creation during by-reference assignment
    $this->xpdo =& $install->xpdo;


File: /Git/MODX/revolution/setup/includes/modinstallversion.class.php
> Line 37: Possible object property creation during by-reference assignment
    $this->install =& $runner->install;


File: /Git/MODX/revolution/setup/includes/request/modinstallclirequest.class.php
> Line 50: Possible object property creation during by-reference assignment
    $this->settings =& $this->install->settings;


File: /Git/MODX/revolution/setup/includes/runner/modinstallrunner.class.php
> Line 28: Possible object property creation during by-reference assignment
    $this->xpdo =& $install->xpdo;

Checked 3014 files in 278.784 seconds
@exside
Copy link
Contributor Author

exside commented Dec 5, 2015

I think the main ones to have an eye on are:

File: /Git/MODX/revolution/core/model/modx/mail/phpmailer/class.phpmailer.php because removed function set_magic_quotes_runtime() is used.
File: /Git/MODX/revolution/core/model/phpthumb/modphpthumb.class.php because removed function ereg() is used.
File: /Git/MODX/revolution/core/model/smarty/plugins/modifier.capitalize.php because removed regular expression modifier "e" is used.
File: /Git/MODX/revolution/core/model/smarty/sysplugins/smarty_internal_templatecompilerbase.php because of indirect variable, property or method access (on line 183)
File: /Git/MODX/revolution/core/xpdo/compression/pclzip.lib.php because removed function set_magic_quotes_runtime() is used.

@exside
Copy link
Contributor Author

exside commented Dec 6, 2015

I think especially the pclzip and phpmailer warnings should be closely checked, just because the manager works in PHP 7 doesn't mean that a) packages can be installed (if PclZip doesn't work, transport packages could may not be unzipped) and b) no emails can be sent...and also c) phpthumb could make the media manager (and anything that depends on it to make thumbnails) fail, but only in debug mode I think....

Any thoughs?

@exside
Copy link
Contributor Author

exside commented Dec 6, 2015

Update on pclzip: Doesn't seem to be an issue, running latest git 2.x branch without any issues when using package management.

@exside
Copy link
Contributor Author

exside commented Dec 6, 2015

Update on phpthumb: seriously broken

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; phpthumb has a deprecated constructor in /path/to/core/model/phpthumb/phpthumb.class.php on line 19

and no thumbs in media browser

problem seems not (yet) to lie in modphpthumb.class.php but in the main phpthumb.class.php...

created issue JamesHeinrich/phpThumb#45

update to most recent version 1.7.14-201512030243 didn't help =/

update2: adding a simple contructor fixes the issue...PR in original repo suggested, update with current version + that fix in a PR to modx coming in a sec

@olegpro
Copy link

olegpro commented Jan 6, 2016

More (/manager/ page):

PHP Fatal error:  Uncaught Error: Call to a member function setProperties() on null in /core/model/modx/modmanagerresponse.class.php:191
Stack trace:
#0 /core/model/modx/modmanagerresponse.class.php(73): modManagerResponse->instantiateController('SecurityLoginMa...', 'getInstance')
#1 /core/model/modx/modmanagerrequest.class.php(180): modManagerResponse->outputContent(Array)
#2 /core/model/modx/modmanagerrequest.class.php(128): modManagerRequest->prepareResponse()
#3 /manager/index.php(75): modManagerRequest->handleRequest()
#4 {main}\n  thrown in /core/model/modx/modmanagerresponse.class.php on line 191

@exside
Copy link
Contributor Author

exside commented Jan 6, 2016

@olegpro do you think that's related to PHP7?

@olegpro
Copy link

olegpro commented Jan 6, 2016

@exside yes, there was a bug after upgrading to php 7

@Mark-H
Copy link
Collaborator

Mark-H commented Jan 13, 2016

@olegpro Did you build from git or used the last available download? That was supposed to be fixed with #12741

@olegpro
Copy link

olegpro commented Jan 13, 2016

@Mark-H I used the last download on modx.com

@Jako
Copy link
Collaborator

Jako commented Sep 13, 2016

The phpThumb constructor issues should at least be fixed with #13125

@Mark-H Mark-H modified the milestones: v2.5.2, v2.5.3 Nov 14, 2016
@Mark-H Mark-H modified the milestones: v2.5.3, v2.5.2 Nov 14, 2016
@Jako Jako modified the milestones: v2.5.3, v2.5.5 Jan 5, 2017
@opengeek
Copy link
Member

I'm closing this. Any specific PHP 7-related issues that are outstanding should be opened as individual issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants