Class 'PhpOffice\PhpWord\Settings' not found in app/code/core/Mage/Core/Model/Config.php on line 1348

Class 'PhpOffice\PhpWord\Settings' not found in app/code/core/Mage/Core/Model/Config.php on line 1348

August 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Class 'PhpOffice\PhpWord\Settings' not found in app/code/core/Mage/Core/Model/Config.php on line 1348

Solving PhpWord Library Errors After Upgrading to PHP 7 on Magento

Are you facing issues with your Magento store’s order printing functionality after upgrading to PHP 7? You’re not alone. Let’s dive into the two main errors you’ve encountered and provide practical solutions.

Error 1: Cannot use PhpOffice\PhpWord\Shared\String as String

This error occurs because the String class is a reserved keyword in PHP, which conflicts with the namespace used by the PhpOffice/PhpWord library. To resolve this:

  1. Open the file /vendor/phpoffice/phpword/src/PhpWord/Style/Paragraph.php.
  2. Find the line where use String is defined.
  3. Change it to use PhpOffice\PhpWord\Shared\String as WrappedString.

This rename will prevent the conflict with PHP’s built-in String class.

Error 2: Class ‘PhpOffice\PhpWord\Settings’ not found

This fatal error occurs because the Magento core is trying to use the old PhpOffice/PhpWord version that doesn’t have a Settings class. Here’s how to fix it:

  1. Update your PHP libraries: Make sure you’re using the latest versions of both PhpOffice/PhpWord and PhpOffice/Common. You can update them via composer by running:

    composer require phpoffice/phpword:latest
    composer require phpoffice/common:latest
    
  2. Clear Magento cache: After updating, clear your Magento cache to ensure the new library versions are loaded properly.

  3. Check for conflicting packages: If the error persists, it might be due to a conflicting package in your composer.json file. Open this file and look for any other libraries that might interfere with PhpOffice/PhpWord. Ensure they are compatible with PHP 7.

  4. Reinstall Magento: As a last resort, if all else fails, you may need to reinstall Magento entirely. Before doing so, make sure to backup your data first. You can find detailed installation instructions on Laravel Company’s official guide.

Conclusion

Upgrading PHP versions often requires careful checking and updating of dependent libraries. In this case, you needed to update the PhpOffice/PhpWord library version and clear your Magento cache.

Remember, it’s always a good practice to test your website thoroughly after any major upgrade or update. This ensures that all functionalities work as expected without causing unexpected errors like the ones described above.

If you’re still facing issues or need further assistance with Magento development, feel free to explore our Magento services at Laravel Company for expert guidance and solutions tailored to your specific needs.

Cache Configuration Deployment Orders

Our network