2 followers Follow

Value must not be null problem with adding Comment


I'm passing a valid string for comment, but i get the following error:



    [error_propagate] =>

    [error_parameters] => Array



    [error_detail] =>

    [error_description] => Value must not be null (at body['value'])

    [error] => invalid_value


The call is done like this:

$attribs = array( "value" => (string) $commentBody, "external_id" => $commentID );

            try {

              $action = PodioComment::create('task',$taskPodioID, $attribs);


            catch(PodioError $e) {



The task ID is valid, and the task is existing: 5799267. It has some comments that have been created with the same script. The comment has text in it. Any suggestions?

Thank you!

Kalin Sivov Answered

Please sign in to leave a comment.



If that may help, I'm attaching the comment itself. I've tested with htmlentities()  and without htmlentities, same result.


if no info is provided on where or how the search is done i can just guess:

&"some text...&"

&"text...text..&" / Static pagesFROM THEIR MANUAL: &"text-text-up&"


I.e text?&"->text'text.


Comment by: text

Created on: 2012-08-16 14:50:34


Kalin Sivov 0 votes
Comment actions Permalink

OK, solved. There was a non valid UTF character in the string. I guess such chars break the call. So make sure you check your strings before sending them. I found this func that seems to work:

function seems_utf8($str) {

 # get length, for utf8 this means bytes and not characters

 $length = strlen($str);

 # we need to check each byte in the string

 for ($i=0; $i < $length; $i++) {

  # get the byte code 0-255 of the i-th byte

  $c = ord($str[$i]);

  # utf8 characters can take 1-6 bytes, how much

  # exactly is decoded in the first character if

  # it has a character code >= 128 (highest bit set).

  # For all <= 127 the ASCII is the same as UTF8.

  # The number of bytes per character is stored in

  # the highest bits of the first byte of the UTF8

  # character. The bit pattern that must be matched

  # for the different length are shown as comment.


  # So $n will hold the number of additonal characters

  if ($c < 0x80) $n = 0; # 0bbbbbbb

  elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb

  elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb

  elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb

  elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb

  elseif (($c & 0xFE) == 0xFC) $n=5; # 1111110b

  else return false; # Does not match any model

  # the code now checks the following additional bytes

  # First in the if checks that the byte is really inside the

  # string and running over the string end.

  # The second just check that the highest two bits of all

  # additonal bytes are always 1 and 0 (hexadecimal 0x80)

  # which is a requirement for all additional UTF-8 bytes

  for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?

   if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))

    return false;



 return true;


Kalin Sivov 0 votes
Comment actions Permalink

Yes, all data sent to Podio must be UTF-8 encoded. If you have ISO-8859-1 strings use utf8_encode() to ensure your strings are UTF-8.

If you are using a different character set iconv() is a good choice for converting to UTF-8.

Andreas Haugstrup Pedersen 0 votes
Comment actions Permalink