Skip to content

pr: [Nightly Fix] - Bug - Fix Row ID Column Fallback#3

Open
jewel-claw wants to merge 1 commit intomasterfrom
nightly-fix/row-id-column-lookup
Open

pr: [Nightly Fix] - Bug - Fix Row ID Column Fallback#3
jewel-claw wants to merge 1 commit intomasterfrom
nightly-fix/row-id-column-lookup

Conversation

@jewel-claw
Copy link

What

  • fix the ninja_table_cell shortcode fallback path when a cell is requested by row_id

Why

  • the code correctly checks the numeric fallback array, but then still reads from the original keyed array
  • numeric column requests can therefore return an empty value or trigger undefined index notices even when the fallback data exists

Fix

  • use the resolved numeric fallback value from array_values($data) when the named column lookup misses

Confidence

  • linted app/Hooks/Handlers/PublicDataHandler.php with php -l

@greptile-apps
Copy link

greptile-apps bot commented Mar 10, 2026

PR author is not in the allowed authors list.

@qodo-code-review
Copy link

Review Summary by Qodo

Fix Row ID Column Fallback Lookup in Cell Shortcode

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix row ID column fallback to use numeric index instead of named key
• Prevents undefined index notices and empty values on numeric column requests
• Uses resolved fallback array value from array_values($data) for consistency
Diagram
flowchart LR
  A["Column Lookup Request"] --> B{"Named Column Found?"}
  B -->|Yes| C["Return Named Column Value"]
  B -->|No| D["Create Numeric Fallback Array"]
  D --> E["Check Numeric Index"]
  E -->|Found| F["Return Numeric Index Value"]
  E -->|Not Found| G["Return Empty"]
Loading

Grey Divider

File Changes

1. app/Hooks/Handlers/PublicDataHandler.php 🐞 Bug fix +1/-1

Use numeric fallback array for column lookup

• Changed line 193 to use $dataArray[$column] instead of $data[$column]
• Ensures numeric column requests use the fallback array created via array_values($data)
• Prevents undefined index notices and empty values when accessing columns by numeric index

app/Hooks/Handlers/PublicDataHandler.php


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 10, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@kilo-code-bot
Copy link

kilo-code-bot bot commented Mar 10, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This is a correct bug fix that ensures consistency between the array key check and value retrieval.

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0

Analysis

The fix in app/Hooks/Handlers/PublicDataHandler.php corrects an inconsistency:

  1. The code creates a numerically indexed array: $dataArray = array_values($data)
  2. Then checks if the column exists: isset($dataArray[$column])
  3. But was retrieving from the wrong array: $data[$column] (old code)
  4. Now correctly retrieves from: $dataArray[$column] (fixed code)

This bug would cause issues when accessing table cells by numeric column index if the original $data array had non-sequential or non-numeric keys. The check would pass but the retrieval would fail, resulting in empty values or undefined index notices.

Files Reviewed (1 file)
  • app/Hooks/Handlers/PublicDataHandler.php - Correct bug fix

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 this pull request may close these issues.

1 participant