Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
attilajakab opened this issue Feb 2, 2023 · 0 comments
Open

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

attilajakab opened this issue Feb 2, 2023 · 0 comments

Comments

@attilajakab
Copy link

attilajakab commented Feb 2, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant