Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Undefined variable: options in PHPExcel/Settings.php on line 384 #434

Closed
dinamic opened this issue Sep 10, 2014 · 15 comments
Closed

Undefined variable: options in PHPExcel/Settings.php on line 384 #434

dinamic opened this issue Sep 10, 2014 · 15 comments
Assignees
Milestone

Comments

@dinamic
Copy link

dinamic commented Sep 10, 2014

I am receiving this error message:
PHP Notice: Undefined variable: options in /path/to/my/project/vendor/phpoffice/phpexcel/Classes/PHPExcel/Settings.php on line 384

It seems it has been fixed in the develop branch, but it is not merged to the last stable tag - 1.8.0.

Can you advise on how to get the fix?

@dinamic dinamic changed the title Undefined variable: options in Settings class Undefined variable: options in PHPExcel/Settings.php on line 384 Sep 10, 2014
@Progi1984 Progi1984 modified the milestone: 1.8.0 Sep 10, 2014
@MarkBaker
Copy link
Member

Either wait a couple of weeks till 1.8.1 stable release, or use the develop branch.... I'm currently final testing develop preparatory to a new release

@Progi1984 Progi1984 added this to the 1.8.1 milestone Sep 11, 2014
@bonswouar
Copy link

Hello,
Any news about the 1.8.1 release ?
We're currently using your library with liuggio/ExcelBundle, and having the Undefined variable: options problem.
Would be nice to have a new stable version tag to be able to make a PR on this Bundle.
Thank you for your work !

@quimcalpe
Copy link

@MarkBaker Is 1.8.1 going to happen? Do you recommend to use master or develop branches instead?

Thanks

@GreeKatrina
Copy link

I am getting this issue as well. Is the 1.8.1 release happening soon? It's been ~6 months now.

@GreeKatrina
Copy link

Also, not sure if this is a good solution, but to anyone else who can't wait for the update. I changed the file from this:

    public static function getLibXmlLoaderOptions()
    {
        if (is_null(self::$_libXmlLoaderOptions)) {
            self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
        }
        @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
        return self::$_libXmlLoaderOptions;
    } // function getLibXmlLoaderOptions

to this:

    public static function getLibXmlLoaderOptions()
    {
        if (is_null(self::$_libXmlLoaderOptions)) {
            self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
        }
        @libxml_disable_entity_loader(self::$_libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
        return self::$_libXmlLoaderOptions;
    } // function getLibXmlLoaderOptions

Seemed to get rid of the error for me.

@isleshocky77
Copy link

I get this as a Fatal error on the develop branch but NOT on the 1.8.1 tag.

@dinamic
Copy link
Author

dinamic commented May 7, 2015

I am not working on a project that makes use of the library, so I cant test right now.
Can someone else confirm it works, so we can thank the developer and close the issue?

Thanks!

@isleshocky77
Copy link

I would say this issue shouldn't be closed yet if this error is showing on the develop branch. From what I read on their Contributing Instructions develop is supposed to be the working copy to branch from and should be most up to date. If that's true it means that the next tag after 1.8.1 will contain this bug again.

I didn't get to dig into what is actually happening there, but it may be something with switching from $_libXmlLoaderOptions to just $libXmlLoaderOptions. The error went away when I switched all instance of $_libXmlLoaderOptions to $libXmlLoaderOptions; however, I don't know what adverse effects this will have as I just had to do it to make a minor change to something unrelated.

@dinamic
Copy link
Author

dinamic commented May 7, 2015

@MarkBaker can you advise on that?

@chordstricken
Copy link

Open up the PHPExcel_Settings class (Classes/PHPExcel/Settings.php) and see lines 368, 379, and 385. Change references of this:

self::$_libXmlLoaderOptions

to this

self::$libXmlLoaderOptions

That seemed to solve the problem for me

@isleshocky77
Copy link

@chordstricken Yes, that is what I was saying; however, I was worried why the variable names changed and if merely changing those three places would effect anything else.

After looking at that file I found the following commit 4f8c9bf by @MarkBaker which is merely a PSR code change and seems to not catch all instances of the variable $this->_libXmlLoaderOptions.

This is a little scare because it makes me extremely weary of that commit and what else it may have broken.

@marcelloitallo
Copy link

marcelloitallo commented Sep 2, 2016

Change line 379 in Settings.php
public static function getLibXmlLoaderOptions()
to
public static function getLibXmlLoaderOptions($options = null)

This worked for me!

@PowerKiKi
Copy link
Member

The original bug was fixed in 1.8.1 which was released a while ago. The rest of the mentioned bugs were fixed in https://github.com/PHPOffice/PhpSpreadsheet develop branch

@ghost
Copy link

ghost commented Jul 24, 2017

Notice: Undefined variable: zipClass in /var/www/vhost/timesheet.grazitti.com/html/PHPExcel/Writer/Excel2007.php on line 227

Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/vhost/timesheet.grazitti.com/html/PHPExcel/Writer/Excel2007.php:227 Stack trace: #0 /var/www/vhost/timesheet.grazitti.com/html/admin_report_specific_user.php(764): PHPExcel_Writer_Excel2007->save('/tmp/phpxltmpF0...') #1 {main} thrown in /var/www/vhost/timesheet.grazitti.com/html/PHPExcel/Writer/Excel2007.php on line 227

I am getting this issue. Please let me know solution and i am using 1.8.1 version.

@PowerKiKi
Copy link
Member

@seemas-grazitti, please do not copy-paste your issue report in other threads.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants