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