Rtl mode with Xdebug extension

Rtl mode with Xdebug extension

by Евгений Кожанов -
Number of replies: 3
Hi, I would like to share a non-obvious problem that I encountered and which I managed to solve. I use moodle 4.1.3 with a custom theme that I wrote myself. One day there was a need to download a language using rtl (Arabic). After downloading it, I found an infinitely long script running time, and then a 500 error on the endpoint localhost/moodle/theme/styles_debug.php?rtl=1&theme=my_theme&type=scss. A similar situation occurred when accessing another endpoint responsible for the disabled theme editing mode: localhost/moodle/theme/styles.php/my_theme/.... At first I thought that the problem was in my custom theme, but both the boost theme and the classic theme showed the same result. At this point, after loading the moodle for 5-10 minutes, it was displayed without styles at all, the reason for this was an infinitely long loading, then 500 error with the css endpoints indicated above. Accordingly, the problem was solved by commenting lines
51 $theme->set_rtl_mode($rtl); in theme/styles_debug.php
or
106 $theme->set_rtl_mode(substr($type, -4) === '-rtl'); in theme/styles.php. 
Of course, such a solution to the problem did not suit me, since moodle could not compile css for rtl mod completely, so I began to investigate further. The problem was compounded by the fact that it existed only locally for me, there was no such thing in production. The research led me to the file lib/outputlib.php and the public function post_process($css) method in it. Infinite loading appeared after
line 1871 $csstree = $parser->parse(); in this file,
a further stack of calls resulted in the file lib/php-css-parser/CSSList/CSSList.php and the method in it is public static function parseList(ParserState $oParserState, CSSList $oList). At first I thought I was facing an infinite loop while (!$oParserState->isEnd()), but debugging showed that no, further thinking about this did not lead me anywhere.

The solution to the problem turned out to be simple: I disabled the xdebug extension completely and the problem disappeared.


Can someone comment in more detail on what exactly I encountered and why this particular solution helped me? And if this is specifically such a feature of the css moodle compiler, then write about the urgent recommendation to disable this extension, for example, on the moodle server compliance check page during installation

Average of ratings: -
In reply to Евгений Кожанов

Re: Rtl mode with Xdebug extension

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Tried and cannot replicate - but is slow. Try turning off 'themedesignermode'.
In reply to Gareth J Barnard

Re: Rtl mode with Xdebug extension

by Евгений Кожанов -
"A similar situation occurred when accessing another endpoint responsible for the disabled theme editing mode: localhost/moodle/theme/styles.php/my_theme/....". I speak about 'themedesignermode' setting
In reply to Евгений Кожанов

Re: Rtl mode with Xdebug extension

by Евгений Кожанов -
more info about my config:
Windows 10, WAMP server, PHP 7.4
In themedesignermode off:


In themedesignermode on:


Of course this problem only in rtl mode, so styles_debug.php?theme=remdzl&type=scss is ok.
My php.ini Xdebug: 

Disabling solves the problem