Skip to content

vsprintf(): Too few arguments #296

Closed
@rajnishmishra20

Description

@rajnishmishra20

Describe the bug
Exception occurs when using eagerLoadRelation on Model with Cachable trait.

Eloquent Query

$parents = Category::where('category_id', Category::encodeUuid($uuid))->with('word')->with('posts')->withCount('posts')->get();

Stack Trace
vsprintf(): Too few arguments

protected function getInAndNotInClauses(array $where) : string
{
    if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) {
        return "";
    }

    $type = strtolower($where["type"]);
    $subquery = $this->getValuesFromWhere($where);
    $values = collect($this->query->bindings["where"][$this->currentBinding] ?? []);
    $this->currentBinding += count($where["values"]);
    $subquery = collect(**vsprintf**(str_replace("?", "%s", $subquery), $values->toArray()));
    $values = $this->recursiveImplode($subquery->toArray(), "_");

    return "-{$where["column"]}_{$type}{$values}";
}

Environment

  • PHP: [ 7.3.0]
  • OS: [ Ubuntu 18.04]
  • Laravel: [e.g. 5.8.]
  • Model Caching: [ 0.7] (*)

Model uses \Ramsey\Uuid\Uuid for primary keys

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions