View Issue Details

IDProjectCategoryView StatusLast Update
0019233phpList 3 pluginsGeneralpublic11-06-18 21:29
Reporterfedebros Assigned To 
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSCentOSOS Version7
Summary0019233: Syntax error using bitwise operator in class var definition with php 5.4.16
DescriptionWith php 5.4.16, that is the last available for the CentOS 7 distribution, the file public_html/admin/plugins/SegmentPlugin.php runs into error 500.

PHP Parse error: syntax error, unexpected '^', expecting ',' or ';' in public_html/admin/plugins/SegmentPlugin.php on line 36

The variable $error_level of the class SegmentPlugin is defined as follow:
private $error_level = E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT;
and php5.4.16 misery crashes…

defining it in this way:
private $error_level = 22519;
it works.

Testing the same construct with bitwise operators on php 7.1.16, for example, it works good.

Is it possible to move the assignment in the constructor, to preserve compatibility with the old (but still maintained by CentOS) versions of php, like this?

private $error_level;
public function __construct()
    {
        $this->error_level = E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT;
Steps To Reproducetest the following script on a CentOS7 with php 5.4.16-36 or 5.4.16-45 installed:

<?php
class o {
private $error_level = E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT;
function __construct() {
var_export($this->error_level);
}
}
new o;

TagsNo tags attached.

Relationships

has duplicate 0019235 resolved phpList 3 application 'Phplist version 3.3.2 and 3.3.3 throw syntax error unexpected '^' while installation on PHP 5.4 as well as 5.5' 

Activities

duncanc

17-05-18 08:21

developer   ~0060597

@fedebros Can you confirm that the plugin works properly, i.e. sends to the correct subset of subscribers with your change? I had not noticed that php 5.6 introduced constant scalar expressions syntax.

The plugin uses the BitArray package which now has a dependency on php 5.5, but the plugin currently includes an older release of BitArray which depends only on php 5.4.

If I ever upgraded that package, which I do now and again, then the plugin would probably stop working for you. It might be better if you use your own copy, to guard against any future changes.

duncanc

17-05-18 17:10

developer   ~0060599

Last edited: 17-05-18 17:10

View 2 revisions

I have changed the plugin to initialise $error_level in the constructor as suggested, to avoid a dependency on php 5.6.

@samtuke, @michiel As this problem is going to affect anyone installing phplist on php < 5.6 , are you able to rebuild 3.3.3 but including the latest Segment plugin?

michiel

17-05-18 21:17

administrator   ~0060600

I can't really rebuild 3.3.3 any more, now that it has been published, but I will roll out a new 3.3.4 soon with a fix. I'll wait until Monday or so, just to see if other things come in.

fedebros

17-05-18 23:37

reporter   ~0060602

@duncanc I've tested my suggestion it and it seems to had worked fine, thank you.

duncanc

18-05-18 08:34

developer   ~0060603

@fedebros Thanks. I just wanted to have confirmation that there are not any other code issues due to php < 5.6. It looks like there are not any.

michiel

11-06-18 21:29

administrator   ~0060714


resolved in next release. Not sure if we need to roll out 3.3.3.1 or something for this? Or are all PHP5.4 users able to patch themselves.

Issue History

Date Modified Username Field Change
15-05-18 18:05 fedebros New Issue
17-05-18 08:21 duncanc Note Added: 0060597
17-05-18 16:18 duncanc Relationship added has duplicate 0019235
17-05-18 17:10 duncanc Note Added: 0060599
17-05-18 17:10 duncanc Note Edited: 0060599 View Revisions
17-05-18 21:17 michiel Note Added: 0060600
17-05-18 23:37 fedebros Note Added: 0060602
18-05-18 08:34 duncanc Note Added: 0060603
11-06-18 21:29 michiel Status new => resolved
11-06-18 21:29 michiel Resolution open => fixed
11-06-18 21:29 michiel Note Added: 0060714