Title: Uncaught TypeError: strlen()
Last modified: February 13, 2023

---

# Uncaught TypeError: strlen()

 *  [luciendub](https://wordpress.org/support/users/luciendub/)
 * (@luciendub)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/uncaught-typeerror-strlen/)
 * 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)

 *  [prokops](https://wordpress.org/support/users/prokops/)
 * (@prokops)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/uncaught-typeerror-strlen/#post-16490646)
 * We have same issue, any answers for this?
 *  [Xavier Serrano](https://wordpress.org/support/users/xavierserranoa/)
 * (@xavierserranoa)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/uncaught-typeerror-strlen/#post-16518297)
 * we have the same issue I believe is becuase of this line
 *     ```wp-block-code
       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
 *     ```wp-block-code
       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
 *     ```wp-block-code
       public static function normalize($field, $data) {
           if ($data == null || strlen($field) == 0) {
       ```
   
 *  [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * (@jhorowitz)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/uncaught-typeerror-strlen/#post-16601936)
 * Hi [@luciendub](https://wordpress.org/support/users/luciendub/), [@prokops](https://wordpress.org/support/users/prokops/)
   and [@xavierserranoa](https://wordpress.org/support/users/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](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.

 * ![](https://ps.w.org/official-facebook-pixel/assets/icon.svg?rev=3158868)
 * [Meta pixel for WordPress](https://wordpress.org/plugins/official-facebook-pixel/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/official-facebook-pixel/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/official-facebook-pixel/)
 * [Active Topics](https://wordpress.org/support/plugin/official-facebook-pixel/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/official-facebook-pixel/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/official-facebook-pixel/reviews/)

 * 3 replies
 * 4 participants
 * Last reply from: [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/uncaught-typeerror-strlen/#post-16601936)
 * Status: not resolved