Bug #12754
Build nested set off-by-one error - Task generates 500 error if database row count is a multiple of 4000
Status: | Verified | Start date: | 01/28/2019 | |
---|---|---|---|---|
Priority: | Medium | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | CLI tools | |||
Target version: | Release 2.5.0 | |||
Google Code Legacy ID: | Tested version: | 2.4 | ||
Sponsored: | No | Requires documentation: | No |
Description
First reported via a community-filed GitHub issue on the AtoM repo, 2019-01-25:
From the report:
Got an error when building a nested set:
PDOException: SQLSTATE[HY000]: General error: trying to execute an empty query in /var/www/html/atom-2.4.1/lib/task/propel/propelBuildNestedSetTask.class.php:126 Stack trace: #0 /var/www/html/atom-2.4.1/lib/task/propel/propelBuildNestedSetTask.class.php(120): PDO->exec('')
What's happening is the loop at line 117 run's 1 too many times if the row count is a multiple of 4000. We had exactly 84000 records and got the error above. So I think the fix is:
for ($i=0; $i <= (count($this->rows)-1); $i+=$incr) { $sql = implode("\n", array_slice($this->rows, $i, $incr)); $conn->exec($sql); }
Steve has looked at the issue and confirmed its validity.
History
#1 Updated by Steve Breker about 3 years ago
#2 Updated by Steve Breker about 3 years ago
- Status changed from New to Code Review
#3 Updated by Mike Cantelon about 3 years ago
- Assignee set to Mike Cantelon
#4 Updated by Mike Cantelon about 3 years ago
- Status changed from Code Review to Feedback
- Assignee changed from Mike Cantelon to Steve Breker
Looks good to me!
#5 Updated by Steve Breker about 3 years ago
- Status changed from Feedback to QA/Review
Merged qa/2.5.x
#6 Updated by Steve Breker about 3 years ago
- Assignee deleted (
Steve Breker)
#7 Updated by Dan Gillean about 3 years ago
- Status changed from QA/Review to Verified
- Target version set to Release 2.5.0