• It looks that errors are generated by the plugin.

    Une erreur de type E_ERROR a été causée dans la ligne 42 du fichier /plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Normalizer.php. Message d’erreur?: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Normalizer.php:42

Viewing 3 replies - 1 through 3 (of 3 total)
  • We have same issue, any answers for this?

    we have the same issue I believe is becuase of this line

    public static function normalize($field, $data) {
        if ($data == null || strlen($data) == 0) {

    this file wp-content/plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/UserData.php on line 914 is passing as the $data value the valueList $val array. which causes the line above to fail with a fatal error

    private function normalizeHashDedup($fieldName, $valueList){
        if(empty($valueList) || !isset($fieldName)) {
          return null;
        }
        $deduped = array();
        foreach($valueList as $val){
          $hashedVal = Util::hash(Normalizer::normalize($fieldName, $val));
          $deduped[$hashedVal] = true;
        }
        return array_keys($deduped);
      }
    

    I beleive the solution is to change the line on the file wp-content/plugins/official-facebook-pixel/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Normalizer.php to this below since its the $field variable that passes a string that being said if the point is to check for things not to be empty im not sure why you guys arent just using empty($field) and empty($data) since those will return true if the string or array are empty or if null is passed with either

    public static function normalize($field, $data) {
        if ($data == null || strlen($field) == 0) {

    Hi @luciendub, @prokops and @xavierserranoa,

    This is very likely the same issue a lot of people have been having with PHP 8, which is fixed by my PR here:
    https://github.com/facebookincubator/Facebook-Pixel-for-Wordpress/pull/32

    It has been sitting around for a very long time but has finally been approved and will hopefully get merged in and released soon. In the meantime you can apply the changes in that PR to the plugin yourself on your site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Uncaught TypeError: strlen()’ is closed to new replies.