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

Method convertJsonPointerIntoPropertyPath() does not exist in class JsonSchema\Constraints\BaseConstraint #654

Closed
emmanuelGuiton opened this issue Feb 11, 2021 · 0 comments · Fixed by #655

Comments

@emmanuelGuiton
Copy link
Contributor

The class JsonSchema\Constraints\BaseConstraint uses a method convertJsonPointerIntoPropertyPath() that is not defined though the class is not abstract and it does not extend any other.
See https://github.com/justinrainbow/json-schema/blob/f4f0c3457811006f861c466a10c6c24f3e92f9ae/src/JsonSchema/Constraints/BaseConstraint.php#L52

Thus, using the addError method on a JsonSchema\Validator instance throws an error :

php > require_once "target/vendor/autoload.php";
php > $validator = new JsonSchema\Validator();
php > $validator->addError(null,'An error message.');
PHP Warning:  Uncaught Error: Call to undefined method JsonSchema\Validator::convertJsonPointerIntoPropertyPath() in /home/nanu/git/rtms/libraries/core/target/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php:49
Stack trace:
#0 php shell code(1): JsonSchema\Constraints\BaseConstraint->addError()
#1 {main}
  thrown in /home/nanu/git/rtms/libraries/core/target/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php on line 49

Note that the convertJsonPointerIntoPropertyPath() method is defined in the JsonSchema\Constraints\Constraint abstract class. The latter extends JsonSchema\Constraints\BaseConstraint. Moving the method in this class solves the issue.

emmanuelGuiton pushed a commit to emmanuelGuiton/json-schema that referenced this issue Feb 11, 2021
… right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes jsonrainbow#654
Seldaek added a commit that referenced this issue Jul 22, 2021
… right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes #654 (#655)

Co-authored-by: Emmanuel GUITON <egn@intrinsec.com>
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
Seldaek added a commit to Seldaek/json-schema that referenced this issue Jul 28, 2021
… right class (JsonSchema\Constraints\Constraint instead of JsonSchema\Constraints\BaseConstraint). Closes jsonrainbow#654 (jsonrainbow#655)

Co-authored-by: Emmanuel GUITON <egn@intrinsec.com>
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
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

Successfully merging a pull request may close this issue.

1 participant