Page 1 of 1

some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Sat Feb 20, 2021 12:26 am
by stm999999999
Hello all! I'm back! :D

After years, when I let my s9y installations on 1.5.5 (blame me, whip me :mrgreen: ), I upgraded them minutes ago ... they are a shared installation (with linked not copied deployment folders), but this should not be the issue, because the problem is at the "main" installation as well.

some infos about the config:

while on 1.5.5 I used php 5.6.40, now 7.3.19 or 7.4.15
installed on webhosting space
very important: My real blogs are only on the user's places, on the core installation I started with a whole new empty database. So at least in these blog there should not be any "old data" which can make a problem.

1) PEAR

when trying to install or update plugins:

Fatal error: require_once(): Failed opening required 'PEAR/Exception.php' (include_path='.:/opt/php-7.4/lib/php:/var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/:/var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/:/var/www/myplace/htdocs/cms-s9y/s9y/:') in /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/HTTP/Request2/Exception.php on line 24

with
$serendipity['use_PEAR'] = false;
in
serendipity_config_local.inc.php

there is no change at all. Not even in the order if the pathes.

on some pages I get this in the source code:

var fragment = window.top.errorHandlerCreateDOM("Error redirect: == SERENDIPITY ERROR == <p><b>Warning:</b> require_once(): open_basedir restriction in effect. File(/opt/php-7.4/lib/php/PEAR/Exception.php) is not within the allowed path(s): (/var/www/myplace/htdocs/:/var/www/myplace/apps/:/var/www/myplace/priv/:/var/www/myplace/tmp/:/usr/share/pear/:/usr/share/php/:/dev/urandom:/tmp/) in /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/HTTP/Request2/Exception.php on line 24

2) when I had changed

require_once 'PEAR/Exception.php';
to
require_once '/var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/PEAR/Exception.php';

in /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/HTTP/Request2/Exception.php

the next problems occur (even if there must be a better solution than editing this core file) when hitting install new plugins:

Parse error: syntax error, unexpected 'new' (T_NEW) in /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_plugin_pagerank/serendipity_plugin_pagerank.php on line 218
or
Parse error: syntax error, unexpected 'new' (T_NEW) in /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_aggregator/serendipity_event_aggregator.php on line 739

3) and there is an independant problem on the dashboard:

The Serendipity JavaScript-library could not be loaded. This can happen due to PHP or Plugin errors, or even a malformed browser cache. To check the exact error please open xxx/index.php?/plugin/admin/serendipity_editor.js manually in your browser and check for error messages.

the js-file has several warnings at the beginning:

include(/var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/lang_en.inc.php): failed to open stream: No such file or directory in /var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php on line 8.<br />For more details set $serendipity['production'] = 'debug' in serendipity_config_local.inc.php to receive a stack-trace.

the named config file starts with:

<?php # $Id: config.inc.php,v 1.1 2006/06/30 07:17:29 garvinhicking Exp $


$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . '/lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
} else {
include dirname(__FILE__) . '/lang_en.inc.php';
}

with debug:

#0 errorToExceptionHandler(2, include(/var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/lang_en.inc.php): failed to open stream: No such file or directory, /var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php, 8, Array ([vars] => Array (),[serendipity] => Array ([GET]
...
[config] => /var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php,[probelang] => /var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/UTF-8//lang_en.inc.php)) called at [/var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php:8]
#1 include() called at [/var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php:8]
#2 include_once(/var/www/myplace/htdocs/cms-s9y/s9y/templates/portal-pfarrei/config.inc.php) called at [/var/www/myplace/htdocs/cms-s9y/s9y/include/functions_smarty.inc.php:1135]
#3 serendipity_smarty_init() called at [/var/www/myplace/htdocs/cms-s9y/s9y/include/genpage.inc.php:27]
#4 include(/var/www/myplace/htdocs/cms-s9y/s9y/include/genpage.inc.php) called at [/var/www/myplace/htdocs/cms-s9y/s9y/include/functions_routing.inc.php:294]
#5 servePlugin(Array ([0] => /plugin/admin/serendipity_editor.js,[1] => plugin,[2] => admin/serendipity_editor.js)) called at [/var/www/myplace/htdocs/cms-s9y/s9y/index.php:80]


