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

1.5 => simplexml_load_file() expects parameter 1 to be a valid path, object given #535

Closed
picks44 opened this issue Mar 18, 2020 · 8 comments · Fixed by #536
Closed

1.5 => simplexml_load_file() expects parameter 1 to be a valid path, object given #535

picks44 opened this issue Mar 18, 2020 · 8 comments · Fixed by #536

Comments

@picks44
Copy link

picks44 commented Mar 18, 2020

Q A
Bundle version 1.5
Symfony version 3.4.38
PHP version 7.2

Here is the output I get when using the command

C:\laragon\bin\php\php-7.2.16-Win32-VC15-x64\php.exe C:\laragon\www\DESiwid\bin\console translation:extract cs_CZ --config=iwid --output-format=xliff
Extracting Translations for locale cs_CZ
Keep old translations: No
Output-Path: C:\laragon\www\DESiwid\app/../src/Des/IwidBundle/Resources/translat
ions
Directories: C:/laragon/www/DESiwid/app/../src/Des/IwidBundle, C:/laragon/www/DE
Siwid/app/Resources/TwigBundle
Excluded Directories: cache, data, logs, Api, Test, Tests
Excluded Names: # none #
Output-Format: xliff
Custom Extractors: jms_i18n_routing
============================================================
Loading catalogues from "C:\laragon\www\DESiwid\app/../src/Des/IwidBundle/Resour
ces/translations"
15:26:24 ERROR     [console] Error thrown while running command "translation:ext
ract cs_CZ --config=iwid --output-format=xliff". Message: "simplexml_load_file()
 expects parameter 1 to be a valid path, object given" ["exception" => TypeError
 { …},"command" => "translation:extract cs_CZ --config=iwid --output-format=xlif
f","message" => "simplexml_load_file() expects parameter 1 to be a valid path, o
bject given"]

In XliffLoader.php line 40:
                                                                               
  Type error: simplexml_load_file() expects parameter 1 to be a valid path, o  
  bject given                                                                  
                                                                               

translation:extract [--enable-extractor ENABLE-EXTRACTOR] [--disable-extractor D
ISABLE-EXTRACTOR] [-c|--config CONFIG] [-b|--bundle BUNDLE] [--exclude-name EXCL
UDE-NAME] [--exclude-dir EXCLUDE-DIR] [-i|--ignore-domain IGNORE-DOMAIN] [--doma
in DOMAIN] [-d|--dir DIR] [--output-dir OUTPUT-DIR] [--dry-run] [--output-format
 OUTPUT-FORMAT] [--default-output-format DEFAULT-OUTPUT-FORMAT] [--keep] [--exte
rnal-translations-dir EXTERNAL-TRANSLATIONS-DIR] [-h|--help] [-q|--quiet] [-v|vv
|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--
env ENV] [--no-debug] [--] <command> [<locales>]...


Process finished with exit code 255.

It was working file with 1.4.4, please support.

@goetas
Copy link
Collaborator

goetas commented Mar 18, 2020

solved already in #533

@picks44
Copy link
Author

picks44 commented Mar 19, 2020

Cool @goetas thanks, is it already available in a release or shall I wait to upgrade the package?

@goetas
Copy link
Collaborator

goetas commented Mar 19, 2020 via email

@picks44
Copy link
Author

picks44 commented Mar 19, 2020

OK, now I have this error on the same command (with package updated to 1.5.1). Any clue @goetas ?

08:19:49 ERROR     [console] Error thrown while running command "translation:ext
ract en --config=iwid --output-format=xliff". Message: "hash() expects parameter
 2 to be string, integer given" ["exception" => TypeError { …},"command" => "tra
nslation:extract en --config=iwid --output-format=xliff","message" => "hash() ex
pects parameter 2 to be string, integer given"]

@goetas
Copy link
Collaborator

goetas commented Mar 19, 2020 via email

@picks44
Copy link
Author

picks44 commented Mar 19, 2020

@goetas The closest TK that I have that looks like an integer is "615 xxx xxx x"... it is a placeholder in a form.

@franmomu
Copy link
Contributor

can you please try to add a string casting in the second parameter of the hash function? in https://github.com/schmittjoh/JMSTranslationBundle/blob/master/Translation/Dumper/XliffDumper.php#L121, like this:

$unit->setAttribute('id', hash('sha1', (string) $id));

And see if there are more errors please?

@picks44
Copy link
Author

picks44 commented Mar 20, 2020

Tested and validated, thanks guys!

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 a pull request may close this issue.

3 participants