mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 663 forks source link

PHP 8.2 deprecation warning, passing NULL to htmlspecialchars #355

Open davidearl opened 7 months ago

davidearl commented 7 months ago

Many thanks for this code.

I have some quite strict error checking in place, and I am getting a deprecation warning in PHP 8.2 that I don't get in earlier versions of PHP

It happens when some properties are not set, like Company or Title.

The properties in the main class are not initialized. So when it comes to writing them out, it passes NULL to htmlspecialchars in buildAppXML, passing an uninitialised variable to a system function. That is now deprecated, but probably unintentional.

Is etc required in the format? If not, I'd suggest omitting it if it is not set. If it is, I'd suggest initialising the various properties (as tags are for example).

Obviously, I worked around this by calling the setter functions for these, which without parameters do initialise the problem properties.

Kadigan commented 4 months ago

I am having the same issue. I would expect these values to either be initialised, or - should they explicitly not be by contributor choice - for an E_NOTICE to be emitted, so that I'm aware that I must set them.

sayid commented 4 months ago

您好,我已经收到您的信件,将尽快回复您。