couchbase / couchbase/couchbase-php-client

Erroneous options validation in viewQuery (skip)

Open Beginner friendly
#254 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
7
Forks
13
Avg merge
6d 10m
Merged PRs (30d)
2

Description

When using viewQuery, adding a skip value in ViewOptions, an error is raised:

'invalid_argument (3): "expected skip to be a boolean value in the options"'

When looking for the cause, found this:
connection_handle.cxx#2772

  if (auto e = cb_assign_boolean(request.skip, options, "skip"); e.ec) {
    return e;
  }

While all methods and documentation clearly indicates that the expected type of the value for ViewOptions->skip must be integer, here it's validated as a boolean. It should rightfully be as follows:

  if (auto e = cb_assign_integer(request.skip, options, "skip"); e.ec) {
    return e;
  }

This solution has been implemented and built locally and confirmed working as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/wrapper/connection_handle.cxx around line 2772 and inspect the viewQuery option handling alongside the ViewOptions documentation and related methods. Verify that a numeric skip value is accepted, the boolean error is gone, and the project still builds with the relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, php
Domain
databases
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.