phpDocumentor / phpDocumentor/ReflectionDocBlock

Referring a global variable with @see $varname in a docblock causes

Open
#335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
9.4k
Forks
137
Avg merge
4d 2h
Merged PRs (30d)
1

Description

Let's say I have the following PHP Code

/**
 * This is a global var.
 *
 * @see $varname
 */
$varname = "test";

/**
 * This is a class
 *
 * @see $varname
 */
class Base
{
}

When I try to parse it

$factory  = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
$docblock = $factory->create($docComment);

Ir crashes the PHP engine in version 8.0.6 and 8.1.6.

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 by reproducing the crash with the supplied docblocks and the DocBlockFactory::createInstance() and create($docComment) calls on PHP 8.0.6 or 8.1.6. Trace how the @see $varname reference is parsed, and consider the issue resolved when parsing these examples no longer crashes the PHP engine.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.