Lopo / Limas

"major refactor" of PartKeepr
GNU General Public License v3.0
44 stars 7 forks source link

Part search #10

Open afx303 opened 1 month ago

afx303 commented 1 month ago

Searching for a part throws an error

An error occurred Typed property Limas\Filter\Filter::$association must not be accessed before initialization

Details Request: GET http://limas.local/api/parts?_dc=1729022488053

{"@context":"\/api\/contexts\/Error","@type":"hydra:Error","hydra:title":"An error occurred","hydra:description":"Typed property Limas\Filter\Filter::$association must not be accessed before initialization","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/limas\/src\/Filter\/AssociationPropertyTrait.php","line":25,"args":[]},{"namespace":"Limas\Filter","short_class":"Filter","class":"Limas\Filter\Filter","type":"-\u003E","function":"getAssociation","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":116,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"getFilterExpression","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":46,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"filter","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":311,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"applyToCollection","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Doctrine\/Orm\/State\/CollectionProvider.php","line":74,"args":[]},{"namespace":"ApiPlatform\Doctrine\Orm\State","short_class":"CollectionProvider","class":"ApiPlatform\Doctrine\Orm\State\CollectionProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/CallableProvider.php","line":43,"args":[]},{"namespace":"ApiPlatform\State","short_class":"CallableProvider","class":"ApiPlatform\State\CallableProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/Provider\/ReadProvider.php","line":76,"args":[]},{"namespace":"ApiPlatform\State\Provider","short_class":"ReadProvider","class":"ApiPlatform\State\Provider\ReadProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/Validator\/State\/ParameterValidatorProvider.php","line":87,"args":[]},{"namespace":"ApiPlatform\Symfony\Validator\State","short_class":"ParameterValidatorProvider","class":"ApiPlatform\Symfony\Validator\State\ParameterValidatorProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/Provider\/ParameterProvider.php","line":99,"args":[]},{"namespace":"ApiPlatform\State\Provider","short_class":"ParameterProvider","class":"ApiPlatform\State\Provider\ParameterProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/Security\/State\/AccessCheckerProvider.php","line":62,"args":[]},{"namespace":"ApiPlatform\Symfony\Security\State","short_class":"AccessCheckerProvider","class":"ApiPlatform\Symfony\Security\State\AccessCheckerProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/EventListener\/ReadListener.php","line":95,"args":[]},{"namespace":"ApiPlatform\Symfony\EventListener","short_class":"ReadListener","class":"ApiPlatform\Symfony\EventListener\ReadListener","type":"-\u003E","function":"onKernelRequest","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/Debug\/WrappedListener.php","line":116,"args":[]},{"namespace":"Symfony\Component\EventDispatcher\Debug","short_class":"WrappedListener","class":"Symfony\Component\EventDispatcher\Debug\WrappedListener","type":"-\u003E","function":"__invoke","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":206,"args":[]},{"namespace":"Symfony\Component\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\Component\EventDispatcher\EventDispatcher","type":"-\u003E","function":"callListeners","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":56,"args":[]},{"namespace":"Symfony\Component\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\Component\EventDispatcher\EventDispatcher","type":"-\u003E","function":"dispatch","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/Debug\/TraceableEventDispatcher.php","line":127,"args":[]},{"namespace":"Symfony\Component\EventDispatcher\Debug","short_class":"TraceableEventDispatcher","class":"Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher","type":"-\u003E","function":"dispatch","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":154,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"HttpKernel","class":"Symfony\Component\HttpKernel\HttpKernel","type":"-\u003E","function":"handleRaw","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":76,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"HttpKernel","class":"Symfony\Component\HttpKernel\HttpKernel","type":"-\u003E","function":"handle","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/Kernel.php","line":185,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"Kernel","class":"Symfony\Component\HttpKernel\Kernel","type":"-\u003E","function":"handle","file":"\/var\/www\/limas\/vendor\/symfony\/runtime\/Runner\/Symfony\/HttpKernelRunner.php","line":35,"args":[]},{"namespace":"Symfony\Component\Runtime\Runner\Symfony","short_class":"HttpKernelRunner","class":"Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner","type":"-\u003E","function":"run","file":"\/var\/www\/limas\/vendor\/autoload_runtime.php","line":29,"args":[]},{"namespace":"","short_class":"","class":"","type":"","function":"require_once","file":"\/var\/www\/limas\/public\/index.php","line":5,"args":[["string","\/var\/www\/limas\/vendor\/autoload_runtime.php"]]}]}

Full report

An error occurred

Details

Typed property Limas\Filter\Filter::$association must not be accessed before initialization

Request

GET http://limas.local/api/parts?_dc=1729022488053

Response Status Code

500

Response

