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

Undefined array key 0 in Subject select input #73

Merged
merged 3 commits into from
Jan 10, 2024

Conversation

NicolasCador
Copy link
Contributor

@NicolasCador NicolasCador commented Nov 24, 2023

Questions Answers
Description? When you send a message through the PO in BO, then you send a new message trough Customer Service in BO, there is an error in Subject select input.
Type? bug fix
BC breaks? yes
Deprecations? yes
Fixed ticket? Fixes PrestaShop/PrestaShop#34672.
How to test? Open an order in BO
Send a message to customer
Open Customer Service/Customer Service tab in BO
Send a new message concerning this PO
Open the customer e-mail, follow the link to answer
It opens the Contact us page
There isn't any error in the Subject select input

contactform.php Outdated Show resolved Hide resolved
Co-authored-by: Maxime Flasquin <[email protected]>
@NicolasCador
Copy link
Contributor Author

hello @mflasquin,

ok, updated, thank you

Copy link
Contributor

@Hlavtox Hlavtox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use !empty(, it will be the cleanest. :)

@NicolasCador
Copy link
Contributor Author

Hello @Hlavtox,

in fact we need to avoid 0 because array key 0 will be never defined.

And finally, @mflasquin, I'm not sure we need to put !== because with that, if $this->customer_thread['id_contact'] is different than int type, $contacts[$this->customer_thread['id_contact']] will also give an error.
What do you think?

@Hlavtox
Copy link
Contributor

Hlavtox commented Nov 25, 2023

@NicolasCador Yes that is what empty will do. It will return true only if it's defined, not false, not null, not empty string, not zero. :-)

contactform.php Outdated Show resolved Hide resolved
@NicolasCador
Copy link
Contributor Author

hello @Hlavtox,

ok, thank you very much, I didn't know for 0, I updated

Co-authored-by: Tom Zajac <[email protected]>
Copy link
Contributor

@florine2623 florine2623 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @NicolasCador ,

Tested your PR on PS 8.0.x, 8.1.3 and develop.
It works as expected. No more error on the Subject !

It is QA ✅

@Hlavtox Hlavtox merged commit fa319c7 into PrestaShop:dev Jan 10, 2024
12 checks passed
@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 10, 2024

Thanks everyone!

@Hlavtox Hlavtox added this to the 4.4.2 milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
6 participants