robbiepaul / cloudconvert-laravel

A Laravel wrapper for the CloudConvert API
177 stars 34 forks source link

Call to a member function getFormat() on null, after a commit from 20. June 2016 #36

Closed rgozdzialski closed 8 years ago

rgozdzialski commented 8 years ago

Hi,

We've been having problems with conversionTypes() method. We used it like this:

$types = CloudConvert::input('jpg')->conversionTypes();

and it worked fine. After composer update we get a fatal error. Basically, CloudConvert->getOutputFormat() suddenly fails.

Took us a while to understand what is going on, because for some of the team members the code worked, for others - not. Turned out that some of us had newer version of your package and for those the fatal error occurred.

Anyway, seems like it all comes down to the change, where this line

return isset($this->output) ? $this->getOutput()->getFormat() : $this->output_format;

changed to this one:

return !isset($this->output_format) ? $this->getOutput()->getFormat() : $this->output_format;

It's hard at this point to be more specific, but hopefully it's enough for you to take a look at possible problems.

robbiepaul commented 8 years ago

Thanks for reporting this, I'll have a look in to it

robbiepaul commented 8 years ago

I've reverted this back to it's original function in v2.3