Skip to content

If searching on none "id" field, the query fails #32

@attilajakab

Description

@attilajakab

Hi, I'm using version 2.5.2 since we are running on PHP 7.4.

I ran into this issue - when I do a query on a none "id" field, it fails, for example like this:

        $jsonResult = QueryBuilder::instance()
            ->setCollection($collection)
            ->select('c')
            ->where('c.email = @email')
            ->params(['@email' => '[email protected]'])
            ->setPartitionKey('id')
            ->find(TRUE)->toJson();

The error it throws is:
image

This is working in a PHP 8 codebase with version 2.6.0 if I use the same query.

In 2.5.2. it is specifically failing on this line (line 265) in CosmosDb.php:

	public function getPkRanges($rid_id, $rid_col)
	{
		$headers = $this->getAuthHeaders('GET', 'pkranges', $rid_col);
		$headers['Accept'] = 'application/json';
		$headers['x-ms-max-item-count'] = -1;
		$result = $this->request("/dbs/{$rid_id}/colls/{$rid_col}/pkranges", "GET", $headers);
		return json_decode($result);
	}

The last line return json_decode($result); should be return json_decode($result->getBody()->getContents()); (it is like that in 2.6.0 but not in 2.5.2).

Can this be fixed please in 2.5.2? Or any advice if I'm doing something wrong? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions