0
I have a PHP class responsible for sending tax notes, however it returns the following error, as if trying to pass an array to variable:
[13-Mar-2018 14:08:26 America/Sao_Paulo] PHP Notice: Array to string conversion in C:\...ToolsNFePHP.class.php on line 5212
By code, the variable $msg
should already send a string, I have tried to convert from Array for String, but the error continues.
Follows the code:
/**
* pSetError
* Adiciona descrição do erro ao contenedor dos erros
*
* @name pSetError
* @param string $msg Descrição do erro
* @return none
*/
private function pSetError($msg)
{
$this->errMsg .= "$msg\n";
$this->errStatus = true;
}
This happens only in this case, other sending objects work normally. I believe I may be aggregating more than one error message in the same variable and causing the error, but without seeing it I cannot correct.
Actually you are trying to concatenate the array values and not exploding/separating. You are probably passing a String for the method
pSetError
, while the correct one would be to pass one Array.– Valdeir Psr
Possible duplicate of Array to string Conversion errors in PHP function
– Woss
The code seems correct what may be wrong is argument in the method call.
– rray
Use a string instead of a array. You can use the
implode(",", $array);
before accessing the function.– Valdeir Psr