WP_Optimize::loader causing massive performance issues
The WP_Optimize::loader
does not properly check the $class_name
, leading to significant performance issues and even 504 Gateway Time-outs.
This problem occurs when other plugins or themes also use an autoloader registered with spl_autoload_register
. The issue is exacerbated in your case because you do not use namespaces or follow the PSR-4 standard (https://www.php-fig.org/psr/psr-4/).
A quick fix is to validate the $class_name
type like this:
private function loader($class_name) {
if ($class_name === 'int' || $class_name === 'string' || $class_name === 'bool') {
return;
}$dirs = $this->get_class_directories();
// ...
}
However, a more robust solution would be to implement namespaces and adhere to PSR-4 standards.
مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد
منبع: انجمن وردپرس