aramk / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/crayon-syntax-highlighter/
GNU General Public License v3.0
1.1k stars 247 forks source link

PHP 7 Compatibility based on PHP Compatibility Checker #378

Open phauer opened 8 years ago

phauer commented 8 years ago

Hi everyone,

I investigated whether my wordpress installation is ready for PHP7. That's why I used the Plugin PHP Compatibility Checker which checks my plugins for PHP7-compatibility.

It says that Crayon Syntax Highlighter is not compatible due to the following error:

FILE: <path>/wp-content/plugins/crayon-syntax-highlighter/crayon_settings.class.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
 87 | ERROR | Function name, class name, namespace name or constant name can not be reserved keyword 'MIXED' (since version 7.0)
---------------------------------------------------------------------------------------------------------------------------------

However, in my local php 7 test setup, the crayon-syntax-highlighter works just fine. It seems that this is not a critical problem.

I'm not a PHP expert, about it just seems to be a naming issue. Will this be fixed? Is this a blocker for my php7 migration? I suppose it's not.

I'm using crayon-syntax-highlighter Version 2.8.4.

majorsl commented 8 years ago

I'm seeing this as well.

aramk commented 8 years ago

There was a fix in the PR #381. Thanks for posting the error message. I'll merge it now and release shortly.

aramk commented 8 years ago

Please test 6443abecd845db75cb0cb8e7df5d590a55babba0

dschense commented 8 years ago

after patching the files i get:

[error] 15195#15195: *4 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Undefined class constant 'ALTERNATE' in /crayon-syntax-highlighter/crayon_highlighter.class.php:161

EDIT:

Its just the index.php which is not loading. with direct links to posts or sites everything is working. But the wordpress startpage - index.php - is just a blank site. changed the theme already, but this did not help.

ghost commented 8 years ago

At my website do i Have no problems. It Sounds like a problem with your FastCGI engine. I do no Have Anny clue.

Maybe Will it helps when you showing your error-logs.

dschense commented 8 years ago

php give this error: [pool mypool] child 21892 exited on signal 6 (SIGABRT) after 33.059909 seconds from start

and nginx: failed (104: Connection reset by peer) while reading upstream, for client ...

its the Plugin that crashes the site. after disabling the plugin everything is running. And its just the first site of the wordpress setup.

ghost commented 8 years ago

You should download the latest master copy from this github website. Than are there no problems anymore. Because you are using a Version before 2.8.5.

dschense commented 8 years ago

its still not working.

this is my php 7 pool.d config maybe this is the problem:

[wordpress]
user = www-data
group = www-data
listen = /var/run/php/php7.0-fpm-wordpress.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

and this the php-part in my nginx config:

location ~ \.php$ {
                        try_files $uri =404;
                        fastcgi_split_path_info ^(.+\.php)(/.+)$;
                        fastcgi_pass unix:/var/run/php/php7.0-fpm-wordpress.sock;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }
ghost commented 8 years ago

I see that you running with Fast CGI. Could you also try it without Fast CGI. I hope that you'll see no errors.

aramk commented 8 years ago

Yeah, please try the latest on the master branch and let me know if it resolved your issues. There shouldn't be an undefined constant ALTERNATE if it's set in crayon_settings.class.php.

dschense commented 8 years ago

@aramk

still getting these errors after aktivating the Plugin.

php7.0-fpm

[17-Oct-2016 11:38:00] WARNING: [pool www] child 3466 exited on signal 6 (SIGABRT) after 4.567786 seconds from start
[17-Oct-2016 11:38:00] NOTICE: [pool www] child 3488 started

nginx

2016/10/17 11:38:00 [error] 3486#3486: *1 readv() failed (104: Connection reset by peer) while reading upstream, client: 84.171.208.55, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "example.com"

its the latest master.zip

aramk commented 8 years ago

Are you able to find a backtrace of the issue within the PHP logs?