Page MenuHomePhabricator

Undefined indexes: start and end in includes/TimedMediaHandler.php +392
Closed, ResolvedPublic

Description

I'm getting undefined index notices on viewing a video file after uploading a test webm in the MediaWiki-Docker dev environment while working on adding a jobrunner for TimedMediaHandler there.

This could be an artifact of the environment, but I notice patches just merged touching those lines for T203994. If a real bug, probably a blocker for T254173?

The stack traces:

Notice: Undefined index: start in /var/www/html/extensions/TimedMediaHandler/includes/TimedMediaHandler.php on line 392
Call Stack
#	Time	Memory	Function	Location
1	0.0054	421600	{main}( )	.../index.php:0
2	0.0544	3293392	MediaWiki->run( )	.../index.php:47
3	0.0546	3293392	MediaWiki->main( )	.../MediaWiki.php:543
4	0.0654	4235456	MediaWiki->performRequest( )	.../MediaWiki.php:986
5	0.0677	4594584	MediaWiki->performAction( )	.../MediaWiki.php:313
6	0.0679	4595272	ViewAction->show( )	.../MediaWiki.php:527
7	0.0686	4595560	ImagePage->view( )	.../ViewAction.php:74
8	0.0713	5072552	ImagePage->openShowImage( )	.../ImagePage.php:142
9	0.0807	5773656	Linker::processResponsiveImages( )	.../ImagePage.php:434
10	0.0823	6197184	LocalFile->transform( )	.../Linker.php:652
11	0.0827	6198488	WebMHandler->getTransform( )	.../File.php:1149
12	0.0827	6198488	WebMHandler->doTransform( )	.../MediaHandler.php:270

and

Notice: Undefined index: end in /var/www/html/extensions/TimedMediaHandler/includes/TimedMediaHandler.php on line 395
Call Stack
#	Time	Memory	Function	Location
1	0.0054	421600	{main}( )	.../index.php:0
2	0.0544	3293392	MediaWiki->run( )	.../index.php:47
3	0.0546	3293392	MediaWiki->main( )	.../MediaWiki.php:543
4	0.0654	4235456	MediaWiki->performRequest( )	.../MediaWiki.php:986
5	0.0677	4594584	MediaWiki->performAction( )	.../MediaWiki.php:313
6	0.0679	4595272	ViewAction->show( )	.../MediaWiki.php:527
7	0.0686	4595560	ImagePage->view( )	.../ViewAction.php:74
8	0.0713	5072552	ImagePage->openShowImage( )	.../ImagePage.php:142
9	0.0807	5773656	Linker::processResponsiveImages( )	.../ImagePage.php:434
10	0.0823	6197184	LocalFile->transform( )	.../Linker.php:652
11	0.0827	6198488	WebMHandler->getTransform( )	.../File.php:1149
12	0.0827	6198488	WebMHandler->doTransform( )	.../MediaHandler.php:270

Event Timeline

brennen created this task.Jun 8 2020, 9:55 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 8 2020, 9:55 PM
brennen triaged this task as Unbreak Now! priority.Jun 9 2020, 3:48 PM
brennen added subscribers: Esanders, brion.

Marking as train blocker out of an abundance of caution.

I filed this yesterday in the middle of a stack of things and meant to follow up sooner; entirely my bad. Thoughts @brion / @Esanders?

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptJun 9 2020, 3:48 PM

Thanks, will look.

Code is from @Esanders in https://phabricator.wikimedia.org/rETMH59a3f861a31b0c4ef50ec7115640e3e403c581fa patch specfically; ?: doesn't swallow index sets, unlike ?? I guess?

Change 604090 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/TimedMediaHandler@master] Avoid undefined index error

https://gerrit.wikimedia.org/r/604090

Code is from @Esanders in https://phabricator.wikimedia.org/rETMH59a3f861a31b0c4ef50ec7115640e3e403c581fa patch specfically; ?: doesn't swallow index sets, unlike ?? I guess?

I'm afraid I have to give the blame back to you. The original patch worked because getText() returns null if the index isn't found, and doesn't throw an error.

Switching to an array index, like you say ?? swallows the undefined index error, but ?: doesn't.

The above fix avoids all the subtleties of ??/?: by using isset explicitly.

Change 604090 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Avoid undefined index error

https://gerrit.wikimedia.org/r/604090

Change 604100 had a related patch set uploaded (by Jforrester; owner: Esanders):
[mediawiki/extensions/TimedMediaHandler@wmf/1.35.0-wmf.36] Avoid undefined index error

https://gerrit.wikimedia.org/r/604100

Change 604100 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@wmf/1.35.0-wmf.36] Avoid undefined index error

https://gerrit.wikimedia.org/r/604100

brennen closed this task as Resolved.Jun 9 2020, 6:37 PM
brennen claimed this task.
brennen reassigned this task from brennen to Jdforrester-WMF.
brennen moved this task from Backlog to Done / Defunct on the User-brennen board.

Mentioned in SAL (#wikimedia-operations) [2020-06-09T18:41:13Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.36/extensions/TimedMediaHandler/includes/TimedMediaHandler.php: T254824 Avoid undefined index error (duration: 00m 57s)