4) and one of my user's site gives me an error page by my browser:

error code 330 (net::ERR_CONTENT_DECODING_FAILED)

when I use the (self generated) template, which is used here, for the core installation, I get a similar error like 3) directly on the template backend screen.

Error redirect: == SERENDIPITY ERROR ==
Warning: include(): Failed opening '/var/www/myplace/htdocs/cms-s9y/s9y/templates/mrm1/lang_en.inc.php' for inclusion (include_path='.:/usr/share/php:/var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/:/var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/:/var/www/myplace/htdocs/cms-s9y/s9y/:') in /var/www/myplace/htdocs/cms-s9y/s9y/templates/mrm1/config.inc.php on line 13.
For more details set $serendipity['production'] = 'debug' in serendipity_config_local.inc.php to receive a stack-trace.

Error redirect: == SERENDIPITY ERROR ==
Warning: include(/var/www/myplace/htdocs/cms-s9y/s9y/templates/mrm1/lang_en.inc.php): failed to open stream: No such file or directory in /var/www/myplace/htdocs/cms-s9y/s9y/templates/mrm1/config.inc.php on line 13.
For more details set $serendipity['production'] = 'debug' in serendipity_config_local.inc.php to receive a stack-trace.

5) and a problem on the frontpage of the user's sites:

Fatal error: Uncaught --> Smarty: Unable to load template 'file:-3' in 'file:/var/www/myplace/htdocs/cms-s9y/s9y/templates/mrm1/entries.tpl' <-- thrown in /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_internal_template.php on line 195

I already put this into the entries.tpl

{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope="parent"}



So, I know this is MUCH, VERY MUCH. But it would be wounderfull if anybody would help an old s9y-veteran :lol:

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Sat Feb 20, 2021 8:05 pm
by onli
Hey, that installation jumped a decade ;)

PEAR/Exception.php -> That's a problem we run into regularly. It has something to do with how hoster configure the library resolution while simultaneously blocking access. As far as we know the only solution here is for your hoster to change its server configurations, please contact their support for that. If they have a solution we can adopt in our code we'd be welcome to that change!

The other errors might be related, but I'm not sure, the requested files might also be simply missing. Let's tackle them after fixing the first one.

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Sat Feb 20, 2021 9:39 pm
by stm999999999
OK, I will contact my hoster at first. But any idea why this does not work, so the PEAR in the bundled -libs would be used?

$serendipity['use_PEAR'] = false;

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Sat Feb 20, 2021 10:05 pm
by onli
Not sure. The relevant code is hard to understand:

Code: Select all

// Do the PEAR dance. If $serendipity['use_PEAR'] is set to FALSE, Serendipity will first put its own PEAR include path.
// By default, a local PEAR will be used.
if (function_exists('get_include_path')) {
    $old_include = @get_include_path();
} else {
    $old_include = @ini_get('include_path');
}


require_once("bundled-libs/autoload.php");

$new_include = ($serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : '')
             . S9Y_INCLUDE_PATH . 'bundled-libs/' . PATH_SEPARATOR
             . S9Y_INCLUDE_PATH . 'bundled-libs/Smarty/libs/' . PATH_SEPARATOR
             . $serendipity['serendipityPath'] . PATH_SEPARATOR
             . (!$serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : '');

if (function_exists('set_include_path')) {
    $use_include = @set_include_path($new_include);
} else {
    $use_include = @ini_set('include_path', $new_include);
}

