s9y / Serendipity

A PHP blog software
https://s9y.org
BSD 3-Clause "New" or "Revised" License
206 stars 86 forks source link

PHP fatal error on "Themes" in administration page #754

Closed justinacolmena closed 3 years ago

justinacolmena commented 3 years ago

Logged in as administrator, clicked on "Themes" -- after a system update to the hosting server.

https://lindberg.farm/serendipity_admin.php?serendipity[adminModule]=templates
[01-Apr-2021 06:38:19 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getStatus() on null in /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php:458
Stack trace:
#0 /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php(641): serendipity_event_spartacus->fetchfile()
#1 /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php(1281): serendipity_event_spartacus->fetchOnline()
#2 /var/www/lindberg.farm/serendipity/include/plugin_api.inc.php(1184): serendipity_event_spartacus->event_hook()
#3 /var/www/lindberg.farm/serendipity/include/admin/templates.inc.php(175): serendipity_plugin_api::hook_event()
#4 /var/www/lindberg.farm/serendipity/serendipity_admin.php(118): include('/var/www/lindbe...')
#5 {main}
  thrown in /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php on line 458
justinacolmena commented 3 years ago
[root@amarillo ~]# yum list installed nginx php74-fpm postgresql13-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.turhost.com
 * epel: mirror.atl.genesisadaptive.com
 * extras: istanbul.centos-mirror.guzel.net.tr
 * updates: mirror.sh.com.tr
Installed Packages
nginx.x86_64                           1:1.16.1-3.el7                @epel  
php74-fpm.x86_64                       7.4.16-1.el7.ius              @ius   
postgresql13-server.x86_64             13.2-1PGDG.rhel7              @pgdg13
[root@amarillo ~]#
onli commented 3 years ago

This looks like something that should be fixed locally in your installation and then maybe be translated to a patch for the project. But first we have to figure out what's going on here.

serendipity_event_spartacus/serendipity_event_spartacus.php:458

Could you have a look which line that is, what exactly fails there? You might also want to debug (I assume you have the developer experience, right?) what is null there. Is spartacus working for the plugins?

justinacolmena commented 3 years ago

I put some debug code at the beginning of the catch block

echo '<pre>'; print_r ($e); echo '</pre>'; die();

This is what I got.

HTTP_Request2_ConnectionException Object
(
    [_nativeCode:HTTP_Request2_Exception:private] => 0
    [cause:protected] => 
    [_trace:PEAR_Exception:private] => 
    [message:protected] => Unable to connect to tls://raw.github.com:443. Error: php_network_getaddresses: getaddrinfo failed: Name or service not known
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /var/www/lindberg.farm/serendipity/bundled-libs/HTTP/Request2/SocketWrapper.php
    [line:protected] => 134
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/bundled-libs/HTTP/Request2/Adapter/Socket.php
                    [line] => 331
                    [function] => __construct
                    [class] => HTTP_Request2_SocketWrapper
                    [type] => ->
                )

            [1] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/bundled-libs/HTTP/Request2/Adapter/Socket.php
                    [line] => 128
                    [function] => connect
                    [class] => HTTP_Request2_Adapter_Socket
                    [type] => ->
                )

            [2] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/bundled-libs/HTTP/Request2.php
                    [line] => 941
                    [function] => sendRequest
                    [class] => HTTP_Request2_Adapter_Socket
                    [type] => ->
                )

            [3] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php
                    [line] => 450
                    [function] => send
                    [class] => HTTP_Request2
                    [type] => ->
                )

            [4] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php
                    [line] => 641
                    [function] => fetchfile
                    [class] => serendipity_event_spartacus
                    [type] => ->
                )

            [5] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/plugins/serendipity_event_spartacus/serendipity_event_spartacus.php
                    [line] => 1281
                    [function] => fetchOnline
                    [class] => serendipity_event_spartacus
                    [type] => ->
                )

            [6] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/include/plugin_api.inc.php
                    [line] => 1184
                    [function] => event_hook
                    [class] => serendipity_event_spartacus
                    [type] => ->
                )

            [7] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/include/admin/templates.inc.php
                    [line] => 175
                    [function] => hook_event
                    [class] => serendipity_plugin_api
                    [type] => ::
                )

            [8] => Array
                (
                    [file] => /var/www/lindberg.farm/serendipity/serendipity_admin.php
                    [line] => 118
                    [args] => Array
                        (
                            [0] => /var/www/lindberg.farm/serendipity/include/admin/templates.inc.php
                        )

                    [function] => include
                )

        )

    [previous:Exception:private] => 
    [xdebug_message] => ( ! ) HTTP_Request2_ConnectionException: Unable to connect to tls://raw.github.com:443. Error: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/lindberg.farm/serendipity/bundled-libs/HTTP/Request2/SocketWrapper.php on line 134
Call Stack
#TimeMemoryFunctionLocation
10.0000372320{main}(  ).../serendipity_admin.php:0
20.0981700200include( '/var/www/lindberg.farm/serendipity/include/admin/templates.inc.php' ).../serendipity_admin.php:118
30.1023759344serendipity_plugin_api::hook_event(  ).../templates.inc.php:175
40.1023759784serendipity_event_spartacus->event_hook(  ).../plugin_api.inc.php:1184
50.1023759784serendipity_event_spartacus->fetchOnline(  ).../serendipity_event_spartacus.php:1281
60.1023760840serendipity_event_spartacus->fetchfile(  ).../serendipity_event_spartacus.php:641
76.1083854816HTTP_Request2->send(  ).../serendipity_event_spartacus.php:450

)
onli commented 3 years ago

Looks to me like the server can not or is not allowed to reach raw.github.com. Do you have ssh access to that server? Then you should connect to it and see whether you can ping that url. Maybe it's an IPv6-only server? github only has IPv4, that would not work. You can try setting spartacus to use the gitlab mirror instead.

justinacolmena commented 3 years ago

Looks to me like the server can not or is not allowed to reach raw.github.com. Do you have ssh access to that server? Then you should connect to it and see whether you can ping that url. Maybe it's an IPv6-only server? github only has IPv4, that would not work. You can try setting spartacus to use the gitlab mirror instead.

My VPS is set up as dual-stack, IPv4 + IPv6, for some strange reason the external firewall for the VPS at the hosting provider needs to be reset from time to time because it stops allowing outbound connections under conditions of heavy attack and aggressive hacking attempts. Unless "raw.github.com" has a AAAA record for an IPv6 address that is non-existent or unreachable, (which it does not,) that should not be a problem at all.

There's no error, and the themes show up no problem at all if the server is actually able to connect to raw.github.com.

So the only "bug" here is the lack of a user-friendly error message in the event that the connection to "raw.github.com" fails.