phpDocumentor / phpDocumentor/guides

[Bug]: An empty csv-table is accepted silently while an empty list-table and table warn

Open
#1,396 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
36
Forks
22
Avg merge
2d 2h
Merged PRs (30d)
24

Description

Summary

An empty csv-table directive is accepted silently: it produces a TableNode with no header row and no data row, which renders as <table><tbody></tbody></table>, and nothing is logged — not even with --log-path.

Its two siblings do warn about exactly this. Given the three empty directives below, list-table and table each log a warning and csv-table does not, and the one empty <table> in the output is the one csv-table produced:

app.WARNING: The list-table directive is missing its content. It has to contain exactly one list with sub-lists of equal count.  {"rst-file":"index.rst","currentLineNumber":8}
app.WARNING: The table directive may contain exactly one table. 0 children found {"rst-file":"index.rst","currentLineNumber":10}

docutils reports the same input as (WARNING/2) The "csv-table" directive requires content; none supplied. (docutils 0.22.3), so the expectation is not new.

Measured with a pristine install, no theme and no extensions: phpdocumentor/guides 1.10.1, phpdocumentor/guides-cli 1.9.6, phpdocumentor/guides-restructured-text 1.10.1, PHP 8.5.10.

This also reaches consumers that render TableNode themselves. In the TYPO3 documentation renderer a cell-less table crashed the Markdown output (TYPO3-Documentation/render-guides#1435); that is our defect and it is fixed on our side, but the node it choked on came from here, and no warning pointed at the source line.

Code snippet that reproduces the problem

index.rst:

========
Variants
========

..  csv-table::

..  list-table::

..  table::

After.

guides.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<guides xmlns="https://www.phpdoc.org/guides" links-are-relative="true"/>
vendor/bin/guides . --output=out --log-path=logs

out/index.html contains one table, and it is the csv-table:

<table>
    <tbody>
</tbody>
</table>
Expected output

A warning naming the file and the line, in the shape the sibling directives already use — for example "The csv-table directive is missing its content. It has to contain CSV data, or a :file: or :url: option." Whether the empty table node is still emitted afterwards matters less than the author being told; emitting no node at all would also spare every renderer the degenerate case.

Assisted by claude-code:claude-opus-5 — Session

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

Reproduce the issue with the shown index.rst and guides.xml using vendor/bin/guides . --output=out --log-path=logs. Locate the csv-table directive entry point and compare its empty-content handling with the list-table and table directives. Done means empty csv-table input reports a warning naming the source line and no longer silently produces an unannounced degenerate table.

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
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.