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

v3.5.0 , DocumentHandler, Undefined index: revision #269

Open
RysQ opened this issue Oct 2, 2019 · 2 comments
Open

v3.5.0 , DocumentHandler, Undefined index: revision #269

RysQ opened this issue Oct 2, 2019 · 2 comments

Comments

@RysQ
Copy link

RysQ commented Oct 2, 2019

if (isset($params[ConnectionOptions::OPTION_REPLACE_POLICY]) &&
$params[ConnectionOptions::OPTION_REPLACE_POLICY] === UpdatePolicy::ERROR
) {
if (null !== $options['revision']) {
$params['ignoreRevs'] = false;
$headers['if-match'] = '"' . $options['revision'] . '"';
}
}

Line 651 may cause "Undefined index" Notice

'revision' option may not be set in $options param of put. Docs of replace and replaceById methods doesn't mention it should be provided. Instead it points out to Document's _rev.

So please consider (accordingly to patch method), to base the condition on something like:

$revision = $document->getRevision();
if (null !== $revision) { ... 

or provide 'revision' option/param within replace or replaceById methods (ie. like it's done in remove)


The issue doesn't appears in < 3.5.0 , since in previous versions includeOptionsInParams in ArangoDBClient/Handler returns empty array when its $options param is empty.
Condition result:

if (isset($params[ConnectionOptions::OPTION_REPLACE_POLICY]) && 
    $params[ConnectionOptions::OPTION_REPLACE_POLICY] === UpdatePolicy::ERROR 
)

is always false then

jsteemann added a commit that referenced this issue Jun 9, 2021
Fix an undefined index notice/warning when calling the
DocumentHandler::put function with a `revision` option set.
@jsteemann
Copy link
Contributor

@RysQ : I am probably a bit late to the game, but there is a PR now to address this issue: #284

jsteemann added a commit that referenced this issue Jun 9, 2021
Fix an undefined index notice/warning when calling the
DocumentHandler::put function with a `revision` option set.
jsteemann added a commit that referenced this issue Jun 9, 2021
Fix an undefined index notice/warning when calling the
DocumentHandler::put function with a `revision` option set.
@jsteemann
Copy link
Contributor

Fixed via the above PR in devel and 3.8 branches.

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

2 participants