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

Correção para Warning: Invalid argument supplied for foreach #140

Merged
merged 3 commits into from Mar 21, 2016

Conversation

Projects
None yet
3 participants
@rafaelpatro
Contributor

rafaelpatro commented Mar 20, 2016

Closes #107, #122, #126

Corrige a mensagem de alerta Warning: Invalid argument supplied for foreach, e a funcionalidade de adição e alteração de novos métodos de postagem.

@rafaelpatro rafaelpatro force-pushed the rafaelpatro:fix_invalid_argument branch from 91ccc4c to 965c0b5 Mar 20, 2016

@@ -757,7 +757,10 @@ protected function _removeInvalidServices()
protected function _addPostMethods($cServico)
{
$addMethods = $this->getConfigData("add_postmethods");
foreach ($addMethods as $configData) {
if (!$addMethods || empty($addMethods)) {

This comment has been minimized.

@pedro-teixeira

pedro-teixeira Mar 20, 2016

Owner

empty já faz todos os checks:

The following things are considered to be empty:

"" (an empty string)
0 (0 as an integer)
0.0 (0 as a float)
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
$var; (a variable declared, but without a value)

Não tem necessidade do !$addMethods.

This comment has been minimized.

@rafaelpatro

rafaelpatro Mar 20, 2016

Contributor

Que beleza! Corrigindo...

if (!$addMethods || empty($addMethods)) {
return $cServico;
}
foreach ((array) $addMethods as $configData) {

This comment has been minimized.

@pedro-teixeira

pedro-teixeira Mar 20, 2016

Owner

Em que situação o $addMethods pode não ser um array?

This comment has been minimized.

@rafaelpatro

rafaelpatro Mar 20, 2016

Contributor

Se o lojista colocar uma string vai passar pela validação.

This comment has been minimized.

@rafaelpatro

rafaelpatro Mar 20, 2016

Contributor

Alterei de novo. Acho q ficou melhor e mais claro.

@rafaelpatro rafaelpatro force-pushed the rafaelpatro:fix_invalid_argument branch from 965c0b5 to 34c1507 Mar 20, 2016

@pedro-teixeira

This comment has been minimized.

Owner

pedro-teixeira commented Mar 21, 2016

Obrigado @rafaelpatro!

@pedro-teixeira pedro-teixeira self-assigned this Mar 21, 2016

@pedro-teixeira pedro-teixeira added this to the v4.6.0 milestone Mar 21, 2016

pedro-teixeira added a commit that referenced this pull request Mar 21, 2016

Merge pull request #140 from rafaelpatro/fix_invalid_argument
Correção para Warning: Invalid argument supplied for foreach

@pedro-teixeira pedro-teixeira merged commit de0c1bf into pedro-teixeira:master Mar 21, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@MichelMoraes

This comment has been minimized.

MichelMoraes commented on 34c1507 Apr 14, 2016

isso resolve o erro da edição de produtos após desinstalaçao do modulo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment