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.

Comments

GNUMatrix created an issue. See original summary.

danflanagan8’s picture

StatusFileSize
new4.21 KB

Neat! 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.

danflanagan8’s picture

Status: Active » Needs review
gnumatrix’s picture

Status: Needs review » Reviewed & tested by the community

Works good. Odd that it didn't come up before now. Would've thought I already had puzzles with just as many clues.

danflanagan8’s picture

Not 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.

  • danflanagan8 committed 06cd7cb on 8.x-1.x
    Issue #3185956 by danflanagan8, GNUMatrix: Odd behaviour from .puz file
    
danflanagan8’s picture

Status: Reviewed & tested by the community » Fixed
danflanagan8’s picture

Ah, 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.

gnumatrix’s picture

Ah, 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.

gnumatrix’s picture

Status: Fixed » Closed (fixed)
danflanagan8’s picture

@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?

gnumatrix’s picture

Yes, but it is just a standard file so nothing particularly exceptional about it.

danflanagan8’s picture

It 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!