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.
The function block_custom_block_get() accepts a bid and not a delta.
The test for if ($delta) {
is invalid because strings are valid url arguments.
If a string is passed to block_custom_block_get(), then an SQL error will occur.
This is similar in nature to: #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID.
Comment | File | Size | Author |
---|---|---|---|
#2 | drupal-7.x-dev-custom_block_is_bid_not_delta-3.patch | 556 bytes | thekevinday |
#1 | drupal-7.x-dev-custom_block_is_bid_not_delta-2.patch | 467 bytes | thekevinday |
drupal-7.x-dev-custom_block_is_bid_not_delta-1.patch | 543 bytes | thekevinday | |
Comments
Comment #1
thekevinday CreditAttribution: thekevinday commentedTry this again.
I left an accidental test conversion (int) that made this patch work when it shouldn't.
Comment #2
thekevinday CreditAttribution: thekevinday commentedCasting one to (float) and rounding the other works better and theres no need for defining a variable $d.
Now, if the bid is not found, it seems a non-array is returned, so also cast the return of block_custom_block_get to an array() to prevent other problems from happening.