Преглед изворни кода

Gestion erreur class not found

Lorsqu'une class n'est pas trouvée, on le signale via une exception.
Avant ce patch, le programme tombait dans une boucle infinie.
refactoring
keun пре 6 година
родитељ
комит
71c7068f95
1 измењених фајлова са 11 додато и 0 уклоњено
  1. +11
    -0
      common/exts/Import.php

+ 11
- 0
common/exts/Import.php Прегледај датотеку

@@ -12,6 +12,8 @@ class Import
private static $_classMap = [];
private static $_registered = false;

private static $test_class_not_found = [] ;
/**
* Import namespace
* ```
@@ -66,6 +68,15 @@ class Import
*/
public static function load($class)
{
if(!isset(static::$test_class_not_found[$class]))
static::$test_class_not_found[$class] = 0 ;
static::$test_class_not_found[$class] ++ ;
if(static::$test_class_not_found[$class] > 30) {
throw new \yii\base\ErrorException('Class not found : '.$class) ;
}
if (empty(static::$_paths) && empty(static::$_classMap)) {
return;
}

Loading…
Откажи
Сачувај