{"@context":"\/api\/contexts\/Error","@type":"hydra:Error","hydra:title":"An error occurred","hydra:description":"Typed property Limas\Filter\Filter::$association must not be accessed before initialization","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/limas\/src\/Filter\/AssociationPropertyTrait.php","line":25,"args":[]},{"namespace":"Limas\Filter","short_class":"Filter","class":"Limas\Filter\Filter","type":"-\u003E","function":"getAssociation","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":116,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"getFilterExpression","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":46,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"filter","file":"\/var\/www\/limas\/src\/Filter\/AdvancedSearchFilter.php","line":311,"args":[]},{"namespace":"Limas\Filter","short_class":"AdvancedSearchFilter","class":"Limas\Filter\AdvancedSearchFilter","type":"-\u003E","function":"applyToCollection","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Doctrine\/Orm\/State\/CollectionProvider.php","line":74,"args":[]},{"namespace":"ApiPlatform\Doctrine\Orm\State","short_class":"CollectionProvider","class":"ApiPlatform\Doctrine\Orm\State\CollectionProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/CallableProvider.php","line":43,"args":[]},{"namespace":"ApiPlatform\State","short_class":"CallableProvider","class":"ApiPlatform\State\CallableProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/Provider\/ReadProvider.php","line":76,"args":[]},{"namespace":"ApiPlatform\State\Provider","short_class":"ReadProvider","class":"ApiPlatform\State\Provider\ReadProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/Validator\/State\/ParameterValidatorProvider.php","line":87,"args":[]},{"namespace":"ApiPlatform\Symfony\Validator\State","short_class":"ParameterValidatorProvider","class":"ApiPlatform\Symfony\Validator\State\ParameterValidatorProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/State\/Provider\/ParameterProvider.php","line":99,"args":[]},{"namespace":"ApiPlatform\State\Provider","short_class":"ParameterProvider","class":"ApiPlatform\State\Provider\ParameterProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/Security\/State\/AccessCheckerProvider.php","line":62,"args":[]},{"namespace":"ApiPlatform\Symfony\Security\State","short_class":"AccessCheckerProvider","class":"ApiPlatform\Symfony\Security\State\AccessCheckerProvider","type":"-\u003E","function":"provide","file":"\/var\/www\/limas\/vendor\/api-platform\/core\/src\/Symfony\/EventListener\/ReadListener.php","line":95,"args":[]},{"namespace":"ApiPlatform\Symfony\EventListener","short_class":"ReadListener","class":"ApiPlatform\Symfony\EventListener\ReadListener","type":"-\u003E","function":"onKernelRequest","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/Debug\/WrappedListener.php","line":116,"args":[]},{"namespace":"Symfony\Component\EventDispatcher\Debug","short_class":"WrappedListener","class":"Symfony\Component\EventDispatcher\Debug\WrappedListener","type":"-\u003E","function":"__invoke","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":206,"args":[]},{"namespace":"Symfony\Component\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\Component\EventDispatcher\EventDispatcher","type":"-\u003E","function":"callListeners","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/EventDispatcher.php","line":56,"args":[]},{"namespace":"Symfony\Component\EventDispatcher","short_class":"EventDispatcher","class":"Symfony\Component\EventDispatcher\EventDispatcher","type":"-\u003E","function":"dispatch","file":"\/var\/www\/limas\/vendor\/symfony\/event-dispatcher\/Debug\/TraceableEventDispatcher.php","line":127,"args":[]},{"namespace":"Symfony\Component\EventDispatcher\Debug","short_class":"TraceableEventDispatcher","class":"Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher","type":"-\u003E","function":"dispatch","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":154,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"HttpKernel","class":"Symfony\Component\HttpKernel\HttpKernel","type":"-\u003E","function":"handleRaw","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":76,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"HttpKernel","class":"Symfony\Component\HttpKernel\HttpKernel","type":"-\u003E","function":"handle","file":"\/var\/www\/limas\/vendor\/symfony\/http-kernel\/Kernel.php","line":185,"args":[]},{"namespace":"Symfony\Component\HttpKernel","short_class":"Kernel","class":"Symfony\Component\HttpKernel\Kernel","type":"-\u003E","function":"handle","file":"\/var\/www\/limas\/vendor\/symfony\/runtime\/Runner\/Symfony\/HttpKernelRunner.php","line":35,"args":[]},{"namespace":"Symfony\Component\Runtime\Runner\Symfony","short_class":"HttpKernelRunner","class":"Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner","type":"-\u003E","function":"run","file":"\/var\/www\/limas\/vendor\/autoload_runtime.php","line":29,"args":[]},{"namespace":"","short_class":"","class":"","type":"","function":"require_once","file":"\/var\/www\/limas\/public\/index.php","line":5,"args":[["string","\/var\/www\/limas\/vendor\/autoload_runtime.php"]]}]}

Server Configuration

doctrine_orm_version: 2.20.0.0 doctrine_dbal_version: 3.9.3.0 doctrine_common_version: 3.4.5.0 php_version: 8.2.24 auto_start_session: true maxUploadSize: 2097152 isOctoPartAvailable: true availableImageFormats: image/gif,image/jpeg,image/png,image/vnd.wap.wbmp,image/xbm,image/bmp,image/webp,image/avif max_users: unlimited authentication_provider: HTTPBasic tip_of_the_day_uri: https://partkeepr.org/tips/%s password_change: true defaultGridPresets: [] autoLoginUsername: admin autoLoginPassword: admin

afx303 commented 1 month ago

Fixed by changing line 9 in /src/Filter/AssociationPropertyTrait.php
private ?string $association = NULL;