Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error handling if the header is empty #547

Open
spuglisi opened this issue Oct 4, 2017 · 13 comments
Open

Better error handling if the header is empty #547

spuglisi opened this issue Oct 4, 2017 · 13 comments

Comments

@spuglisi
Copy link

spuglisi commented Oct 4, 2017

simplepie throws an exception at SimplePie.php line 1648 if the server does not return a header, and there are those servers:

Beschreibung: Illegal string offset 'content-type'
Fehlernummer: 2
File: .../simplepie/simplepie/library/SimplePie.php
Line: 1648

So maybe a better error handling would be more useful?

@Art4
Copy link
Contributor

Art4 commented Jan 24, 2023

@spuglisi Is this still a problem in version 1.8.0 or can we close this issue?

@arondeparon
Copy link

arondeparon commented Jun 8, 2023

@Art4 I can confirm this is still an issue. I am seeing this a lot on an application I am working on.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 8, 2023

@arondeparon could you share a fresh error trace and a version of SimplePie you are using?

@arondeparon
Copy link

arondeparon commented Jun 8, 2023

@jtojnar sure. I am using SimplePie 1.8.0 (with a simple wrapper around it that adds no additional functionality).

This trace is from 2 minutes ago:

ErrorException: Undefined array key "content-type"
#31 /vendor/simplepie/simplepie/src/SimplePie.php(1836): Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
#30 /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}
#29 /vendor/simplepie/simplepie/src/SimplePie.php(1836): SimplePie\SimplePie::fetch_data
#28 /vendor/simplepie/simplepie/src/SimplePie.php(1591): SimplePie\SimplePie::init
#27 /vendor/willvincent/feeds/src/FeedsFactory.php(84): willvincent\Feeds\FeedsFactory::make
#26 /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(353): Illuminate\Support\Facades\Facade::__callStatic
#25 /app/Actions/GetLatestArticles.php(44): App\Actions\GetLatestArticles::execute
#24 /vendor/spatie/laravel-queueable-action/src/ActionJob.php(92): Spatie\QueueableAction\ActionJob::handle
#23 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}
#22 /vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\Util::unwrapIfClosure
#21 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\BoundMethod::callBoundMethod
#20 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::call
#19 /vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\Container::call
#18 /vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Bus\Dispatcher::Illuminate\Bus\{closure}
#17 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#16 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline::then
#15 /vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Bus\Dispatcher::dispatchNow
#14 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\Queue\CallQueuedHandler::Illuminate\Queue\{closure}
#13 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#12 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline::then
#11 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Queue\CallQueuedHandler::dispatchThroughMiddleware
#10 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler::call
#9 /vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\Jobs\Job::fire
#8 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\Queue\Worker::process
#7 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\Queue\Worker::runJob
#6 /vendor/bref/laravel-bridge/src/Queue/Worker.php(39): Bref\LaravelBridge\Queue\Worker::runSqsJob
#5 /vendor/bref/laravel-bridge/src/Queue/QueueHandler.php(88): Bref\LaravelBridge\Queue\QueueHandler::handleSqs
#4 /vendor/bref/bref/src/Event/Sqs/SqsHandler.php(24): Bref\Event\Sqs\SqsHandler::handle
#3 /vendor/bref/bref/src/Runtime/Invoker.php(24): Bref\Runtime\Invoker::invoke
#2 /vendor/bref/bref/src/Runtime/LambdaRuntime.php(89): Bref\Runtime\LambdaRuntime::processNextEvent
#1 /vendor/bref/bref/src/FunctionRuntime/Main.php(37): Bref\FunctionRuntime\Main::run
#0 /opt/bref/bootstrap.php(17): null

This specific trace is caused by a lookup to https://gpt4all.io, which does not seem to return a content-type header.

I do realize that the mentioned site is not a valid feed. I am not adding it myself. This error is the result of a user operation in my application. Regardless, this error should probably be handled :)

@jtojnar
Copy link
Contributor

jtojnar commented Jun 8, 2023

Thanks this is the line:

https://github.com/simplepie/simplepie/blob/1.8.0/src/SimplePie.php#L1836

It has been fixed in master (upcoming version 1.9.0):

$copyContentType = $file->get_header_line('content-type');

@arondeparon
Copy link

arondeparon commented Jun 9, 2023

Thanks! Looking forward to 1.9 :) Is there a timeline for this release?

@jtojnar
Copy link
Contributor

jtojnar commented Jun 9, 2023

@arondeparon we have a roadmap #731 but no timeline, it might make sense to fix this in 1.8.1, though.

@arondeparon
Copy link

arondeparon commented Jun 9, 2023

@jtojnar thanks for sharing the roadmap! If it would be possible to release this in a minor release, that would definitely be great! If it can't be done (time is sparse after all) I think I will create a temporary fork to resolve this, because my Sentry dashboard is filling up rapidly 😅

@arondeparon
Copy link

arondeparon commented Jun 30, 2023

Is there any chance a patch release can be made for this feature? I looked into creating my own fork but I'm not sure what other changes (and potential bugs) it might introduce due to other changes in this branch.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 30, 2023

@mblaney could you create the one-dot-eight branch so that we can patch it there?

@mblaney
Copy link
Member

mblaney commented Aug 6, 2023

ok there's a one-dot-eight branch if someone want to patch it

@jtojnar
Copy link
Contributor

jtojnar commented Aug 10, 2023

@mblaney Unfortunately, the branch is based on master rather than 1.8.0? Could you please run git reset --hard 1.8.0 on it and then force push?

@mblaney
Copy link
Member

mblaney commented Aug 25, 2023

@mblaney Unfortunately, the branch is based on master rather than 1.8.0? Could you please run git reset --hard 1.8.0 on it and then force push?

ah sorry about that. should be good now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants