-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Test case:
public function testWithBind(PDO $pdo)
{
$stmt = $pdo->prepare('SELECT email, adaid FROM ada WHERE adaid = :adaid');
$stmt->bindValue('adaid', 1);
$stmt->execute();
$all = $stmt->fetch(PDO::FETCH_ASSOC);
assertType('array{email: string, adaid: int<-32768, 32767>}|false', $all);
}
-'array{email: string, adaid: int<-32768, 32767>}|false'
+'mixed'
I've roughly boiled it down to PdoMysqlQueryReflector
not accepting parameters into simulateQuery
which means the query just throws on unbound parameters. Even though this PDOException gets cached, it never gets reported anywhere, so I didn't even know if this was an issue with the PDO calls not being discovered or not.
PdoStatementExecuteMethodRule
does try to find and resolve the bind parameters, so I wonder if this should actually attach the type to the statement somehow, so that fetch
calls didn't need to simulate the query again.
This also means PdoPrepareDynamicReturnTypeExtension
tries to simulate the query with placeholders and gets PDOException due to unbound parameters.
Mildly related to #275.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working