Fix listing export columns for multiple directories - #3002
Closed
the-sohan wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
What kind of change does this PR introduce?
Description
Listing exports containing listings from multiple directory types could omit fields or place values under the wrong columns. The exporter previously selected one row with the greatest field count as the column model; rows from other directory types can have different keys even when they contain the same number of fields.
This change builds an ordered union of the column keys present in every exported row, then aligns each row to that complete column set. Missing values remain empty, and
array_key_exists()preserves columns whose value is explicitlynull.How to reproduce the issue or test the changes:
Local verification:
php -l includes/classes/class-listings-export.phpvendor/bin/phpcs --standard=phpcs.xml includes/classes/class-listings-export.phpphp -rregression scenario covering equal-length rows with different directory-specific keysgit diff --check origin/development...HEADNotes:
PHPCS Checkworkflow cannot check out this fork-based PR because it runs onpull_request_targetandactions/checkoutrejects fork code unlessallow-unsafe-pr-checkoutis enabled. The same PHPCS command passes locally.Any linked issues
Checklist
Files changed
includes/classes/class-listings-export.php— Build the export schema from all listing rows and align every row to the complete set of columns.