csvExport PHP 8.1

8 posts by 3 authors in: Forums > CMS Builder
Last Post: January 30, 2023   (RSS)

By KennyH - November 17, 2022

I have the latest csvExport 1.05 and just tried to use it after updating to PHP 8.1.12 and got the same error back about 30+ times I think

#38 - E_DEPRECATED: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
/home/sagedev/domains/sagentic.dev/public_html/webadmin/plugins/csvExport/csvExport.php (line 178)
https://www.sagentic.dev/webadmin/admin.php

It exports the file but the majority of the values in the num column are an error (An unexpected error occurred: #38)

It seems random that some of the numbers showed up while others showed an error message like this:

num createdDate

(An unexpected error occurred: #14)
2 2005-01-21 00:00:00
(An unexpected error occurred: #15)
(An unexpected error occurred: #16)
(An unexpected error occurred: #17)
(An unexpected error occurred: #18)
(An unexpected error occurred: #19)
4 2006-10-18 00:00:00
(An unexpected error occurred: #20)
10 2008-10-17 00:00:00
(An unexpected error occurred: #21)
11 2009-02-10 00:00:00
(An unexpected error occurred: #22)
12 2008-12-01 00:00:00
(An unexpected error occurred: #23)
(An unexpected error occurred: #24)
(An unexpected error occurred: #25)
(An unexpected error occurred: #26)
(An unexpected error occurred: #27)
14 2010-09-07 00:00:00
(An unexpected error occurred: #28)
18 2006-07-31 00:00:00

By Dave - November 17, 2022

Hi Kenny, 

Thanks for the report.  Can you try this fix and let me know if it works for you?

  • Search for "function _csvExport_escapeAsCSV"
  • Add the second line below: 
function _csvExport_escapeAsCSV($value) {
$value = $value ?? '';

Let me know if that works for you.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

By KennyH - November 18, 2022

Hi Dave - 

Another successful fix! Worked like it should

Thanks,

Kenny

By Dave - November 18, 2022

Ok great, thanks for your help testing that fix.

I've released a new version of the plugin with this patch included for anyone else who needs them in future: 
https://www.interactivetools.com/plugins/csv-export/

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By KennyH - December 8, 2022

Hi Dave - 

There might be another issue that I am facing with php 8.1 and this plugin. It seems that all of my exports now change the characters to default windows encoding instead UTF-8 HTML entities such as:

  • Apostrophes are displayed as don’t  (don't)
  • Double spaces are displayed as Â

I'm not modifying or opening the files after export. Export from one installation and then import to another - so I'm pretty sure it's being generated like this

Kenny

By Dave - December 22, 2022

Hi Kenny, 

Are you still having issues with this?  If so could you fill out a second-level support request and we can take a look? 
https://www.interactivetools.com/support/request/

Thanks!

Dave Edis - Senior Developer
interactivetools.com

csvExport PHP 8.1...was going to report a slightly diff issue, but your v1.06 corrected this...

By Codee - January 26, 2023

Hi Dave,

I was going to report the error: #1467 - UNCAUGHT_EXCEPTION: Cannot access offset of type string on string
/xxx/xxxx.com/xxxAdminxxx/plugins/csvExport_1-04/csvExport/csvExport.php (line 101)
https://xxxx.com/xxxxAdminxxx/admin.php

B U U T...your version 1.06 eliminated the error.

Thank you!