Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When selecting the Processor Term you are faced with a bug where $this->feedType->id() is empty but not checked in the previous "if" statement
Proposed resolution
Adding another validation check
Remaining tasks
User interface changes
API changes
Data model changes
Original report by generalconsensus
Comment | File | Size | Author |
---|---|---|---|
#9 | feeds8-feed-type-missing-2721947-9.patch | 2.46 KB | twistor |
| |||
#7 | interdiff-2721947-5-7.txt | 1.65 KB | MegaChriz |
#7 | feeds8-feed-type-missing-2721947-7.patch | 1.57 KB | MegaChriz |
#5 | feeds8-feed-type-missing-2721947-5.patch | 1.33 KB | MegaChriz |
#3 | term_processor_bug.gif | 1.36 MB | generalconsensus |
Comments
Comment #2
generalconsensus CreditAttribution: generalconsensus at Forum One commentedComment #3
generalconsensus CreditAttribution: generalconsensus at Forum One commentedComment #4
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedI think the bug is that
$this->feedType
is not set. \Drupal\feeds\Feeds\Processor\EntityProcessorBase derives from \Drupal\feeds\Plugin\Type\PluginBase, which contains a property called "feedType". In the constructor method of that class, that property is set:It would be probably be useful to throw an exception if
$configuration['feed_type']
is not an instance of \Drupal\feeds\Entity\FeedType.Comment #5
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedThis patch adds throwing an exception when a Feeds plugin is constructed without
$configuration['feed_type']
being set.Let's see what breaks.
Comment #7
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedAlright, in some cases an object is passed that seem to derive from \Drupal\feeds\FeedTypeInterface. So let's check for that instead. Also, if an object is passed, but it is not of the right type, tell what its class is.
Comment #9
twistor CreditAttribution: twistor as a volunteer commentedThis should probably be an assert().
That said, still need to find the bug.
Comment #10
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI'm not sure if
assert()
should be used here. I think the code behaves unpredictable when$configuration['feed_type']
is not an instance ofDrupal\feeds\FeedTypeInterface
.From php.net/assert:
In this case it's about an input parameter check?
Comment #11
twistor CreditAttribution: twistor as a volunteer commentedThis doesn't make any sense. Asserts are almost exclusively used as input parameter checks. The difference, as I understand it, is that they should not be used for runtime checks. This isn't a runtime check, but a development/code issue.
Anyway, I'm not concerned, for two reasons.
Either way, none of this is addressing the bug.
Comment #13
twistor CreditAttribution: twistor as a volunteer commentedThis was because of a change in the plugin bag crap.
We should rip that out, but that's a separate issue.