Error:
The website encountered an unexpected error. Please try again later. [PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "as" LINE 5: WHERE (base.nid IN ('as')) ^: ..... (line 191 of/var/www/html/drupal/includes/entity.inc).]
Solution:
Drupal throws PDO exception error like above while giving url patterns like,
The website encountered an unexpected error. Please try again later. [PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "as" LINE 5: WHERE (base.nid IN ('as')) ^: ..... (line 191 of/var/www/html/drupal/includes/entity.inc).]
Solution:
Drupal throws PDO exception error like above while giving url patterns like,
localhost/drupal/node/abcThis because of invalid input for select query while it is expecting integer. This is core level bug and the wrong input needs to be filtered in entity.inc of core module.
localhost/drupal/node/1.
localhost/drupal/node/1.23
localhost/drupal/node/<any special characters like *&^%$#@!>
//add the below lines inside function load() in entity.inc.
//Patch to avoid non numeric node id's which causes pdo exceptions
if (is_array($ids)) {
// Remove all non numeric ids.
$ids = array_filter($ids, function($x){
return preg_match('/^[0-9]+$/', $x);
});
}
No comments:
Post a Comment