Bug #11542

digitalObjectLoadTask generates runtime error

Added by Steve Breker over 1 year ago. Updated about 1 year ago.

Status:VerifiedStart date:09/22/2017
Priority:LowDue date:
Assignee:-% Done:

0%

Category:CLI tools
Target version:Release 2.5.0
Google Code Legacy ID: Tested version:2.5
Sponsored:No Requires documentation:

Description

Correct the number of parameters specified in calls to logSection()

See: https://github.com/artefactual/atom/blob/qa/2.5.x/lib/task/digitalobject/digitalObjectLoadTask.class.php#L93

History

#1 Updated by Steve Breker over 1 year ago

See this forum thread for more info:

https://groups.google.com/forum/#!msg/ica-atom-users/mvPgnfZvUuE/bPK7iJw8BgAJ

[root@ualatom-test tobeuploaded]# cat bulk.dig.import.5.csv
identifier,filename
UAA-1968-009,/var/www/html/atom/tobeuploaded/1968-9-272.jpg

[root@ualatom-test tobeuploaded]# ls
1968-9-272.jpg bulk.dig.import.2.csv bulk.dig.import.3.csv bulk.dig.import.4.csv bulk.dig.import.5.csv bulk.dig.import.csv bulk_image.test.csv
[root@ualatom-test atom]# php symfony digitalobject:load /var/www/html/atom/tobeuploaded/bulk.dig.import.5.csv
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function sfCommandApplicationTask::logSection(), 1 passed in /var/www/html/atom-2.4.0/lib/task/digitalobject/digitalObjectLoadTask.class.php on line 93 and at least 2 expected in /var/www/html/atom-2.4.0/vendor/symfony/lib/task/sfCommandApplicationTask.class.php:50
Stack trace:
#0 /var/www/html/atom-2.4.0/lib/task/digitalobject/digitalObjectLoadTask.class.php(93): sfCommandApplicationTask->logSection('Load digital ob...')
#1 /var/www/html/atom-2.4.0/vendor/symfony/lib/task/sfBaseTask.class.php(68): digitalObjectLoadTask->execute(Array, Array)
#2 /var/www/html/atom-2.4.0/vendor/symfony/lib/task/sfTask.class.php(97): sfBaseTask->doRun(Object(sfCommandManager), NULL)
#3 /var/www/html/atom-2.4.0/vendor/symfony/lib/command/sfSymfonyCommandApplication.class.php(76): sfTask->runFromCLI(Object(sfCommandManager), NULL)
#4 /var/www/html/atom-2.4.0/vendor/symfony/lib/command/cli.php(20): sfSymfonyCommandApplication->run()
#5 /var/www/html/atom-2.4.0/symfony(14): include( in /var/www/html/atom-2.4.0/vendor/symfony/lib/task/sfCommandApplicationTask.class.php on line 50

#3 Updated by Steve Breker over 1 year ago

It turns out the user is running PHP 7.1 - the 7.1 breaking changes page describes ArgumentCountError as now being elevated to an error instead of a warning:

http://php.net/manual/en/migration71.incompatible.php

This is why we do not see these errors under PHP versions < 7.1.

#4 Updated by Steve Breker over 1 year ago

Found a few more CLI tasks exhibiting the same issue:

- lib/task/digitalobject/digitalObjectDeleteTask.class.php
- lib/task/digitalobject/digitalObjectLoadTask.class.php
- lib/task/import/csvRepositoryImportTask.class.php
- lib/task/import/importDipObjectsTask.class.php
- lib/task/tools/deleteDescriptionTask.class.php

#5 Updated by Steve Breker over 1 year ago

  • Status changed from New to Code Review
  • Assignee changed from Steve Breker to Nick Wilkinson

#6 Updated by Nick Wilkinson over 1 year ago

  • Assignee changed from Nick Wilkinson to Mike Cantelon

HI Mike, can you please take a look at this for CR?

#7 Updated by Mike Cantelon over 1 year ago

  • Status changed from Code Review to Feedback
  • Assignee changed from Mike Cantelon to Steve Breker

Hi Steve... fix looks good.

#8 Updated by Steve Breker over 1 year ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from Steve Breker to Nick Wilkinson

Merged to qa/2.5.x. Ready for QA.

#9 Updated by Nick Wilkinson over 1 year ago

  • Assignee changed from Nick Wilkinson to Dan Gillean

#10 Updated by Dan Gillean about 1 year ago

  • Assignee changed from Dan Gillean to Steve Breker

Hi Steve!

So.... to test this issue, do I need to upgrade to PHP 7.1, and then downgrade after? Or.... ?

#11 Updated by Steve Breker about 1 year ago

  • Assignee changed from Steve Breker to Dan Gillean

The issue was that in some cases, devs forgot that logSection() (which is used to output log lines to the CLI console as the tasks run) takes two params. PHP <7.1 was tolerant of this.

PHP >=7.1 is not and classifies this as a hard stop error.

If output messages are still being displayed in PHP 7.0, then logSection() is still behaving as it should with two parameters. It should behave the exact same with two parameters under PHP >= 7.1.

#12 Updated by Dan Gillean about 1 year ago

  • Status changed from QA/Review to Verified
  • Assignee deleted (Dan Gillean)
  • Tested version 2.5 added

Also available in: Atom PDF