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.
I ran Etsy's Phan (static analyzer) on Drupal 8 and am investigating the output. It pointed out that Form API's callback_batch_operation is using $this when not in an object context.
Comment | File | Size | Author |
---|---|---|---|
#6 | core-form_api_this_not_in_context-2637254-5.patch | 598 bytes | tvlooy |
Comments
Comment #2
tvlooy CreditAttribution: tvlooy at iO commentedComment #3
tvlooy CreditAttribution: tvlooy at iO commentedps: if this is confirmed as a bug. Then this code is probably not under tests. I must admit that I'm not sure what callback_batch_operation exactly does, but if nobody is using it (nobody reported any problems before) maybe we should just delete the code instead of fixing it.
Comment #4
tvlooy CreditAttribution: tvlooy at iO commentedComment #5
JeroenTComment #6
tvlooy CreditAttribution: tvlooy at iO commentedThanks Jeroen. So it's example code, that explains a lot :-)
Nevertheless the example is wrong. I just found out that Drupal::entityManager() is deprecated so I adjusted the patch.
Comment #7
borisson_@tvlooy: *.api.php files are examples on how to use the api. Those files are not executed or tested.
The example was wrong and your patch fixes it.
Comment #8
jhodgdon+1 Thanks! @borisson, thanks for the review too.
Comment #9
alexpottCommitted d8b27e3 and pushed to 8.0.x and 8.1.x. Thanks!