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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thekevinday’s picture

Try this again.
I left an accidental test conversion (int) that made this patch work when it shouldn't.

thekevinday’s picture

Casting 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.