Forums / Bug Reports / Edit customer depriciated null string on customer referal

Edit customer depriciated null string on customer referal

Views: 1,648

Results 1 to 7 of 7
16 Oct 2023, 1:54 PM
#1
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Edit customer depriciated null string on customer referal

[Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here.
And, remove this comment before actually posting!]
pezcollectors.com, 1.5.8a, PHP 8.1.24
verified admin/customers.php IS stock unmodified

Editing any customer throws the error below. Looks like its because of the empty customer referral.
[16-Oct-2023 08:48:52 America/Chicago] Request URI: /nimda123/index.php?cmd=customers&page=1&cID=25052&action=edit, IP address: 73.67.37.4, Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /nimda123/customers.php(1061): htmlspecialchars()
#2 /nimda123/index.php(11): require('/home/pcs/publi...')
--> PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /nimda123/customers.php on line 1061.

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

17 Oct 2023, 12:12 PM
#2
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Edit customer depriciated null string on customer referal

The answer is in the upgrading to 1.5.8 doc.
Line 1058 should be changed from:

$cInfo->customers_referral,

to:

$cInfo->customers_referral ?? '',

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

17 Oct 2023, 1:10 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: Edit customer depriciated null string on customer referal

gothstone:

The answer is in the upgrading to 1.5.8 doc.
Line 1058 should be changed from:

$cInfo->customers_referral,

> to:
> ```
$cInfo->customers_referral ?? '',

Where did you find this documented (a link, please)? I'm asking because the customers::customers_referral field has been defined as NOT NULL default '' since at least Zen Cart 1.5.5.

17 Oct 2023, 1:34 PM
#4
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Edit customer depriciated null string on customer referal

https://docs.zen-cart.com/dev/plugins/upgrading_to_158/
"PHP 8.1 and null strings passed as parameters"
was almost identical to my issue.

I don't see anything about it in my upgrade exceptions, but I DO see that my clean blank 1.5.8 reference DB is set to Null NO with no default. My actual DB is Null Yes Default Null.

It looks like it was always blank until Dec 2011 which corresponds to an upgrade of edit orders, and numinix endicia exporter, and probably a few others. So I'm sure one of my mods went sideways and caused this.

So set default to blank, wipe out the nulls, and set null to no?

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

17 Oct 2023, 1:40 PM
#5
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Edit customer depriciated null string on customer referal

Ugh. Comparing the clean to current, I have a LOT of cleanup/fixing to doAttachment 20407

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

17 Oct 2023, 2:22 PM
#6
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Edit customer depriciated null string on customer referal

So thinking on this, clearly I can't trust my database structure. Feel free to move this to another section of the forum, clearly this is NOT a bug in ZC.
I plan to do the following:

  1. Create another dev site with a clean ZC_install with a blank DB
  2. Drop my prod fileset on top
  3. Log into admin, let my mods install
  4. Drop on any manual SQL installed for any of my mods
  5. Make sure all mods are active and installed
  6. Compare structure of THAT DB to my current
  7. Build SQL statements to fix all structure and data to align

Does anyone have suggestions on good tools to help with the structure comparison and data correction?

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

17 Oct 2023, 6:33 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: Edit customer depriciated null string on customer referal

gothstone:

Ugh. Comparing the clean to current, I have a LOT of cleanup/fixing to doAttachment 20407
Yikes, the only nullable fields in a standard Zen Cart database are the customers_fax and customers_newsletters fields!