Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue reading documents from Google Drive with English (United Kingdom) language #1939

Open
joshbrw opened this issue Sep 29, 2020 · 0 comments

Comments

@joshbrw
Copy link

joshbrw commented Sep 29, 2020

Describe the Bug

When exporting a file out of Google Drive with the language set as English (United Kingdom), PHPWord cannot read the document and throws an error.

Steps to Reproduce

  1. Create a file in Google Docs.
  2. Set the Language to English (United Kingdom) (Under File > Language)
  3. Use the following code to read the Doc and convert it to HTML:
<?php

require __DIR__ . '/vendor/autoload.php';

$phpWord = PhpOffice\PhpWord\IOFactory::load($_FILES['file']['tmp_name']);
$htmlWriter = new PhpOffice\PhpWord\Writer\HTML($phpWord);
$tempName = tempnam("/tmp", '');
$htmlWriter->save($tempName);

Expected Behavior

The document is correctly written as HTML.

Current Behavior

An InvalidArgumentException is thrown, with the message en_GB is not a valid language code.

Context

Please fill in your environment information:

  • PHP Version: 7.2.25
  • PHPWord Version: 0.17.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant