schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
427 stars 291 forks source link

strtolower() expects parameter 1 to be string, object given #544

Closed TheRatG closed 4 years ago

TheRatG commented 4 years ago
Q A
Bundle version 1.5.4
Symfony version 4.4
PHP version 7.3

Actual behavior

  "exception" => TypeError {
    #message: "strtolower() expects parameter 1 to be string, object given"
    #code: 0
    #file: "./vendor/jms/translation-bundle/Translation/Extractor/File/FormExtractor.php"
    #line: 357
    trace: {
      ./vendor/jms/translation-bundle/Translation/Extractor/File/FormExtractor.php:357 { …}
      ./vendor/jms/translation-bundle/Translation/Extractor/File/FormExtractor.php:111 { …}
      ./vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:123 { …}
      ./vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:146 { …}

Steps to reproduce

Form

translation:extract en -vvv

How to fix

Add string convert

if (!isset($returningMethods[strtolower((string)$var->name)])) {
goetas commented 4 years ago

Hi, indeed that seems the right fix. Can you make a pull request for it? (editing https://github.com/schmittjoh/JMSTranslationBundle/blob/b15adee3fb0af5766d2e69a2d6f12beb3fbd901b/Translation/Extractor/File/FormExtractor.php#L295 ?)

TheRatG commented 4 years ago

Hi, indeed that seems the right fix. Can you make a pull request for it? (editing

https://github.com/schmittjoh/JMSTranslationBundle/pull/545

goetas commented 4 years ago

Solved in https://github.com/schmittjoh/JMSTranslationBundle/pull/545