Title: PHP Error
Last modified: June 26, 2019

---

# PHP Error

 *  [apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
 * (@apartmentsforrentx)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/)
 * Hi,
 * I need assistance with a PHP error. The log says:
 *     ```
       [23-Jun-2019 09:46:30 UTC] PHP Warning:  Invalid argument supplied for foreach() in /home/fbm22apr/public_html/wp-content/plugins/content-control/classes/Shortcodes.php on line 69
       ```
   
 * Here is the code written inside.
 *     ```
       61	/**
       62	 * Takes empty attributes and sets them to true.
       63	 *
       64	 * @param $atts
       65	 *
       66	 * @return mixed
       67	 */
       68	public static function normalize_empty_atts( $atts ) {
       68		foreach ( $atts as $attribute => $value ) {
       69			if ( is_int( $attribute ) ) {
       70				$atts[ strtolower( $value ) ] = true;
       71				unset( $atts[ $attribute ] );
       72			}
       73		}
       74
       75		return $atts;
       76	}
       ```
   
    -  This topic was modified 6 years, 11 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Formatting
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-error-330%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11667855)
 * [@apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)–
   The error is coming from line 68 even though it says 69. I’m not sure why it 
   would generate an error there as $atts should always be an array, but you can
   try this:
 * Change
 * `foreach ( $atts as $attribute => $value ) {`
 * To
 * `foreach ( (array) $atts as $attribute => $value ) {`
 * Let me know.
 *  Thread Starter [apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
 * (@apartmentsforrentx)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11673723)
 * Hi,
 * This is a bit alarming. The error got worse
 * [26-Jun-2019 10:15:41 UTC] PHP Fatal error: Uncaught Error: Cannot unset string
   offsets in plugins/content-control/classes/Shortcodes.php:71
 * 71 unset( $atts[ $attribute ] );
 *  Thread Starter [apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
 * (@apartmentsforrentx)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11674613)
 * Hello moderators, please delete this topic for security reasons from public view.
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11674713)
 * [@apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)–
   what security reason could you have except that you put a link to your site on
   the first ticket. Otherwise I can’t see an actually security issue here.
 * Am I missing something?
 * Also crappy temporary hack but since we have seen this error a few times with
   no real reason why it should occur would it be possible for you to paste the 
   shortcodes used on your site from our plugin.
 * And if possible add in a var_dump($atts) exit; then load the page where it should
   be rendered. Instead it will simply output the variable $atts and end. Copy that
   here and delete the var_dump and exit lines.
 * Let me know. Would love to solve this one once and for all.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11674873)
 * Topics are only edited in extreme cases and search engine hits are never considered
   extreme.
 * [https://wordpress.org/support/forum-user-guide/faq/#my-post-shows-up-on-a-search-for-my-domain-will-you-delete-my-post-or-my-link](https://wordpress.org/support/forum-user-guide/faq/#my-post-shows-up-on-a-search-for-my-domain-will-you-delete-my-post-or-my-link)
 * > Hello moderators, please delete this topic for security reasons from public
   > view.
 * There is nothing in this topic that is even remotely a security concern. Your
   topic will not be deleted.
 *  Thread Starter [apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
 * (@apartmentsforrentx)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11681482)
 * Hello again Sir Jan Dembowski,
 * I understand the policy for deleting topics. But, my website’s security is at
   stake, since 2 days ago, 20 daily hack attempts are reported by my security plugin.
   Which is very unusual and alarming. We know that different hack methods are on
   the web, and one reason is due to the directory path being exposed. But if it
   is not too much to ask from you. Could you please edit my first post and just
   remove the directory path before
 * “/wp-content/plugins/content-control/classes/Shortcodes.php on line 69”
 * I would appreciate it. Thank you.
 *  Thread Starter [apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
 * (@apartmentsforrentx)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11681496)
 * Additionally I had 7 reported directory traversal hack attempts on my website.
   So I hope you could grant my request to remove the directory path on my first
   post. Thank you.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11681730)
 * [@apartmentsforrentx](https://wordpress.org/support/users/apartmentsforrentx/)
   Stop reporting this topic.
 * Again, there is nothing here that us security related. Please do not report this
   again.
 * Those probes happen regardless and if you are concerned then considered hardening
   your site and/or installing a security plugin.
 * [https://wordpress.org/support/article/hardening-wordpress/](https://wordpress.org/support/article/hardening-wordpress/)
 * [https://wordpress.org/plugins/search/security/](https://wordpress.org/plugins/search/security/)

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP Error’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/php-error-330/#post-11681730)
 * Status: not a support question