Commit d4e089e
Fix critical bugs found in pre-1.0.0 audit (#14)
* Fix critical bugs found in pre-1.0.0 audit
This commit fixes three bugs discovered during comprehensive codebase audit:
**BUG-001 (CRITICAL): Fix inverted logic in DataTransformer configuration**
- Location: FileStorageBehavior.php:404
- Problem: Custom DataTransformer from config was never used due to inverted condition
- Fix: Changed `if (!$this->getConfig('dataTransformer') instanceof ...)` to positive check
- Impact: Custom transformers can now be properly configured via behavior config
**BUG-002 (MEDIUM): Remove commented-out code**
- Location: FileStorageBehavior.php:216,220
- Problem: Two commented lines with no explanation
- Fix: Removed commented event manager toggles, added explanatory comment
- Impact: Clearer code intent, reduced maintenance confusion
**BUG-003 (MEDIUM): Fix data corruption in variant getters**
- Location: FileStorage.php:68,90
- Problem: array_shift() modified entity data as side effect in getter methods
- Fix: Use reset() instead to read first element without array modification
- Impact: Prevents progressive data corruption when getters called multiple times
All tests passing (42 tests, 146 assertions)
PHPStan Level 8 passing
See BUG_AUDIT_REPORT.md for complete audit details
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Delete BUG_AUDIT_REPORT.md
---------
Co-authored-by: Claude <[email protected]>1 parent 0e7f1b3 commit d4e089e
File tree
2 files changed
+16
-7
lines changed- src/Model
- Behavior
- Entity
2 files changed
+16
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | 220 | | |
222 | 221 | | |
223 | 222 | | |
| |||
401 | 400 | | |
402 | 401 | | |
403 | 402 | | |
404 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
91 | 99 | | |
92 | 100 | | |
93 | 101 | | |
| |||
0 commit comments