Title: Php and JavaScript Bugs Found
Last modified: August 22, 2016

---

# Php and JavaScript Bugs Found

 *  Resolved [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-and-javascript-bugs-found/)
 * Hello.
    In trouble shooting the compatibility of our two plugins, I found a few
   bugs that you might like to know about.
 * **1.** file: simplepagetester.php
    function sptDetailsMeta() around line: 257
   you are simply echoing `count($sptData[$sptData['master_id'] . '_visits']);` 
   with out first checking to see if it has been set. **Before:**
 *     ```
       echo '			</select> %
       				</td>
       			</tr>
       			<tr>
       				<th scope="row" colspan="1">Total Unique Visits:</th>
       				<td colspan="2">' . count($sptData[$sptData['master_id'] . '_visits']) . '</td>
       			</tr>';
       ```
   
 * **After:**
 *     ```
       echo '</select> % </td></tr>
       	<tr><th scope="row" colspan="1">Total Unique Visits:</th><td colspan="2">';
       if( !empty($sptData[$sptData['master_id'] . '_visits']) ){
       		echo count($sptData[$sptData['master_id'] . '_visits']);
       }
       echo '</td></tr>';
       ```
   
 * **2.** Same file, same issue around line 302:
    **Before:**
 *     ```
       <td colspan="2">' . count($sptData[$sptData['slave_id'] . '_visits']) .
       ```
   
 * **After:**
 *     ```
       <td colspan="2">';
       if( !empty( $sptData[$sptData['slave_id'] . '_visits'] ) ){
       		echo count($sptData[$sptData['slave_id'] . '_visits']);
       }
       ```
   
 * **3. **same file
    function: sptRecordVisit() around line 506 session_start() 
   is throwing an error because the session has already been started. either remove
   this or check before starting the session.
 *     ```
       //session_start();
       ```
   
 * **4. **same file, same function, around line 531:
    **Before:**
 *     ```
       'ip' => getenv(REMOTE_ADDR)
       ```
   
 * **After:**
 *     ```
       'ip' => getenv('REMOTE_ADDR')
       ```
   
 * **5.** file: sptHelper.js
    function: sptDrawChart around lines 66 and 71 not 
   checking first to see if the variable has been set. **Before:**
 *     ```
       if (chart_data[0].length == 5)
       ```
   
 * **After:**
 *     ```
       if (chart_data[0].length && chart_data[0].length == 5)
       ```
   
 * [https://wordpress.org/plugins/simple-page-tester/](https://wordpress.org/plugins/simple-page-tester/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * (@jkohlbach)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-and-javascript-bugs-found/#post-5304245)
 * Hi Baden,
 * Apologies for the delay in responding, the forums usually notify me of new posts
   but it’s been temperamental and I missed this.
 * We’ll address these issues in an upcoming release, thanks for the contribution!
 * Cheers,
    Josh

Viewing 1 replies (of 1 total)

The topic ‘Php and JavaScript Bugs Found’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-page-tester_677f5d.svg)
 * [Simple Page Tester](https://wordpress.org/plugins/simple-page-tester/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-page-tester/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-page-tester/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-page-tester/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-page-tester/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-page-tester/reviews/)

## Tags

 * [bug fixes](https://wordpress.org/support/topic-tag/bug-fixes/)
 * [php bugs](https://wordpress.org/support/topic-tag/php-bugs/)

 * 1 reply
 * 2 participants
 * Last reply from: [Josh Kohlbach](https://wordpress.org/support/users/jkohlbach/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/php-and-javascript-bugs-found/#post-5304245)
 * Status: resolved