Skip to content

Add Contao 6 support and drop Contao 4 - #1

Closed
markocupic wants to merge 1 commit into
1.5.xfrom
contao-6-support
Closed

markocupic wants to merge 1 commit into
1.5.xfrom
contao-6-support

Conversation

@markocupic

@markocupic markocupic commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes the bundle compatible with Contao 6 while keeping Contao 5.3 support (Contao 4 is dropped). CI runs against Contao 5.3 + phpoffice/phpword 1.0 (PHP 8.2/8.3, incl. --prefer-lowest) and Contao 6.0 + phpword 1.4 (PHP 8.4/8.5).

Changes

  • contao/core-bundle: ^5.3 || ^6.0, PHP ^8.2, direct symfony/filesystem and symfony/http-kernel requirements
  • Bug fix: images in cloned rows – generate() checked $replace['replace']['type'] (a string offset of the replacement value) instead of $replace['options']['type'], so addToClone(…, ['type' => 'image']) never inserted an image. The image path is now also no longer HTML-escaped before the file check.
  • Replacement text is escaped with StringUtil::specialchars(StringUtil::decodeEntities()) (same result as before, htmlspecialchars(html_entity_decode())); text handling moved into prepareText()
  • addToClone() without a previous createClone() no longer raises an undefined index warning; the constructor no longer returns a value
  • Markocupic\PhpOffice\… is autoloaded via PSR-4 instead of a classmap (namespace unchanged)
  • README/example: fixed paths (docs/example/…) and links

Tooling

  • ECS moved from .ecs/ to tools/ecs (contao/easy-coding-standard ^6.13)
  • PHPUnit via contao/test-case, CI workflow
  • Tests generate a real document from docs/example/templates/ms_word_template.docx and check replacements, escaping, bold/multiline formatting, cloned rows and cloned images

License

The bundle is now MIT everywhere: composer.json (was LGPL-3.0+) and the file headers incl. the ECS header config (were GPL-3.0-or-later), matching the existing LICENSE file.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jb7ViNYJwLjr2Y34g8aAoK


Generated by Claude Code

- Require contao/core-bundle ^5.3 || ^6.0 and PHP ^8.2
- Fix images in cloned rows: the image check looked at the replacement
  string instead of the options, so addToClone(..., ['type' => 'image'])
  never inserted an image
- Use StringUtil::specialchars()/decodeEntities() to escape the
  replacement text and move the text handling into prepareText()
- Avoid undefined index warnings in addToClone() and drop the return
  value of the constructor
- Load the Markocupic\PhpOffice namespace via PSR-4 instead of a classmap
- Fix the example paths in the README and docs/example
- Use the MIT license everywhere (composer.json, file headers), matching
  the LICENSE file
- Move the ECS config to tools/ecs, add PHPUnit, CI and tests that
  generate a document from the example template

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jb7ViNYJwLjr2Y34g8aAoK
@markocupic markocupic closed this Oct 10, 2026
@markocupic
markocupic deleted the contao-6-support branch October 10, 2026 11:32
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