Title: Undefined index and undefined variable
Last modified: August 31, 2016

---

# Undefined index and undefined variable

 *  Resolved [lordanti](https://wordpress.org/support/users/lordanti/)
 * (@lordanti)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/)
 * This plugin did not work on my installation. I got two warnings: one for an undefined
   index: m-chart in the file class-m-chart-admin.php on line 334, and another one
   for an undefined variable: settings in the file highcharts-settings.php on line
   172. It won’t allow me to publish a chart.
 * [https://wordpress.org/plugins/m-chart/](https://wordpress.org/plugins/m-chart/)

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

 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408293)
 * Hey lordanti,
 * Bug reports are much easier for me to follow on GitHub:
 * [https://github.com/methnen/m-chart/issues](https://github.com/methnen/m-chart/issues)
 * That said can you give me a little more info? Version of WP the Theme you’re 
   using? Etc…
 * I’m currently unable to duplicate either of those warnings on my test install.
 *  Thread Starter [lordanti](https://wordpress.org/support/users/lordanti/)
 * (@lordanti)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408333)
 * Hi methnen,
    I am working on my localhost, using the current version of WordPress
   with the Twentysixteen theme. I also tried with Underscores. I even deactivated
   all the other plugins except yours. Thanks for your quick response.
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408336)
 * Thanks for the follow up. I’ll take a look at reproducing this tomorrow morning.
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408467)
 * Hey lordanti,
 * So I spent a little time on this this morning. I’m running WP 4.5.2 with the 
   Twentysixteen theme and the latest version of M Chart (1.2.1) and I’m not receiving
   any of those errors.
 * The line 172 one is a simpler error, that I’ve fixed in the version that will
   likely come out sometime today. The other one is strange.
 * It’s happening where the nonce is being checked to make sure you’ve got a valid
   submission. The error is implying that the $_POST data doesn’t include any M 
   Chart related fields. Which would be really surprising. I’ll add an additional
   check to prevent the warning but that doesn’t explain how you’re hitting save
   and not getting any data in your $_POST object.
 * When I get M Chart version 1.3 up later today I’d really appreciate you taking
   a look and letting me know if it’s still broken. I’ll see what I can do to look
   into it further if it is.
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408511)
 * Version 1.3 is now available:
 * [https://downloads.wordpress.org/plugin/m-chart.latest-stable.zip](https://downloads.wordpress.org/plugin/m-chart.latest-stable.zip)
 *  Thread Starter [lordanti](https://wordpress.org/support/users/lordanti/)
 * (@lordanti)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408514)
 * Sorry, I’m still unable to use this plugin. No warnings this time, but as soon
   as I finish entering data on the first cell, the “publish” button gets deactivated
   and I can’t publish the chart.
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408515)
 * Ah, that helps actually.
 * The button gets disabled while the plugin waits for the image version of the 
   chart to be generated. Normally that happens pretty quickly, but if something
   were to circumvent that somehow that could prevent it from finishing.
 * Can you check the error console in your browser?
 * Here’s how to get to it in Chrome if you have that available:
    [https://developers.google.com/web/tools/chrome-devtools/debug/console/console-ui?hl=en#opening-the-console](https://developers.google.com/web/tools/chrome-devtools/debug/console/console-ui?hl=en#opening-the-console)
 * Appreciate you continuing to work through this with me.
 * If you don’t care about the image version you could also go to Charts -> Settings
   in the WP Admin panel and choose the third performance option which would skip
   the instant preview/image generation stuff and thus the button would never be
   disabled.
 *  Thread Starter [lordanti](https://wordpress.org/support/users/lordanti/)
 * (@lordanti)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408516)
 * I tried the third option, but it didn’t solve the problem. I’ve got the following
   3 errors/warnings on my console:
 * `mutating the [Prototype](http://codex.wordpress.org/Prototype) of an object 
   will cause your code to run very slowly; instead create the object with the correct
   initial [Prototype](http://codex.wordpress.org/Prototype) value using Object.
   create`
 * on m-chart/components/external/handsontable/handsontable.js?ver=4.5.2 on line
   38
 * `SyntaxError: expected expression, got '<'`
 * on post.php?post=281&action=edit
    on line 526
 * `TypeError: window[("m_chart_highcharts_" + m_chart_admin.post_id)] is undefined`
 * on m-chart/components/js/m-chart-admin.js?ver=4.5.2
    on line 330
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408547)
 * Well that explains things. handsontable (which drives the spreadsheet interface)
   is creating a syntax error which will break everything on the JS end from then
   on.
 * The problem is that I’m unable to duplicate this on my end at all. I’m getting
   no syntax errors anywhere and everything working like it should. There’s got 
   to be something different in the JS being loading on your install that’s conflicting
   somewhere.
 * Could you possibly email me the HTML from page of the chart edit form that’s 
   being generated?
 * jamie AT methnen.com
 * Also what browser/version are you using?
 * Just trying to recreate the conditions as closely as possible.
 *  Thread Starter [lordanti](https://wordpress.org/support/users/lordanti/)
 * (@lordanti)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408576)
 * I tried both Firefox and Chrome. Let me copy & paste that syntax error:
 *     ```
       <div id="m-chart-container-281" class="m-chart-container">
       	<div id="m-chart-281" class="m-chart"></div>
       </div>
       <script type="text/javascript">
       	var m_chart_highcharts_281 = {
       		chart_args: <br />
       <b>Notice</b>:  Undefined offset: 0 in <b>C:\xampp\htdocs\sandbox001\wp-content\plugins\m-chart\components\class-m-chart-parse.php</b> on line <b>91</b><br />
       <br />
       <b>Notice</b>:  Undefined offset: 0 in <b>C:\xampp\htdocs\sandbox001\wp-content\plugins\m-chart\components\class-m-chart-parse.php</b> on line <b>75</b><br />
       <br />
       <b>Notice</b>:  Undefined index: first_row in <b>C:\xampp\htdocs\sandbox001\wp-content\plugins\m-chart\components\class-m-chart-parse.php</b> on line <b>287</b><br />
       {"chart":{"type":"line","show_labels":true,"renderTo":"m-chart-281","height":400},"title":{"text":"dsfsdfsfsdfs"},"subtitle":{"text":""},"legend":{"enabled":true},"credits":{"href":"","text":""},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true,"format":"{y:,f}"},"connectNulls":true},"line":{"dataLabels":{"enabled":true}}},"xAxis":{"categories":[],"title":{"text":""}},"yAxis":{"title":{"text":""}},"series":[],"colors":["#4572A7","#AA4643","#89A54E","#80699B","#3D96AE","#DB843D","#92A8CD","#A47D7C","#B5CA92"]},
       		post_id: 281	};
       ```
   
 * The highlighted line is that of `chart_args: <br />`
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408590)
 * [@lordanti](https://wordpress.org/support/users/lordanti/), I now see the issue.
   You have your PHP errors and notices outputting into the page HTML instead of
   a log file.
 * The notices are inserting itself into the Javascript and creating syntax errors.
 * I believe I’ve fixed those notices on my end and a new version should be coming
   this evening that’ll fix your issue.
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408591)
 * And here we go:
 * [https://downloads.wordpress.org/plugin/m-chart.1.3.1.zip](https://downloads.wordpress.org/plugin/m-chart.1.3.1.zip)
 *  Plugin Author [methnen](https://wordpress.org/support/users/methnen/)
 * (@methnen)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408641)
 * Resolving as 1.3.1 should have fixed this issue.

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

The topic ‘Undefined index and undefined variable’ is closed to new replies.

 * ![](https://ps.w.org/m-chart/assets/icon-256x256.png?rev=3472197)
 * [M Chart](https://wordpress.org/plugins/m-chart/)
 * [Support Threads](https://wordpress.org/support/plugin/m-chart/)
 * [Active Topics](https://wordpress.org/support/plugin/m-chart/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/m-chart/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/m-chart/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [methnen](https://wordpress.org/support/users/methnen/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/undefined-index-and-undefined-variable/#post-7408641)
 * Status: resolved