Title: warning error
Last modified: August 21, 2016

---

# warning error

 *  Resolved [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/)
 * I am using this plugin on a Multisite install. It is not network activated as
   i am not using it across the board. The single site I am using it on is experiencing
   a strange error. It only occurs when I hit the save button in the Menus dashboard.
   The error is:
 * Warning: Creating default object from empty value in /home/{site root}/public_html/
   wp-content/plugins/wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php on line
   312
 * Any ideas as to what is causing this? Or how to fix it?
 * TIA
    KO
 * [https://wordpress.org/plugins/wp-post-to-pdf-enhanced/](https://wordpress.org/plugins/wp-post-to-pdf-enhanced/)

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/warning-error-17/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/warning-error-17/page/2/?output_format=md)

 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677425)
 * Which version of the plugin are you using?
 * Please bear in mind that this plugin is *not* yet multisite-enabled. If I actually
   do find the time to make that happen, it will likely be something of a “pro” 
   upgrade.
 * That said, I don’t think the issue you are seeing is related to multisite, but
   more likely to some sloppy coding (or editing, as the case may be). Please also
   give me your PHP version and WP version, and I’ll have a look.
 * Cheers
 * Lewis
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677434)
 * Lewis,
    Here are the specs you requested:
 * PHP: 5.4.20
    WP: 3.8.1 Plugin Version: 1.0.3
 * BTW – I commented out lines 309 through 318 and the warning disappeared.
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677459)
 * Hmmm…
 * Ah, yes, this is a PHP 5.4 thing. I’ll need to add it to my to-do list. I’ll 
   fix that and release a 1.0.4 version.
 * (By commenting that code, you have effectively disabled the options for processing
   shortcodes and content from other plugins. No worries; I should have this out
   in the next day or so – I need to get to a point where I can break from my regular
   work to do this.)
 * I really need to test against PHP 5.4 regularly. My production server runs 5.3,
   but I do have a few systems running 5.4 so that I can at least test.
 * Thanks for bringing this to my attention, KO, and glad you have a temporary workaround
   in place. Let’s leave this as unresolved until I release the bugfix.
 * Cheers
 * Lewis
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677461)
 * I appreciate the quick response!
    Thank you for the help.
 * KO
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677503)
 * You bet, KO. After I release 1.0.4, please follow-up to let me know whether this
   truly has been resolved.
 * Cheers
 * Lewis
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677629)
 * Ack… I meant to address this in 1.0.4. Looks like 1.0.5. 😉
 * Sorry about that!
 * Lewis
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677631)
 * My initial assessment of this was in error.
 * The real problem is that when saving menus in the admin area, we should not even
   be doing anything. Apparently, the action hook triggered when saving menus causes
   us to fire an event to update a phantom post/page, just as if editing that page
   and saving the edit would.
 * I’ve implemented what I consider to be an ugly workaround for this, where we 
   only set those hooks when we are _not_ on the menu admin screen.
 * I’ve landed this on trunk, so if you’d like to give the development version a
   spin, KO, please do so and let me know how it works for you. If no issues, I’ll
   backport this code to a 1.0.5 release.
 * I’ve tested under PHP 5.3.28, 5.4.23, 5.4.25, and 5.5.9, and things seem to be
   tight.
 * Cheers, thanks again for bringing this to my attention, and apologies for misdiagnosing
   it from the start. I should have read your initial report more closely!
 * Lewis
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677641)
 * I’ll give the dev version a go. Forgive me for being daft, but do you have a 
   link i can grab it from?
 * KO
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677643)
 * 😉
 * Nothing to forgive. Until I published this plugin here, there were lots of things
   about the WordPress site with which I was unfamiliar.
 * On the main page for this plugin, there is a Developers menu item. That link 
   will take you here:
 * [http://wordpress.org/plugins/wp-post-to-pdf-enhanced/developers/](http://wordpress.org/plugins/wp-post-to-pdf-enhanced/developers/)
 * Scroll down the page to **Other Versions**, and click the link for _Development
   Version (svn)_. That will produce (on the fly) a zip of the trunk build. Save
   that, go to your plugin area in your site, and install via upload. It should 
   just upgrade your existing version.
 * Watch for possible option issues in the new admin interface for the plugin, as
   I’ve received (so far) one report of other plugins not rendering in the PDF, 
   which I suspect is due to something getting reset. If something doesn’t look 
   right, just toggle the option, save, toggle back, and save again, to be sure 
   we don’t have any junk floating around in the database.
 * Cheers, and good luck!
 * Lewis
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677719)
 * Lewis,
    I finally had a chance to use the dev build on my multisite install. 
   However, when attempting to create a PDF I received the following error…
 * Fatal error: Uncaught exception ‘Exception’ with message ‘TCPDF ERROR: Incorrect
   unit: p’ in /home/removed-for-privacy/public_html/wp-content/plugins/wp-post-
   to-pdf-enhanced/tcpdf/tcpdf.php:2912 Stack trace: #0 /home/removed-for-privacy/
   public_html/wp-content/plugins/wp-post-to-pdf-enhanced/tcpdf/tcpdf.php(2024):
   TCPDF->Error(‘Incorrect unit:…’) #1 /home/removed-for-privacy/public_html/wp-
   content/plugins/wp-post-to-pdf-enhanced/tcpdf/tcpdf.php(1899): TCPDF->setPageUnit(‘
   P’) #2 /home/removed-for-privacy/public_html/wp-content/plugins/wp-post-to-pdf-
   enhanced/wp-post-to-pdf-enhanced.php(261): TCPDF->__construct(NULL, ‘P’, ‘LETTER’,
   true, ‘UTF-8’, false) #3 /home/removed-for-privacy/public_html/wp-content/plugins/
   wp-post-to-pdf-enhanced/wp-post-to-pdf-enhanced.php(139): wpptopdfenh->generate_pdf_file(
   93) #4 [internal function]: wpptopdfenh->generate_pdf(Object(WP)) #5 /home/removed-
   for-privacy/public_html/wp-includes/plugin.php(507): call_user_func_array(Array,
   Array) #6 /home/removed-for-privacy/public_html/wp-includes/class-wp.php(616):
   do_action_ref_array(‘wp’, Array) #7 /home/removed-for-privacy/public_html/wp-
   inc in /home/removed-for-privacy/public_html/wp-content/plugins/wp-post-to-pdf-
   enhanced/tcpdf/tcpdf.php on line 2912
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/warning-error-17/#post-4677720)
 * Please go into the admin area and ensure that the unit parameter is set to something.
   There are still a number of new settings which are not getting properly initialized
   upon activation of the plugin, and if just downloading and unzipping without 
   deactivating, deleting, and then installing the new build, I can see how a number
   of things might not get set in the plugin options.
 * It looks like the unit of measure is not being set. The first line number referenced
   in the error is the exception handler in tcpdf. The first hit in the stack trace
   refers to this bit of code:
 *     ```
       public function setPageUnit($unit) {
       		$unit = strtolower($unit);
       		//Set scale factor
       		switch ($unit) {
       			// points
       			case 'px':
       			case 'pt': {
       				$this->k = 1;
       				break;
       			}
       			// millimeters
       			case 'mm': {
       				$this->k = $this->dpi / 25.4;
       				break;
       			}
       			// centimeters
       			case 'cm': {
       				$this->k = $this->dpi / 2.54;
       				break;
       			}
       			// inches
       			case 'in': {
       				$this->k = $this->dpi;
       				break;
       			}
       			// unsupported unit
       			default : {
       				$this->Error('Incorrect unit: '.$unit);
       				break;
       			}
       		}
       ```
   
 * I thought that I had the fallback unit set to mm, but it’s possible that during
   my internal testing, I left that out, expecting that the database would always
   have _something_ usable set in it.
 * So, access settings, poke around, save, and try again. That should at least get
   the new settings primed into the db.
 * Thanks for reporting this, and good luck!
 * Lewis
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/warning-error-17/#post-4677738)
 * FYI – I just downloaded/installed Version 1.1.0b20140331 and I believe that the
   issue has been resolved!
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years ago](https://wordpress.org/support/topic/warning-error-17/#post-4677739)
 * Lewis,
    I spoke to soon. I uploaded Version: 1.1.0b20140331 and although the 
   settings took and I could publish/update posted without the error displaying,
   The PDFs that were exported were blank (and a single page turned into 153 blank
   ones.)
 * I have gone back to 1.0.4, but have to deactivate/reactivate it every time we
   make content edits.
 *  Plugin Author [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * (@lewisr)
 * [12 years ago](https://wordpress.org/support/topic/warning-error-17/#post-4677740)
 * Hmmm… So, you’re not getting any errors reported with the dev build, but you 
   do get garbage in the PDF (multiple blank pages). I’ll need to backtrack through
   this and see what this issue is. This is different than the initial symptom you
   reported, so we may want to open a different thread.
 * Initially, the issue had to do with us firing a PDF generation when saving menus.
   This is fixed in the development version, where we specifically do not fire in
   the admin area.
 * However, now we have a different issue where we are not generating proper content
   under the dev version, but where we *are* generating it properly with the release
   version (1.0.4), so we need to find out what we’re doing differently to cause
   this (as I haven’t seen it on anything else, yet).
 * Have you introduced any other plugins into the mix, KO? That’s usually what causes
   us to grab the wrong data to throw into the PDF.
 * Thanks for the report, and apologies for the trouble. I could (may) release an
   interim fix for your initial problem, as that one’s fairly simple to backport(
   IIRC).
 * Cheers
 *  Thread Starter [ratputin](https://wordpress.org/support/users/ratputin/)
 * (@ratputin)
 * [12 years ago](https://wordpress.org/support/topic/warning-error-17/#post-4677741)
 * Lewis,
    No new plugins. Same build as before.
 * Point of clarification-
    The original error was a result of saving a menu. However
   it also occurs when saving a post/page. I didn’t realize that I had not stipulated
   that…my bad.
 * And you are correct in the analogy of the second issue, however as I said that
   only occurred while using the Dev version.

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/warning-error-17/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/warning-error-17/page/2/?output_format=md)

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

 * ![](https://s.w.org/plugins/geopattern-icon/wp-post-to-pdf-enhanced_d24b30.svg)
 * [WP Post to PDF Enhanced](https://wordpress.org/plugins/wp-post-to-pdf-enhanced/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-post-to-pdf-enhanced/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-post-to-pdf-enhanced/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-post-to-pdf-enhanced/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-post-to-pdf-enhanced/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-post-to-pdf-enhanced/reviews/)

## Tags

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

 * 21 replies
 * 3 participants
 * Last reply from: [Lewis Rosenthal](https://wordpress.org/support/users/lewisr/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/warning-error-17/page/2/#post-4677754)
 * Status: resolved