Title: PHP warning
Last modified: September 28, 2018

---

# PHP warning

 *  [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/)
 * I am getting the following two PHP warnings:
 *     ```
       NOTICE: wp-content/plugins/page-scroll-to-id/malihu-pagescroll2id.php:354 - Undefined variable: i
   
       NOTICE: wp-content/plugins/page-scroll-to-id/malihu-pagescroll2id.php:355 - Undefined variable: shortcode_class
       ```
   
 * The corresponding code looks suspicious:
 *     ```
                                       $pl_shortcodes[$i]=function($atts,$content=null) {
                                               extract(shortcode_atts(array(
                                                       "i" => "'.$i.'",
                                                       "shortcode_class" => "_'.$shortcode_class.'",
                                                       "url" => "",
                                                       "offset" => "",
                                                       "id" => "",
                                                       "target" => "",
                                                       "class" => "",
                                               ), $atts));
       ```
   
 * I do not quite understand the usage of the single/double quotes together.
    -  This topic was modified 7 years, 8 months ago by [therealgilles](https://wordpress.org/support/users/chamois_blanc/).

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

 *  Thread Starter [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10733686)
 * The problem comes from the usage of closure on $i and $shortcode_class but the‘
   use’ is missing. The corrected code is as follows:
 *     ```
                                       $pl_shortcodes[$i]=function($atts,$content=null) use ($i, $shortcode_class) {
                                               extract(shortcode_atts(array(
                                                       "i" => "'.$i.'",
                                                       "shortcode_class" => "_'.$shortcode_class.'",
                                                       "url" => "",
                                                       "offset" => "",
                                                       "id" => "",
                                                       "target" => "",
                                                       "class" => "",
                                               ), $atts));
       ```
   
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10733762)
 * Hello,
 * Thanks for the feedback! Which PHP version are you using?
 *  Thread Starter [therealgilles](https://wordpress.org/support/users/chamois_blanc/)
 * (@chamois_blanc)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10733807)
 * I am using PHP version 7.2.
 *  [gecko_guy](https://wordpress.org/support/users/gecko_guy/)
 * (@gecko_guy)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10734396)
 * Hey there, just to chip in with the same question since this is what I came here
   to report if it hadn’t already been raised.
 * In our case the site is using PHP7.1
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10734738)
 * [@chamois_blanc](https://wordpress.org/support/users/chamois_blanc/) and [@gecko_guy](https://wordpress.org/support/users/gecko_guy/)
   
   Thanks a lot for the info 🙂 All PHP 7 notices/warnings will be fixed on the 
   next plugin version (I’ll probably push the updates on plugin’s development version
   earlier so people can test it).
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10770419)
 * [@chamois_blanc](https://wordpress.org/support/users/chamois_blanc/) and [@gecko_guy](https://wordpress.org/support/users/gecko_guy/)
 * Hello again,
 * I’ve just updated plugin’s development version that has all PHP 7 warnings/notices
   fixed. If you want, you can download it and replace the plugin in your installation
   to check if everything is ok:
 * [https://downloads.wordpress.org/plugin/page-scroll-to-id.zip](https://downloads.wordpress.org/plugin/page-scroll-to-id.zip)
 * Please note that development version includes additional updates like bug fixes,
   new options and features etc. that’ll be available on version 1.6.3.
 * I appreciate your feedback 🙂

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

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

 * ![](https://ps.w.org/page-scroll-to-id/assets/icon-256x256.png?rev=1401043)
 * [Page scroll to id](https://wordpress.org/plugins/page-scroll-to-id/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/page-scroll-to-id/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/page-scroll-to-id/)
 * [Active Topics](https://wordpress.org/support/plugin/page-scroll-to-id/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/page-scroll-to-id/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/page-scroll-to-id/reviews/)

## Tags

 * [PHP Warning](https://wordpress.org/support/topic-tag/php-warning/)

 * 6 replies
 * 3 participants
 * Last reply from: [malihu](https://wordpress.org/support/users/malihu/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/php-warning-172/#post-10770419)
 * Status: not resolved