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

Image->iptc('attribute') returns Image instead of null #643

Closed
Swanty opened this issue Nov 30, 2016 · 1 comment
Closed

Image->iptc('attribute') returns Image instead of null #643

Swanty opened this issue Nov 30, 2016 · 1 comment

Comments

@Swanty
Copy link

Swanty commented Nov 30, 2016

The problem is here:
https://github.com/Intervention/image/blob/2.3.8/src/Intervention/Image/Image.php#L107

IPTC tests don't catch it since, they're using IptcCommand directly:
https://github.com/Intervention/image/blob/2.3.8/tests/IptcCommandTest.php

In normal usage developers would use Image->iptc('attribute') as it is described in the documentation here:
http://image.intervention.io/api/iptc

To reproduce this, just try to get an iptc attribute that is not set inside the image.
IptcCommand will set output to null, but Image __call will return Image object

@olivervogel
Copy link
Member

olivervogel commented Feb 23, 2017

Can't reproduce the described bug.

  1. The IptcCommand sets the output to false if the attribute is not found.
  2. __call will check if command hasOutput, in this case false is output, so hasOutput will return true.
  3. $command->getOutput() is returned, which will resolve to null in this case.

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

No branches or pull requests

2 participants