Problem/Motivation
Create a new .puz file that doesn't throw any errors when it is added, but only the first few clues work. Errors in watchdog for every clue from index 7 onward?
Notice: Undefined offset: 7 in Drupal\crossword\Plugin\crossword\crossword_file_parser\AcrossLitePuzParser->getGridAndClues() (line 271 of /home/..../public_html/drupal/web/modules/crossword/src/Plugin/crossword/crossword_file_parser/AcrossLitePuzParser.php)
Steps to reproduce
Try loading up the attached file. Navigate beyond the third clue - it comes up blank as far as showing clues. But when selecting the option to solve the puzzle, all the answers are present.
eg: https://www.500foods.com/crosswords/monthly-crossword-2020-november
Other puzzles of similar size and composition don't seem to be having an issue. I've had puzzle files that were seemingly ok not pass the initial filter for some reason, but this one didn't seem to have an issue there.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | crossword--num-clues--3185956--2.patch | 4.21 KB | danflanagan8 |
| 2020-Nov.puz_.zip | 2.56 KB | gnumatrix |
Comments
Comment #2
danflanagan8Neat! The bug stems from the way I was getting the total number of clues from a .puz file. It obviously could never work for a puzzle with more than 99 clues. Woops!
Here's a patch that should fix it. Looks good locally and it passes the automated test.
Comment #3
danflanagan8Comment #4
gnumatrix commentedWorks good. Odd that it didn't come up before now. Would've thought I already had puzzles with just as many clues.
Comment #5
danflanagan8Not sure. The bug is only for puz files. If the others were txt they would work fine. Anyway, I'm glad you exposed this bug and we got it fixed.
I've been working on the clue toggle feature on another issue if you're interested in taking a look: #3185834: Add ability to toggle visibility and/or rendering of clue lists.
Comment #7
danflanagan8Comment #8
danflanagan8Ah, I know why you never saw this before: it's 255 clues that exposed the bug, not 99. Anything up to and including 255 clues was ok. This puzzle has 262 clues.
Comment #9
gnumatrix commentedAh, that makes more sense. Was pretty sure I had puzzles with more than 99 clues that didn't have any problems.
I will get to the clue toggle feature later today. One of the problems UI-wise is that the clue list is pretty long, so much so that you can't see the puzzle and the clues at the same time - hence my preference just to not show them at all. Experimenting with some ideas here, but will see how it all looks.
Comment #10
gnumatrix commentedComment #11
danflanagan8@GNUMatrix, I'm currently adding some serious test coverage to the crossword file parsers. Is it ok with you if I include this .puz file as part of the project in the tests/files/ directory and run a test on it?
Comment #12
gnumatrix commentedYes, but it is just a standard file so nothing particularly exceptional about it.
Comment #13
danflanagan8It has a ton of clues! And it's just a huge puzzle.
Anyway, I think it's valuable. Thanks for letting me use it. Cheers!