Fix CsvView state reset and 5.x cs-stan setup#147
Merged
Conversation
- Convert the per-render static `$csv` / `$fp` locals in `_renderRow` / `_generateRow` to instance properties and reset them (including `isFirstBom`) at the start of every `_serialize()` call. This makes the same view instance safely reusable across renders (queue workers, multi-file exports) where the BOM was previously emitted only once and the temp stream carried stale state between renders. - Drop the awkward `_resetStaticVariables` flag and the trailing `_renderRow()` reset call in `_serialize()`. - Close the temp stream in `__destruct()` and via the explicit `resetState()` helper. - Route all extract paths through `Hash::get()`. Previously simple (non-dotted) keys went through `$_data[$path]` and raised an undefined-key warning when the key was missing in some rows; dotted paths already returned null via Hash::get. - Throw a clear `CakeException` when an extract path resolves to an array or non-Stringable object instead of silently producing "Array to string conversion" notices and corrupted output. Adds regression tests for: repeat render with BOM on the same instance, simple extract path with missing key, and array-valued extract path producing a helpful error.
This was referenced May 11, 2026
ADmad
reviewed
May 11, 2026
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.
Summary
5.xphpcs.xmlso the current cs-stan workflow resolves all referenced sniffsNotes
5.xdirectly so the branch is green with the current CI toolchain