yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Infinite Loop error after upgrading to Yii 2.0.50 #20202

Closed fijas closed 4 months ago

fijas commented 5 months ago

After upgrading to Yii 2.0.50, while trying to display a gridview using yii2-elasticsearch, an infinite loop is reported by XDebug.

What steps will reproduce the problem?

Using the yii2-elasticsearch ActiveDataProvider class to display paginated listing is causing this infinite loop error

What's expected?

Display the listing normally which works on reverting the package updates (list of packages updated given below)

What do you get instead?

Additional info

code: 0,
file:  "/usr/share/nginx/html/vendor/yiisoft/yii2/di/Container.php",
line: 499
message:  "Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '512' frames"
name:  "Exception"
stack-trace : 
    0:  "#0 /usr/share/nginx/html/vendor/yiisoft/yii2/di/Container.php(385): yii\\di\\Container>getDependencies('yii\\\\data\\\\Pagina...')"
    1: "#1 /usr/share/nginx/html/vendor/yiisoft/yii2/di/Container.php(170): yii\\di\\Container->build('yii\\\\data\\\\Pagina...', Array, Array)"
    2:  "#2 /usr/share/nginx/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\\di\\Container->get('yii\\\\data\\\\Pagina...', Array, Array)"
    3:  "#3 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(219): yii\\BaseYii::createObject(Array)"
    4:  "#4 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(194): yii\\data\\BaseDataProvider->setPagination(Array)"
    5:  "#5 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(114): yii\\data\\BaseDataProvider->getPagination()"
    6: "#6 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(102): yii\\elasticsearch\\ActiveDataProvider->prepareModels()"
    7: "#7 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(51): yii\\data\\BaseDataProvider->prepare()"
    8: "#8 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(143): yii\\elasticsearch\\ActiveDataProvider->getQueryResults()"
    9: "#9 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(171): yii\\elasticsearch\\ActiveDataProvider->prepareTotalCount()"
    10: "#10 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(222): yii\\data\\BaseDataProvider->getTotalCount()"
    11: "#11 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(194): yii\\data\\BaseDataProvider->setPagination(Object(yii\\data\\Pagination))"
    12: "#12 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(114): yii\\data\\BaseDataProvider->getPagination()"
    13: "#13 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(102): yii\\elasticsearch\\ActiveDataProvider->prepareModels()"
    14: "#14 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(51): yii\\data\\BaseDataProvider->prepare()"
    15: "#15 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(143): yii\\elasticsearch\\ActiveDataProvider->getQueryResults()"
    16: "#16 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(171): yii\\elasticsearch\\ActiveDataProvider->prepareTotalCount()"
    17: "#17 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(222): yii\\data\\BaseDataProvider->getTotalCount()"
    18: "#18 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(194): yii\\data\\BaseDataProvider->setPagination(Object(yii\\data\\Pagination))"
    19: "#19 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(114): yii\\data\\BaseDataProvider->getPagination()"
    20: "#20 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(102): yii\\elasticsearch\\ActiveDataProvider->prepareModels()"
    21: "#21 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(51): yii\\data\\BaseDataProvider->prepare()"
    22: "#22 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(143): yii\\elasticsearch\\ActiveDataProvider->getQueryResults()"
    23: "#23 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(171): yii\\elasticsearch\\ActiveDataProvider->prepareTotalCount()"
    24: "#24 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(222): yii\\data\\BaseDataProvider->getTotalCount()"
    25: "#25 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(194): yii\\data\\BaseDataProvider->setPagination(Object(yii\\data\\Pagination))"
    26: "#26 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(114): yii\\data\\BaseDataProvider->getPagination()"
    27: "#27 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(102): yii\\elasticsearch\\ActiveDataProvider->prepareModels()"
    28: "#28 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(51): yii\\data\\BaseDataProvider->prepare()"
    29: "#29 /usr/share/nginx/html/vendor/yiisoft/yii2-elasticsearch/ActiveDataProvider.php(143): yii\\elasticsearch\\ActiveDataProvider->getQueryResults()"
    30: "#30 /usr/share/nginx/html/vendor/yiisoft/yii2/data/BaseDataProvider.php(171): yii\\elasticsearch\\ActiveDataProvider->prepareTotalCount()"
    ...

Packages that got updated on running composer update:

  - Removing symfony/process (v7.0.7)
- Upgrading aws/aws-sdk-php (3.308.4 => 3.313.0)
- Upgrading bower-asset/inputmask (3.3.11 => 5.0.9)
- Upgrading bower-asset/punycode (v1.3.2 => v2.3.1)
- Upgrading components/flag-icon-css (v7.2.2 => v7.2.3)
- Upgrading phpstan/phpstan (1.11.2 => 1.11.4)
- Upgrading psy/psysh (v0.12.3 => v0.12.4)
- Upgrading roave/security-advisories (dev-latest 37f84fe => dev-latest cac81dc)
- Upgrading symfony/browser-kit (v6.4.7 => v6.4.8)
- Upgrading symfony/config (v7.0.7 => v7.1.1)
- Upgrading symfony/console (v7.0.7 => v7.1.1)
- Upgrading symfony/css-selector (v7.0.7 => v7.1.1)
- Upgrading symfony/dependency-injection (v7.0.7 => v7.1.1)
- Upgrading symfony/dom-crawler (v6.4.7 => v6.4.8)
- Upgrading symfony/event-dispatcher (v7.0.7 => v7.1.1)
- Upgrading symfony/filesystem (v7.0.7 => v7.1.1)
- Upgrading symfony/finder (v7.0.7 => v7.1.1)
- Upgrading symfony/string (v7.0.7 => v7.1.1)
- Upgrading symfony/var-dumper (v7.0.7 => v7.1.1)
- Upgrading symfony/var-exporter (v7.0.7 => v7.1.1)
- Upgrading symfony/yaml (v7.0.7 => v7.1.1)
- Upgrading yiisoft/yii2 (2.0.49.3 => 2.0.50)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 5 updates, 0 removals
- Downloading bower-asset/jquery (3.7.1)
- Downloading aws/aws-sdk-php (3.313.0)
- Downloading psy/psysh (v0.12.4)
- Downloading components/flag-icon-css (v7.2.3)
- Upgrading bower-asset/jquery (3.6.4 => 3.7.1): Extracting archive
- Upgrading aws/aws-sdk-php (3.311.1 => 3.313.0): Extracting archive
- Upgrading psy/psysh (v0.12.3 => v0.12.4): Extracting archive
- Upgrading components/flag-icon-css (v7.2.2 => v7.2.3): Extracting archive
- Upgrading roave/security-advisories (dev-latest eaf1054 => dev-latest cac81dc)

I'm guessing there has been some change in either Yii2 or one of the symfony packages that is causing this but I haven't been able to figure out what it is...

Q A
Yii version 2.0.50
PHP version 8.2
Operating system Linux
samdark commented 5 months ago

@lav45 seems to be connected with pagination fix.

jgkarl commented 5 months ago
I can confirm same issue. Quick fix was to replace BaseDataProvider.php from 2.0.49.3 Q A
Yii version 2.0.50
PHP version 7.4
Operating system Linux
Hosted Docker