You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Join::join() raises TypeError instead of InvalidArgumentException for an invalid name without a leading string #206
Join::join() rejects a name array that is not a single-element associative array, and passes the array's first element into the message (Join.php#L97):
forInvalidJoinName() takes a string (InvalidArgumentException.php#L134). When the first element is not a string (an empty array, an unaliased Select, an integer), building the exception raises a TypeError first.
This came in with #192, which replaced sprintf(...) (which accepted any type) with the typed named constructor. #192 notes that the same unsoundness was re-attributed to forInvalidJoinName in the analyzer baseline.
Steps to Reproduce
(new Join())->join([], 'a = b')
(new Join())->join([new Select('foo')], 'a = b')
(new Join())->join([5], 'a = b')
Expected Behavior
PhpDb\Sql\Exception\InvalidArgumentException. Where the element is not a string, the message names its type, e.g. join() expects 'int' as a single element associative array.
Actual behavior?
TypeError: PhpDb\Sql\Exception\InvalidArgumentException::forInvalidJoinName(): Argument #1 ($name) must be of type string, null given, called in src/Sql/Join.php on line 115
Activity