Page MenuHomePhabricator

"Undefined index: imageinfo" attempting to generate certain ebooks
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT

Description

What is the problem?

When attempting to generate https://de.wikisource.org/wiki/Adalbert_T%C3%B6ckel,_der_Raucher or https://de.wikisource.org/wiki/Der_Staatsh%C3%A4morrhoidarius_(Fliegende_Bl%C3%A4tter_Nr._21), the generation is unsuccessful and in the logs I see:

2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Notice:  Undefined index: imageinfo in /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php on line 277
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Stack trace:
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   1. {main}() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/public/book.php:0
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   2. App\BookCreator->create() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/public/book.php:39
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   3. App\BookProvider->get() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookCreator.php:38
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   4. App\BookProvider->getMetadata() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php:48
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   5. App\BookProvider->getCover() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php:106
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Notice:  Undefined index: imageinfo in /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php on line 278
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Stack trace:
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   1. {main}() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/public/book.php:0
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   2. App\BookCreator->create() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/public/book.php:39
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   3. App\BookProvider->get() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookCreator.php:38
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   4. App\BookProvider->getMetadata() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php:48
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP   5. App\BookProvider->getCover() /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookProvider.php:106
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to App\Cleaner\FileCleaner::needsCleaning() must be of the type string, null given, called in /mn
t/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/Picture.php on line 58 and defined in /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/Cleaner/FileCleaner.php:11                   
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: Stack trace:
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: #0 /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/Picture.php(58): App\Cleaner\FileCleaner::needsCleaning(NULL)
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: #1 /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/Generator/EpubGenerator.php(94): App\Picture->saveToZip(Object(ZipArchive), 'OPS/imag
es/c1_F...')                                                                                                                                                                                                      
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: #2 /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/BookCreator.php(39): App\Generator\EpubGenerator->create(Object(App\Book))
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: #3 /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/public/book.php(39): App\BookCreator->create('Der_Staatsh\xC3\xA4mo...')
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr: #4 {main}
2019-12-10 17:36:28: (mod_fastcgi.c.2543) FastCGI-stderr:   thrown in /mnt/nfs/labstore-secondary-tools-project/wsexport-test/tool/src/Cleaner/FileCleaner.php on line 11

Both ebooks have images, although there are other ebooks with images which I can generate successfully (e.g. https://fr.wikisource.org/wiki/Le_Vingti%C3%A8me_Si%C3%A8cle).

Steps to reproduce problem
  1. Open https://tools.wmflabs.org/wsexport-test/book.php?lang=de&page=Adalbert_T%C3%B6ckel%2C_der_Raucher&format=epub-3&fonts=

Expected behavior: Get a epub generated.
Observed behavior: Nothing. See above error in logs.

Environment

Reproducible today on https://tools.wmflabs.org/wsexport-test/book.php and https://tools.wmflabs.org/wsexport/tool/book.php.

Event Timeline

Samwilson added a subscriber: Samwilson.

This appears to be because the pages in question contain invalid cover metadata:

<span id="ws-cover" style="display:none;">Fliegende BlΓ€tter 1.djvu|page=165</span>

That should be something like the following:

<span id="ws-cover" style="display:none;">Fliegende BlΓ€tter 1.djvu/165</span>

Which is a matter for the German Wikisource community to fix.

However, WS Export should definitely not be failing in this situation, so I've made the following fix: https://github.com/wikimedia/ws-export/pull/393

ldelench_wmf set the point value for this task to 1.Feb 2 2022, 12:20 PM

I'm happy to just merge this and keep an eye on things, if no one's got time to review it thoroughly.

I have generated a number of ebooks successfully on German Wikisource (including the 2 in the description). There were no errors.

Moving directly to Done as I don't think Natalia needs to see this.