Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Don't crash if days passed. #749

@jarofgreen

Description

@jarofgreen

https://demomasterss.openacalendar.org/api1/events.before.atom?days=

will crash the site with

Fatal error: Uncaught TypeError: Argument 1 passed to api1exportbuilders\EventListATOMBeforeBuilder::setDaysBefore() must be of the type integer, string given, called in /vagrant/core/php/siteapi1/controllers/EventListController.php on line 79 and defined in /vagrant/core/php/api1exportbuilders/EventListATOMBeforeBuilder.php:30 Stack trace: #0 /vagrant/core/php/siteapi1/controllers/EventListController.php(79): api1exportbuilders\EventListATOMBeforeBuilder->setDaysBefore('') #1 [internal function]: siteapi1\controllers\EventListController->atomBefore(Object(Symfony\Component\HttpFoundation\Request), Object(Silex\Application)) #2 /vagrant/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Array, Array) #3 /vagrant/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #4 /vagrant/vendor/silex/silex/src/Silex/Application.php(496): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFounda in /vagrant/core/php/api1exportbuilders/EventListATOMBeforeBuilder.php on line 30

Fix that.

If a non number is passed, just default it to 3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions