tags block Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/blackbo2/dev.blackboxtrainingacademy.com/theme/edumy/classes/output/core/tag_renderer.php on line 26

tags block Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/blackbo2/dev.blackboxtrainingacademy.com/theme/edumy/classes/output/core/tag_renderer.php on line 26

by Frankie Broadhead -
Number of replies: 3

Hi all,

I am trying to get the tagging/tags block running but when anyone clicks a tag I get an error (not host-related)

I turned on debugging and this is the error I get. "Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/******/**************/theme/edumy/classes/output/core/tag_renderer.php on line 26"

(I have removed the hostname and site name for confidentiality reasons.

any help would be greatsmile 

Average of ratings: Useful (1)
In reply to Frankie Broadhead

Re: tags block Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/blackbo2/dev.blackboxtrainingacademy.com/theme/edumy/classes/output/core/tag_renderer.php on line 26

by Yahakov G -
Happens on out Edumy site too, turns out it was OPCache.

got getting 500 on: /tag/search.php    (but only on production! because of opcache)
( ! ) Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /*/theme/edumy/classes/output/core/tag_renderer.php on line 26
Call Stack
# Time Memory Function Location
1 0.0001 406288 {main}egg .../search.php:0
2 0.2561 5951288 moodle_page->get_rendereregg .../search.php:64
3 0.2561 5951288 theme_config->get_rendereregg .../pagelib.php:874
4 0.2561 5951288 theme_overridden_renderer_factory->get_rendereregg .../outputlib.php:2304
5 0.2562 5953880 class_exists egg .../outputfactories.php:405
6 0.2562 5953880 spl_autoload_call egg .../outputfactories.php:405
7 0.2562 5953880 core_component::classloaderegg .../outputfactories.php:405

temporarily fix that by creating /tag/.htaccess with the line:
php_flag opcache.enable Off
In reply to Yahakov G

Re: tags block Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/blackbo2/dev.blackboxtrainingacademy.com/theme/edumy/classes/output/core/tag_renderer.php on line 26

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

That error is surely caused by the Edumy theme's source code and you should contact the theme's supplier for a fix.

I'm surprised disabling OPcache has any effect on the error.

In reply to Leon Stringer

Re: tags block Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /home/blackbo2/dev.blackboxtrainingacademy.com/theme/edumy/classes/output/core/tag_renderer.php on line 26

by Yahakov G -
Already in contact with them for a permanent solution.
And was surprised too, but this work and maybe also applies for OP.