Was caught PhanTypeExpectedObjectPropAccess critical error by Phan tool in 1224 line of taxonomy_menu/taxonomy_menu.module "Expected an object instance when accessing an instance property, but saw an expression $t with type non-empty-array".
if (i18n_taxonomy_vocabulary_mode($t->vid, I18N_MODE_LOCALIZE)) {
During investigation I found out, that in fact variable $t is a result of _taxonomy_menu_get_item() (in taxonomy_menu.database.inc), which returns stdClass object or false on failure instead array.
function _taxonomy_menu_get_item($mlid) {
$result = db_select('taxonomy_menu', 'tm')
->condition('mlid', $mlid, '=')
->fields('tm', array('tid', 'vid'))
->execute();
return $result->fetch();
} Variable $result is object of DatabaseStatementBase class("\drupal\includes\database\database.inc"), which set PDO::FETCH_OBJ through constructor
protected function __construct($dbh) {
$this->dbh = $dbh;
$this->setFetchMode(PDO::FETCH_OBJ);
}So, I suggest to change returned type of varible for _taxonomy_menu_get_item().
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | taxonomy_menu-3281330-php8-compability.patch | 480 bytes | alena_stanul |
Comments
Comment #2
alena_stanul commentedComment #3
liam morlandComment #4
alena_stanul commentedComment #5
hargobindThank you @alena_stanul for your deep analysis of this.
Although this issue is more about documentation of code, rather than the code itself, it's still helpful to get things right.
I looked into this by following your logic, and the patch in #2 checks out.
Comment #6
damienmckennaComment #8
damienmckennaCommitted. Thank you.