get_striptags() error during initial setup (Moodle 4.04

get_striptags() error during initial setup (Moodle 4.04

by Joshua Harding -
Number of replies: 20

Hi all,

first post here, apologies if this is the wrong thread

Putting this on here as a Last ditch effort. 

I've been trying to deploy Moodle in my own self-hosted lab to create a Proof of concept setup but unfortunately have run into a hurdle

during the last few steps  right after the gui installer adds the tables in the mysql database  i get an error when the page refreshes (Shown below) when i go to proceed to setup the admin page  

Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned

digging a bit further when i inspect the page it appears that I'm getting a 404 not found error for the index.php file. 

the index.php file is infact there.

I've gone through made sure that I'm running the most recent versions of moodles supporting software (MySql, php, apache2) and Checked permissions along with checking the Apache logs and resolving any errors there.

I've also have dug through configs and some of the source code but i have not found a resolution (though this may be due to my lack of experience with PHP.)

i was wondering if anyone has seen this before and weather they had a resolution?

here is the info on the setup here:

Moodle Version 404-stable

MySql: 8.0.36-0ubuntu0.22.04.1

PHP: sysadmin@fccamdletest:~$ php -v
PHP 8.3.7 (cli) (built: May 23 2024 12:36:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.7, Copyright (c), by Zend Technologies

Apache2:

Server version: Apache/2.4.52 (Ubuntu)
Server built:   2024-04-10T17:45:18

Thanks in advanced! 

Average of ratings: -
In reply to Joshua Harding

Re: get_striptags() error during initial setup (Moodle 4.04

by Ken Task -
Picture of Particularly helpful Moodlers

Please see:
http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases

and the row for 4.0
Your php version is too high for the version of moodle you are trying to install.

Instead of 4.0.x suggest installing moodle 4.4

Also check:
https://moodledev.io/general/releases/4.4
for php extensions and php settings

'SoS', Ken

In reply to Ken Task

Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken, Is it possible, that the OP was mislead by the (new) naming MOODLE_404_STABLE to mean Moodle 4.4?

@others, for details see MDLSITE-7675.

@Joshua, where do you see "Version 404-stable"?

Also note that the Moodle web application uses the PHP CGI version, as shown in PHP#Displaying_phpinfo_in_Moodle, not the PHP CLI you called in '$ php -v'.

In reply to Visvanath Ratnaweera

Re: get_striptags() error during initial setup (Moodle 4.04

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, it IS confusing. I still don't understand how '404' means 4.4.
 
4.04 I guess...
In reply to Howard Miller

Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
No! '404' will be Moodle 40.4! 
smile

===

`I'm afraid I can't put it more clearly,' Alice replied very politely, `for I can't understand it myself to begin with; and being so many different sizes in a day is very confusing.'

`It isn't,' said the Caterpillar.

`Well, perhaps you haven't found it so yet,' said Alice; `but when you have to turn into a chrysalis--you will some day, you know--and then after that into a butterfly, I should think you'll feel it a little queer, won't you?'

`Not a bit,' said the Caterpillar.

`Well, perhaps your feelings may be different,' said Alice; `all I know is, it would feel very queer to me.'

=== (Advice from a Caterpillar)

More seriously, read, "In 2035, the Moodle version number will reach double digits, and dropping that 0 could lead to some confusion." https://tracker.moodle.org/browse/MDLSITE-7675?focusedId=1085593&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1085593 and the follow up.
Average of ratings:Useful (1)
In reply to Howard Miller

Re: get_striptags() error during initial setup (Moodle 4.04

by Ken Task -
Picture of Particularly helpful Moodlers

+20 Howard!

moodle40 directory originally acquired with git
git pull results with the following:

From git://git.moodle.org/moodle
   2444b2b7876..f7da739ea04  MOODLE_401_STABLE -> origin/MOODLE_401_STABLE
   5ef6dccc02c..7ecbcb3c336  MOODLE_402_STABLE -> origin/MOODLE_402_STABLE
   970fe4d26dc..130165c8cc5  MOODLE_403_STABLE -> origin/MOODLE_403_STABLE
 * [new branch]              MOODLE_404_STABLE -> origin/MOODLE_404_STABLE
   b2fa19f45df..d32844ce296  main              -> origin/main
   b2fa19f45df..d32844ce296  master            -> origin/master
 * [new tag]                 v4.1.10           -> v4.1.10
 * [new tag]                 v4.2.7            -> v4.2.7
 * [new tag]                 v4.3.4            -> v4.3.4
 * [new tag]                 v4.4.0            -> v4.4.0
 * [new tag]                 v4.4.0-beta       -> v4.4.0-beta
 * [new tag]                 v4.4.0-rc1        -> v4.4.0-rc1
 * [new tag]                 v4.4.0-rc2        -> v4.4.0-rc2
Already up to date.

fgrep $release' version.php
$release  = '4.0.12 (Build: 20231211)'; // Human-friendly version name

On a moodle44 directory git acquired
git pull all ready up to date
git branch -a
shows tracking * MOODLE_404_STABLE
and in the listing of branches
  remotes/origin/MOODLE_400_STABLE
  remotes/origin/MOODLE_401_STABLE
  remotes/origin/MOODLE_402_STABLE
  remotes/origin/MOODLE_403_STABLE
  remotes/origin/MOODLE_404_STABLE

fgrep '$release' version.php
$release  = '4.4+ (Build: 20240524)'; // Human-friendly version name

I can re-call posting a question about branch numbers many moons ago and got an explanation that 400 is 4.0, 401 is really 4.1, 402 is really 4.2, 403 is really 4.3.

The reason I ask folks to provide php -v from command line ... assuming they have installed php correctly, php-cli version should match what is being run from web.   Besides, setup of cron should be using php-cli.

Probably should ask for both php -v and a phpinfo page they create an stick into document root of their web server.

Maybe the OP who posted could provide:

fgrep '$release' version.php 

from what OP has.

And another comment .. read where the last version in a series would always be an LTS ... that kinda redefines the meaning of LTS to me ...   if LTS means 'Long Term Support' ... more like "Last Term Support' now.

Old term - SNAFU!???

And here's something strange:

Downloads:

4.1.10+ to be MOODLE_401_STABLE

But...
4.1.10 to be MOODLE_40110

'SoS', Ken

In reply to Ken Task

Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken and all

> I can re-call posting a question about branch numbers many moons ago and got an explanation that 400 is 4.0, 401 is really 4.1, 402 is really 4.2, 403 is really 4.3.


> Maybe the OP who posted could provide:
> fgrep '$release' version.php
> from what OP has.

In fact there are three things:

a) git branch
* MOODLE_401_STABLE

b)  fgrep '$release' version.php
$release  = '4.1.10+ (Build: 20240516)';

c) Versions as in https://moodledev.io/general/releases
e.g. 4.1.10 in https://moodledev.io/general/releases/4.1/4.1.10

Unless one is careful, it is easy to go round in circles.

> Downloads:
> 4.1.10+ to be MOODLE_401_STABLE
>
> But...
> 4.1.10 to be MOODLE_40110

There is only one Git branch per *major* version, both will have the branch tag MOODLE_401_STABLE.

P.S.
> And another comment .. read where the last version in a series would always be an LTS ... that kinda redefines the meaning of LTS to me ...   if LTS means 'Long Term Support' ... more like "Last Term Support' now.

It is a separate topic, extensively discussed under Versioning and Deprecation changes in the developer forum.
In reply to Visvanath Ratnaweera

Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken and all the Installing PHMs

On this MOODLE_41_STABLE or MOODLE_401_STABLE discussion: It is worth subscribing to MDLSITE-7675.
In reply to Joshua Harding

Re: get_striptags() error during initial setup (Moodle 4.04

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

When installing, after you've entered the name and credentials for the database, the install pages will either create config.php or prompt you to copy and paste this file. Then it shows the license page before creating the tables. When the license page is showing, edit config.php adding these lines to enable debugging:

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

These lines must be inserted before the last require_once(__DIR__ . '/lib/setup.php'); line.

Hopefully you'll then see more detail with the exceptions to give us a clue what to look at next.

In reply to Leon Stringer

Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Marcin Łukasik -
I have the same problem after insertion

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

I received:

Warning: Undefined property: stdClass::$formatstringstriptags in /home/eimspl/public_html/wizualnie/moodle/lib/classes/formatting.php on line 390 Warning: Undefined property: stdClass::$formatstringstriptags in /home/eimspl/public_html/wizualnie/moodle/lib/classes/formatting.php on line 390
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 390 of /lib/classes/formatting.php: TypeError thrown
line 119 of /lib/classes/formatting.php: call to core\formatting->get_striptags()
line 1591 of /lib/weblib.php: call to core\formatting->format_string()
line 1402 of /lib/pagelib.php: call to format_string()
line 2976 of /lib/weblib.php: call to moodle_page->set_title()
line 755 of /admin/index.php: call to redirect()
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 390 of /lib/classes/formatting.php: TypeError thrown
line 119 of /lib/classes/formatting.php: call to core\formatting->get_striptags()
line 1591 of /lib/weblib.php: call to core\formatting->format_string()
line 1402 of /lib/pagelib.php: call to format_string()
line 3079 of /lib/outputrenderers.php: call to moodle_page->set_title()
line 2070 of /lib/setuplib.php: call to core_renderer->fatal_error()
line 471 of /lib/setuplib.php: call to bootstrap_renderer->__call()
line ? of unknownfile: call to default_exception_handler()
In reply to Marcin Łukasik

Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Really? Where else do you see, "line 390 of /lib/classes/formatting.php: TypeError thrown"?
In reply to Visvanath Ratnaweera

Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Marcin Łukasik -
Thank you for your interest.
This appears right after installation and loading the database. This is the stage before (during?) creating the administrator account.
At the path: moodle/admin/index.php?sessionstarted=1&lang=en
In reply to Marcin Łukasik

Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
My question was whether you have the same problem as Joshua at https://moodle.org/mod/forum/discuss.php?d=458883#p1842845.

Either way, pl. provide the information requested in Before you post.. Read this...

In reply to Visvanath Ratnaweera

Odp: Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Marcin Łukasik -
Yea, I have the same problem as Joshua at https://moodle.org/mod/forum/discuss.php?d=458883#p1842845.
I'm really sorry for inaccurate.
 
The installation is manual, where I upload the files to the hosting myself.

I get message on my site after added tables to database (before creating a admin account).
 

Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
 
Everything along the way (during installation) seems to be fine.
 
I added:

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

And when I installed again, I get this information (in the same place as the previous installation):

Warning: Undefined property: stdClass::$formatstringstriptags in /home/eimspl/public_html/wizualnie/moodle/lib/classes/formatting.php on line 390 Warning: Undefined property: stdClass::$formatstringstriptags in /home/eimspl/public_html/wizualnie/moodle/lib/classes/formatting.php on line 390
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 390 of /lib/classes/formatting.php: TypeError thrown
line 119 of /lib/classes/formatting.php: call to core\formatting->get_striptags()
line 1591 of /lib/weblib.php: call to core\formatting->format_string()
line 1402 of /lib/pagelib.php: call to format_string()
line 2976 of /lib/weblib.php: call to moodle_page->set_title()
line 755 of /admin/index.php: call to redirect()
Exception - core\formatting::get_striptags(): Return value must be of type bool, null returned
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 390 of /lib/classes/formatting.php: TypeError thrown
line 119 of /lib/classes/formatting.php: call to core\formatting->get_striptags()
line 1591 of /lib/weblib.php: call to core\formatting->format_string()
line 1402 of /lib/pagelib.php: call to format_string()
line 3079 of /lib/outputrenderers.php: call to moodle_page->set_title()
line 2070 of /lib/setuplib.php: call to core_renderer->fatal_error()
line 471 of /lib/setuplib.php: caadmin_tls_versionTLSv1.2immediate_server_version999999innodb_version8.0.32-24original_server_version999999protocol_version10replica_type_conversionsslave_type_conversionstls_versionTLSv1.2version8.0.32-24version_commentPercona Server (GPL), Release 24, Revision e5c6e9d...version_compile_machinex86_64version_compile_osLinuxversion_compile_zlib1.2.13version_suffixll to bootstrap_renderer->__call()
line ? of unknownfile: call to default_exception_handler()
 
It is on the path: moodle/admin/index.php?sessionstarted=1&lang=en
 
Moodle Version:
2024042201.00    
(Build: 20240610)
404
MATURITY_STABLE
 
 
MySQL Version:
8.0.32
 
PHP Version:
8.1.25
 
Server Version:
Apache: 2.4.58
Architecture:  x86_64
Operating system: linux
Kernel Version: 4.18.0-553.5.1.el8_10.x86_64
 
Thanks!
 
In reply to Marcin Łukasik

Re: Odp: Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Try changing line 390 of lib/classes/formatting.php to:

        return $CFG->formatstringstriptags ?? 1;

Hopefully you will get a different error which will give a better indication of the cause.

I think there's some error with your Moodle site, but the code to show this error isn't working. This message:

Warning: Undefined property: stdClass::$formatstringstriptags in /home/eimspl/public_html/wizualnie/moodle/lib/classes/formatting.php on line 390

suggests a config setting is missing in your database, but this should have been added during install. This is breaking the error handler.

In reply to Leon Stringer

Odp: Re: Odp: Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Marcin Łukasik -

Afrter changing line 390 of lib/classes/formatting.php to:

        return $CFG->formatstringstriptags ?? 1;

I get:

Debug info:
Error code: codingerror

Stack trace:
line 924 of /lib/classes/user.php: coding_exception thrown
line 301 of /user/editlib.php: call to core_user::get_property_default()
line 153 of /user/editadvanced_form.php: call to useredit_shared_definition()
line 217 of /lib/formslib.php: call to user_editadvanced_form->definition()
line 155 of /user/editadvanced.php: call to moodleform->__construct()

Output buffer: Warning: Undefined property: stdClass::$navcourselimit in /home/eimspl/public_html/wizualnie/moodle/lib/navigationlib.php on line 3230 Warning: Undefined property: stdClass::$maxbytes in /home/eimspl/public_html/wizualnie/moodle/user/editadvanced.php on line 126 Warning: Undefined property: stdClass::$maxbytes in /home/eimspl/public_html/wizualnie/moodle/user/editadvanced.php on line 148 Warning: Undefined property: stdClass::$defaultcity in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 691 Warning: Undefined property: stdClass::$country in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 692 Warning: Undefined property: stdClass::$calendartype in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 697 Warning: Undefined property: stdClass::$defaultpreference_mailformat in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 713 Warning: Undefined property: stdClass::$defaultpreference_maildigest in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 715 Warning: Undefined property: stdClass::$defaultpreference_maildisplay in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 717 Warning: Undefined property: stdClass::$defaultpreference_autosubscribe in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 719 Warning: Undefined property: stdClass::$defaultpreference_trackforums in /home/eimspl/public_html/wizualnie/moodle/lib/classes/user.php on line 721 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 430 Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 443 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 467 Warning: Undefined property: stdClass::$fullnamedisplay in /home/eimspl/public_html/wizualnie/moodle/user/editlib.php on line 473

Heh... It's looks terrible smile

I won't give up easily! smile

I will be grateful for your tips.

In reply to Marcin Łukasik

Re: Odp: Re: Odp: Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

It looks like the install didn't complete successfully. During installation tables are created and should get populated with values but that error suggests these are missing. You can check this with the SQL query:

SELECT name, value FROM mdl_config WHERE name LIKE 'defaultpreference_%';
+-----------------------------------------------+-------+
| name                                          | value |
+-----------------------------------------------+-------+
| defaultpreference_autosubscribe               | 1     |
| defaultpreference_core_contentbank_visibility | 1     |
| defaultpreference_maildigest                  | 0     |
| defaultpreference_maildisplay                 | 2     |
| defaultpreference_mailformat                  | 1     |
| defaultpreference_trackforums                 | 0     |
+-----------------------------------------------+-------+

I've shown the output from my test site.

This problem is often caused by some timeout preventing the install script from completing, typically a web server timeout or PHP's max_execution_time being exceeded.

To resolve this:

  • Delete and recreate the Moodle database (take a backup first as a precaution).
  • Ensure the timeouts for your web server and PHP are long enough to allow the Moodle install to complete, or
  • Perform the Moodle install using the command line as this isn't affected by timeouts.
Average of ratings:Useful (1)
In reply to Marcin Łukasik

Re: Odp: Re: Odp: Re: Odp: Re: Odp: Re: get_striptags() error during initial setup (Moodle 4.04

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Also, I've reported the error in the error handling (that needed the change in lib/classes/formatting.php to see the real error) as MDL-82323.

In reply to Joshua Harding

Re: get_striptags() error during initial setup (Moodle 4.04

by Mihail Omelin -

Hi, Joshua.

Did You find any solution for the problem? If did, please, share it. As for me, I dealt with the same on my local (experimental) site.

In reply to Joshua Harding

Re: get_striptags() error during initial setup (Moodle 4.04

by mike hofmann -

same here.

installation went smoothly without any errors/warnings and all  needed requirement were checked (moodle latest 4.4.1 from moodle.org installed on shared hoster in a 10.6.18 MariaDB)

after getting this error for the first time:
downgraded PHP from 8.3 to 8.2
new database
new installation
same error - again!

Fehler: core\formatting::get_striptags(): Return value must be of type bool, null returned
Fehler: core\formatting::get_striptags(): Return value must be of type bool, null returned
Attachment moodle-install-check.jpg
In reply to mike hofmann

Re: get_striptags() error during initial setup (Moodle 4.04

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

… (moodle latest 4.4.1 from moodle.org installed on shared hoster in a 10.6.18 MariaDB)

Moodle 4.4.1 is the latest minor version, released on 10 June 2024, but this get_striptags() error wasn't reported until 27 June 2024, and fixed in the weekly release of two weeks ago, Moodle 4.4.1+ (Build: 20240712). (There's a note about release versions in the docs).

So you either need to update your Moodle source code to the latest weekly release, or modify the Moodle 4.4.1 source code with this change.

Remember, this get_striptags() error appears due to a mistake in Moodle's error handling – once you fix this you should then see the actual error affecting your install.

Average of ratings:Useful (1)