if ($use_include !== false && $use_include == $new_include) {
    @define('S9Y_PEAR', true);
    @define('S9Y_PEAR_PATH', '');
} else {
    @define('S9Y_PEAR', false);
    @define('S9Y_PEAR_PATH', S9Y_INCLUDE_PATH . 'bundled-libs/');
}
// PEAR path setup inclusion finished
That constant S9Y_PEAR_PATH is also not used when the Exception.php is required, as that happens in bundled-libs/HTTP/Request2/Exception.php, which might be the root cause of that problem.

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Wed Feb 24, 2021 10:35 pm
by stm999999999
Hi!

So, my hoster changed open_basedir for my account. Now the simple websites are working fine. like https://pfarrei.sankt-joseph-siemensstadt.de/

But the "big" ones have still trouble, hope you can help me.

(login to see the site is s9y/test123)

https://www.sankt-stephanus-haselhorst.de/archiv/ "works" but looks awfull.
https://www.sankt-stephanus-haselhorst.de/ itself (a static front page) is empty
https://www.sankt-stephanus-haselhorst. ... -im-Advent is empty on some browsers, gives me an HTTP ERROR 500 on others.

on the backend I get:
The Serendipity JavaScript-library could not be loaded. This can happen due to PHP or Plugin errors, or even a malformed browser cache. To check the exact error please open https://www.sankt-stephanus-haselhorst. ... _editor.js manually in your browser and check for error messages.
and .../index.php?/plugin/admin/serendipity_editor.js is empty


when I activate this: $serendipity['production'] = 'debug'

I get:

Code: Select all

== ERROR-REPORT (DEBUGGING ENABLED) == 
== (When you copy this debug output to a forum or other places, make sure to remove your username/passwords, as they may be contained within function calls) ==
#0  errorToExceptionHandler(1, Uncaught ErrorException: Notice: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /var/www/myplace/htdocs/cms-s9y/stephanus/templates_c/stephanus02/74/0f/b8/740fb8d41a093eb7b79837c371fda468da66fb68_0.file.entries.tpl.php:481
Stack trace:
#0 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(254): errorToExceptionHandler(8192, 'The behavior of...', '/var/www/myplace...', 481, Array)
#1 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(254): include()
#2 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(144): Smarty_Template_Compiled->loadCompiledTemplate(Object(Smarty_Internal_Template))
#3 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(105): Smarty_Template_Compiled->process(Object(Smarty_Internal_Template))
#4 /var/www/mweb, /var/www/myplace/htdocs/cms-s9y/stephanus/templates_c/stephanus02/74/0f/b8/740fb8d41a093eb7b79837c371fda468da66fb68_0.file.entries.tpl.php, 481) called at [/var/www/myplace/htdocs/cms-s9y/s9y/include/compat.inc.php:254]
#1  fatalErrorShutdownHandler()
Fatal Error: Uncaught ErrorException: Notice: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /var/www/myplace/htdocs/cms-s9y/stephanus/templates_c/stephanus02/74/0f/b8/740fb8d41a093eb7b79837c371fda468da66fb68_0.file.entries.tpl.php:481 Stack trace: #0 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(254): errorToExceptionHandler(8192, 'The behavior of...', '/var/www/myplace...', 481, Array) #1 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(254): include() #2 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(144): Smarty_Template_Compiled->loadCompiledTemplate(Object(Smarty_Internal_Template)) #3 /var/www/myplace/htdocs/cms-s9y/s9y/bundled-libs/Smarty/libs/sysplugins/smarty_template_compiled.php(105): Smarty_Template_Compiled->process(Object(Smarty_Internal_Template)) #4 /var/www/mweb in /var/www/myplace/htdocs/cms-s9y/stephanus/templates_c/stephanus02/74/0f/b8/740fb8d41a093eb7b79837c371fda468da66fb68_0.file.entries.tpl.php on line 481.

line 481 looks like:

