Skip to content

ReferenceContext::reduceDots shows Undefined array key 7 error when .. repeatedly appeared in path #94

@yamayuski

Description

@yamayuski

Thank you for the great library.

I found to occur ErrorException when .. repeatedly appeared in path at ReferenceContext::reduceDots. PHP 8.0.0.

ErrorException {#587 #message: "Undefined array key 7" #code: 0 #file: "./vendor/cebe/php-openapi/src/ReferenceContext.php" #line: 123 #severity: E_WARNING trace: { ./vendor/cebe/php-openapi/src/ReferenceContext.php:123 { …} ./vendor/cebe/php-openapi/src/ReferenceContext.php:195 { …} ./vendor/cebe/php-openapi/src/spec/Reference.php:307 { …} ./vendor/cebe/php-openapi/src/spec/Reference.php:315 { …} ./vendor/cebe/php-openapi/src/spec/Reference.php:315 { …} ./vendor/cebe/php-openapi/src/spec/Reference.php:315 { …} ./vendor/cebe/php-openapi/src/spec/Reference.php:229 { …} ./vendor/cebe/php-openapi/src/spec/PathItem.php:156 { …} ./vendor/cebe/php-openapi/src/spec/Paths.php:254 { …} ./vendor/cebe/php-openapi/src/SpecBaseObject.php:387 { …} ./vendor/cebe/php-openapi/src/Reader.php:134 { …} ... $path = /var/www/app/contracts/api/paths/account/../../../responses/InternalServerError.yml $parts = array:10 [ 0 => "var" 1 => "www" 2 => "app" 3 => "contracts" 4 => "api" 5 => "paths" 8 => ".." 9 => ".." 10 => "responses" 11 => "InternalServerError.yml" ] 
# /var/www/app/contracts/api/openapi.yml openapi: 3.0.3 paths: /account/create: $ref: 'paths/account/createPaths.yml'
# /var/www/app/contracts/api/paths/account/createPaths.yml post: requestBody: $ref: createRequest.yml responses: default: $ref: '../../../responses/InternalServerError.yml' '200': $ref: createResponse.yml
# /var/www/app/contracts/responses/InternalServerError.yml content: application/json: schema: type: object properties: error: type: string

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions