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

Expected argument of type "object, array or empty", "string" given #11909

Closed
ghost opened this issue Dec 22, 2018 · 102 comments
Closed

Expected argument of type "object, array or empty", "string" given #11909

ghost opened this issue Dec 22, 2018 · 102 comments
Assignees
Labels
1.7.5.0 Affects versions Autoupgrade Module: autoupgrade BO Category: Back Office Bug Type: Bug Fixed Resolution: issue closed because fixed Invoices Label: Which BO under menu is concerned

Comments

@ghost
Copy link

ghost commented Dec 22, 2018

Describe the bug
Error 500 when I click on the invoice item in the backend menu.

To Reproduce
Steps to reproduce the behavior:

  1. in backend
  2. Click on invoice item menu: /index.php/sell/orders/invoices/

Screenshots

Stack Trace:
Symfony\Component\Form\Exception\UnexpectedTypeException:
Expected argument of type "object, array or empty", "string" given

  at vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:41
  at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms('', object(RecursiveIteratorIterator))
     (vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:379)
  at Symfony\Component\Form\Form->setData('')
     (vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:49)
  at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms(array('enable_invoices' => false, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => array('Fattura n. ec/', '#IN'), 'add_current_year' => false, 'reset_number_annually' => true, 'year_position' => 1, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => array('www.domain.com', ''), 'invoice_model' => 'invoice', 'use_disk_cache' => false), object(RecursiveIteratorIterator))
     (vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:379)
  at Symfony\Component\Form\Form->setData(array('enable_invoices' => false, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => array('Fattura n. ec/', '#IN'), 'add_current_year' => false, 'reset_number_annually' => true, 'year_position' => 1, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => array('www.domain.com', ''), 'invoice_model' => 'invoice', 'use_disk_cache' => false))
     (vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:49)
  at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms(array('invoice_options' => array('enable_invoices' => false, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => array('Fattura n. ec/', '#IN'), 'add_current_year' => false, 'reset_number_annually' => true, 'year_position' => 1, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => array('www.domain.com', ''), 'invoice_model' => 'invoice', 'use_disk_cache' => false)), object(RecursiveIteratorIterator))
     (vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:379)
  at Symfony\Component\Form\Form->setData(array('invoice_options' => array('enable_invoices' => false, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => array('Fattura n. ec/', '#IN'), 'add_current_year' => false, 'reset_number_annually' => true, 'year_position' => 1, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => array('www.domain.com', ''), 'invoice_model' => 'invoice', 'use_disk_cache' => false)))
     (vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:483)
  at Symfony\Component\Form\Form->initialize()
     (vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:226)
  at Symfony\Component\Form\FormBuilder->getForm()
     (src/Core/Form/FormHandler.php:114)
  at PrestaShop\PrestaShop\Core\Form\FormHandler->getForm()
     (src/PrestaShopBundle/Controller/Admin/Sell/Order/InvoicesController.php:57)
  at PrestaShopBundle\Controller\Admin\Sell\Order\InvoicesController->indexAction(object(Request))
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, false)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request), 1, false)
     (admin/index.php:88)

logs

exception 01

exception 02

Additionnal information
Prestashop 1.7.5
server

@khouloudbelguith
Copy link
Contributor

Hi @dritancami,

Could you please try to replace the ps_configuration_lang table in the Database with the one from clean PS1.7.5.0 installation.
Thanks to check & feedback.

@khouloudbelguith khouloudbelguith added Bug Type: Bug BO Category: Back Office NMI Status: issue needs more information Invoices Label: Which BO under menu is concerned 1.7.5.0 Affects versions labels Dec 24, 2018
@ghost
Copy link
Author

ghost commented Dec 24, 2018

I can try, in the meantime I tried to redo what is indicated here http://forge.prestashop.com/browse/BOOM-5982?focusedCommentId=171708&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-171708 but did not solve the problem.

@khouloudbelguith
Copy link
Contributor

@dritancami, yes because the exception is a different page.
That's why you need to replace all the ps_configuration_lang table.
Thanks!

@ghost
Copy link
Author

ghost commented Dec 24, 2018

No sorry, the problem has not been solved. On the same server (with the same features) I installed a clean version ps 1.7.5.0 and I tested with only one active language and then with two active languages, as is currently on the ps in production.
schermata 2018-12-24 alle 11 38 36

@khouloudbelguith
Copy link
Contributor

@dritancami, Could you please follow this link: https://github.com/PierreRambaud/phppsinfo
phppsinfo file provides an equivalent to the phpinfo() function that reports PrestaShop Requirements information about the PHP/MySQL/Apache environment and offers suggestions for improvement.

  1. Upload the file to the server. You should upload your file to the exact directory you want to test. Typically, this will be your httpdocs (/var/www/vhosts/example.com/httpdocs/) directory, although you can upload it to any subdirectory on your server as well. Use FTP to upload the file.
  2. Visit the page in your browser. If you uploaded it to your html directory, you should now visit http://www.example.com/phppsinfo.php, replacing example.com with your own domain name.
  3. Now you can view all of the information about PHP for your server for that particular directory.
    image
    Thanks to check and feedback.

@ghost
Copy link
Author

ghost commented Dec 24, 2018

Here it is:

schermata 2018-12-24 alle 11 50 19
schermata 2018-12-24 alle 11 50 38
schermata 2018-12-24 alle 11 50 48

@khouloudbelguith
Copy link
Contributor

@dritancami, thanks for your feedback.
In my case, I did not manage to reproduce the issue with PS1.7.5.0, English country / French language.
What is the exact Language/country di you used during the install?
Thanks!

@nuevoenesto
Copy link

Hi
I have the UnexpectedTypeException when I click on the invoice item in the backend menú.
I replace the ps_configuration_lang table with one from a clean 1.7.5.0 new instalaltion, but the error continues.
Any help?
Thanks Enrique

@ghost
Copy link
Author

ghost commented Dec 24, 2018

In Italian. Now I did the reverse test, I imported the "ps_configuration_lang" table from the ps in production to the one just installed 1.7.5 and the problem does not exist.

@nuevoenesto
Copy link

I received this from my page:
UnexpectedTypeException
in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php (line 41)
PropertyPathMapper->mapDataToForms('#IN', object(RecursiveIteratorIterator))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php (line 379)
Form->setData('#IN')
in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php (line 49)
PropertyPathMapper->mapDataToForms(array('enable_invoices' => true, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => '#IN', 'add_current_year' => false, 'reset_number_annually' => false, 'year_position' => 0, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => '', 'invoice_model' => 'invoice', 'use_disk_cache' => false), object(RecursiveIteratorIterator))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php (line 379)
Form->setData(array('enable_invoices' => true, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => '#IN', 'add_current_year' => false, 'reset_number_annually' => false, 'year_position' => 0, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => '', 'invoice_model' => 'invoice', 'use_disk_cache' => false))
in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php (line 49)
PropertyPathMapper->mapDataToForms(array('invoice_options' => array('enable_invoices' => true, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => '#IN', 'add_current_year' => false, 'reset_number_annually' => false, 'year_position' => 0, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => '', 'invoice_model' => 'invoice', 'use_disk_cache' => false)), object(RecursiveIteratorIterator))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php (line 379)
Form->setData(array('invoice_options' => array('enable_invoices' => true, 'enable_tax_breakdown' => false, 'enable_product_images' => false, 'invoice_prefix' => '#IN', 'add_current_year' => false, 'reset_number_annually' => false, 'year_position' => 0, 'invoice_number' => 0, 'legal_free_text' => '', 'footer_text' => '', 'invoice_model' => 'invoice', 'use_disk_cache' => false)))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php (line 483)
Form->initialize()
in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php (line 226)
FormBuilder->getForm()
in src/Core/Form/FormHandler.php (line 114)
[ 'form_builder' => &$this->formBuilder, ] ); return $this->formBuilder->getForm(); } /** * {@inheritdoc} *
FormHandler->getForm()
in src/PrestaShopBundle/Controller/Admin/Sell/Order/InvoicesController.php (line 57)
InvoicesController->indexAction(object(Request))
in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
HttpKernel->handleRaw(object(Request), 1)
in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68)
HttpKernel->handle(object(Request), 1, false)
in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200)
Kernel->handle(object(Request), 1, false)
in adminlabs/index.php (line 88)

@khouloudbelguith
Copy link
Contributor

@dritancami, so your issue is fixed?
@nuevoenesto, could you please try to replace the ps_configuration_lang table in the Database with the one from clean PS1.7.5.0 installation.
Thanks!

@nuevoenesto
Copy link

Hi,
Just I replace the table ps_configuration_lang from a nwe database, but the error continues.

@ghost
Copy link
Author

ghost commented Dec 24, 2018

@dritancami, so your issue is fixed?
@nuevoenesto, could you please try to replace the ps_configuration_lang table in the Database with the one from clean PS1.7.5.0 installation.
Thanks!

No, it has not been solved. Summary, if I import the table of the clean installation in the db of the ps in production - the problem continues. If i import the table of ps in production in the db of the clean installation, the problem does not occur.

@khouloudbelguith
Copy link
Contributor

@dritancami, could you please provide me the table ps_configuration_lang of your fresh installation (where the error occurs)
& provide me the ps_configuration_lang of your shop production (where there is no error).
Thanks!

@ghost
Copy link
Author

ghost commented Dec 24, 2018

It's the opposite, new installation = without problems, production = problems.
production.sql.zip
new installation.sql.zip

@nuevoenesto
Copy link

Hi
I attach table in the original Pd 1.7.5.0 format
I import this to the new proyect and not work, previous original Tablet in final propyect was not save.

@nuevoenesto
Copy link

I attach the file
ps_configuration_lang_new.zip

@khouloudbelguith
Copy link
Contributor

@dritancami, @nuevoenesto Did you made an upgrade from a previous version PrestaShop?
If yes, during the upgrade are there any errors displayed?
Can you please provide us the log of your upgrade? It can be found in the log.txt file, available in /autoupgrade/tmp/log.txt

@ghost
Copy link
Author

ghost commented Dec 24, 2018

Here it is:
log.txt

@nuevoenesto
Copy link

Yes this a upgrade form PD 1.6 to 1.7 without error in the process
Attach log file
Thanks!

@nuevoenesto
Copy link

nuevoenesto commented Dec 24, 2018

The file
log.txt

@khouloudbelguith
Copy link
Contributor

Hi @dritancami, @nuevoenesto,

Despite our several trials, I could not reproduce your issue with the provided information.
We are the Holidays season, our developers are not here right now.
I will assign your issue to our developer to reproduce the issue.
Thanks for your patience & your understanding!
@Quetzacoalt91 what do you think?
Thanks!

@khouloudbelguith khouloudbelguith added Autoupgrade Module: autoupgrade TBR Status: issue to be reproduced labels Dec 25, 2018
@nuevoenesto
Copy link

YES!!!!!!!
MANY MANY THANKS!
THIS Run!

@rdy4ever have a good 2019 year!

@rdy4ever
Copy link
Contributor

@nuevoenesto Great! HNY!

@rdy4ever
Copy link
Contributor

rdy4ever commented Dec 28, 2018

SIMPLE SOLUTION TO TEST AND FIX THIS ERROR

  1. Take a look into ps_configuration_lang to check how many languages you have enabled and their corresponding id's:
    SELECT * FROM ps_configuration_lang

  2. Run this SQL on the database:
    SELECT * FROM ps_configuration_lang WHERE id_configuration = (select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_PREFIX");
    SELECT * FROM ps_configuration_lang WHERE id_configuration = (select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT");
    SELECT * FROM ps_configuration_lang WHERE id_configuration = (select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_FREE_TEXT");

You should have an equal number of rows with the number of each enabled language for each of the three queries. This is how the result looks like for a shop with 5 enabled languages.
If any of the query returns empty or misses rows for some languages, then you will need to add the missing rows:

  1. FIXING
    To fix missing PS_INVOICE_PREFIX:
    INSERT INTO ps_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_PREFIX"), 1, "#IN", NOW());

(replace 1 with each of your language ids (id_lang)

To fix missing PS_INVOICE_LEGAL_FREE_TEXT:
INSERT INTO ps_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 1, "TEXT", NOW());

(replace 1 with each of your language ids (id_lang)

To fix missing PS_INVOICE_FREE_TEXT:
INSERT INTO ps_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM ps_configuration WHERE name = "PS_INVOICE_FREE_TEXT"), 1, "TEXT", NOW());

(replace 1 with each of your language ids (id_lang)

Also, if your table prefix isn't ps, use own prefix for all queries.

@rdy4ever
Copy link
Contributor

rdy4ever commented Dec 28, 2018

@dritancami
Run this SQL:

INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 1, "TEXT", NOW());
INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 2, "TEXT", NOW());

I put 1 and 2 as I assume that you have two enabled languages (with id's 1 and 2), but adjust the SQL if otherwise. I think it should fix it for you.
Edit: your prefix is chy, so I updated the sql.

@kris4net
Copy link

SIMPLE SOLUTION TO TEST AND FIX THIS ERROR

@rdy4ever big thanks, this works!!
Happy new year !!!

@ghost
Copy link
Author

ghost commented Dec 29, 2018

INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 2, "TEXT", NOW());

Hi @rdy4ever , I run the query, but the problem is not solved:
schermata 2018-12-29 alle 01 42 28
schermata 2018-12-29 alle 01 44 22

@rdy4ever
Copy link
Contributor

rdy4ever commented Dec 29, 2018 via email

@ghost
Copy link
Author

ghost commented Dec 29, 2018

Here:
config.sql.zip
config-lang.sql.zip

@rdy4ever
Copy link
Contributor

@dritancami
Run this SQL and I think your problem will be solved:

INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_FREE_TEXT"), 1, "TEXT", NOW());
INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_FREE_TEXT"), 2, "TEXT", NOW());

@ghost
Copy link
Author

ghost commented Dec 29, 2018

Hi, I run the query, but the problem is not solved..

@rdy4ever
Copy link
Contributor

Could you screenshot the stack trace after this sql?

@ghost
Copy link
Author

ghost commented Dec 29, 2018

Sure:
schermata 2018-12-29 alle 12 31 29

@rdy4ever
Copy link
Contributor

@dritancami
No, I meant a screenshot of the errror (Exception and stack trace tabs)

@rdy4ever
Copy link
Contributor

rdy4ever commented Dec 29, 2018

@dritancami Please run this SQL one more time and screenshot the whole response page (I need to see the result for each of the 3 queries):

SELECT * FROM chy_configuration_lang WHERE id_configuration = (select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_PREFIX");
SELECT * FROM chy_configuration_lang WHERE id_configuration = (select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT");
SELECT * FROM chy_configuration_lang WHERE id_configuration = (select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_FREE_TEXT");

It should look like this, with two rows for each query:
image

@ghost
Copy link
Author

ghost commented Dec 29, 2018

@dritancami
No, I meant a screenshot of the errror (Exception and stack trace tabs)

schermata 2018-12-29 alle 13 56 41
schermata 2018-12-29 alle 13 56 57
schermata 2018-12-29 alle 13 58 57

@ghost
Copy link
Author

ghost commented Dec 29, 2018

Please run this SQL one more time and screenshot the whole response page (I need to see the result for each of the 3 queries):

schermata 2018-12-29 alle 14 01 15
schermata 2018-12-29 alle 14 01 49
schermata 2018-12-29 alle 14 02 13

@rdy4ever
Copy link
Contributor

@dritancami I see you still don't have "legal_free_text". Please run both of these SQLs:

INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 1, "TEXT", NOW());
INSERT INTO chy_configuration_lang (id_configuration, id_lang, value, date_upd) values ((select id_configuration FROM chy_configuration WHERE name = "PS_INVOICE_LEGAL_FREE_TEXT"), 2, "TEXT", NOW());

@rdy4ever
Copy link
Contributor

@dritancami if it still doesn't work, you could just DROP chy_configuration_lang and reimport it from the attached SQL
chy_configuration_lang.zip

@ghost
Copy link
Author

ghost commented Dec 29, 2018

Hurray, the problem is now solved! Thanks a lot @rdy4ever! Thanks - Thanks - Thanks!!!

@rdy4ever
Copy link
Contributor

@dritancami Great!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.5.0 Affects versions Autoupgrade Module: autoupgrade BO Category: Back Office Bug Type: Bug Fixed Resolution: issue closed because fixed Invoices Label: Which BO under menu is concerned
Projects
None yet
Development

No branches or pull requests

6 participants