Code: Select all

   <?php $_template = new Smarty_Internal_Template('eval:'.$_smarty_tpl->tpl_vars['footer_currentPage']->value-3, $_smarty_tpl->smarty, $_smarty_tpl);$_smarty_tpl->assign("paginationStartPage",$_template->fetch()); ?>
and this seems to correspond to

Code: Select all

<div class="pagelinks">
    {eval var=$footer_currentPage-3 assign="paginationStartPage"}
    {if $footer_currentPage+3 > $footer_totalPages}
PS: before I hat trouble with Textile, too.

Code: Select all

Fatal Error: Uncaught ErrorException: Warning: preg_replace_callback(): Compilation failed: invalid range in character class at offset 330 in /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php:1318
Stack trace:
#0 [internal function]: errorToExceptionHandler(2, 'preg_replace_ca...', '/var/www/myplace...', 1318, Array)
#1 /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php(1318): preg_replace_callback('/\n\t\t\t\t\t(^|(?<=[...', Array, 'Liebe Stephanus...')
#2 /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php(1290): Textile->span('Liebe Stephanus...')
#3 /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php(1242): Textile->graf('Liebe Stephanus...')
#4 /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php(1113): Textile->fBlock(Array)
#5 /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php(623): in /var/www/myplace/htdocs/cms-s9y/s9y/plugins/serendipity_event_textile/lib2/classTextile.php on line 1318.
But I delete this plugin in these blog and now I got the errors above.

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Wed Feb 24, 2021 10:52 pm
by stm999999999
And I have a second problem: language-depending:

When I use english in my browser, all works "fine" ... ok with the errors above :D But when I switch to german I get:

Code: Select all

 errorToExceptionHandler(2, Use of undefined constant SIDEBAR_TITLE - assumed 'SIDEBAR_TITLE' (th
I have defined SIDEBAR_TITLE in my template's lang_en.inc.php

Code: Select all

@define('SIDEBAR_TITLE', 'Title of Sidebar');
but not in lang_de.inc.php

Do I remember wrong? Shouldn't s9y use the english-file as a backup? And if something is not defined in any lang-file in the template at all, shouldn't s9y use the lang-file of the s9y standard template?

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Thu Feb 25, 2021 8:04 am
by onli
When error messages pop up in the javascript or the CSS the sites will break, that's normal.

SIDEBAR_TITLE: It's absolutely possible we changed the order in which the files are read. You are right, s9y will fall back to the engish language file - for plugins at least. But here clearly the constant is read before the constant is defined. For the moment, define it in the template's config.inc.php to silence the error, or test what happens if it's also in the german file. There might be a different error causing this.

For the other error, try to change

Code: Select all

    {if $footer_currentPage+3 > $footer_totalPages}
to

Code: Select all

    {if ($footer_currentPage+3) > $footer_totalPages}

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Fri Feb 26, 2021 7:07 pm
by stm999999999
ony this has not helped, I have to write () in the eval lines, too:

Code: Select all

<div class="pagelinks">
    {eval var=($footer_currentPage-3) assign="paginationStartPage"}
    {if ($footer_currentPage+3) > $footer_totalPages}
        {eval var=($footer_totalPages-6) assign="paginationStartPage"}
and for the language issue:

I put

@serendipity_plugin_api::load_language(dirname(__FILE__));

(found in the new templates)

instead of

Code: Select all

$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . '/lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
    include $probelang;
} else {
    include dirname(__FILE__) . '/lang_en.inc.php';
}
but no change. As long as this is only a warning, I will ignore it at the moment and look after it later.

Re: some trouble after upgrade :-( (1.5.5 to 2.3.5)

Posted: Fri Feb 26, 2021 7:56 pm
by onli
Explains a bit though: The old could will only read the lang_en file if the whole current language file is missing. The new code copies that behaviour, I think. So that was probably always broken, it just wasn't presented as an error. If it breaks nothing and you can surpress the error message it shouldn't matter too much.