Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Bug Reports / Banner Manager blank dates causes MySQL Error

Banner Manager blank dates causes MySQL Error

Started by retched on 1 Aug 2010, 9:17 AM · Views: 3,265

Results 1 to 10 of 10
1 Aug 2010, 9:17 AM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Banner Manager blank dates causes MySQL Error

Using ZenCart v1.3.9e on Windows Server with MySQL 5.1.44-community server.

While using the ACP Banner Manager, when I enter a blank expiry date and blank expiry impressions number, I'm being given the following:

1292 Incorrect datetime value: 'null'
in:
[UPDATE zen_banners SET date_scheduled = '20100801', expires_date = DATE_ADD('null', INTERVAL '23:59:59' HOUR_SECOND), expires_impressions = null WHERE banners_id = 9]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

The only suggestion that I have is to remove any 'NULL' or 'null' values and simply assign a value of '' instead. MySQL will automatically note that the 0 length string is NULL and assign it as such. The same holds true if ALL schedule values is blank.

1 Aug 2010, 2:06 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Banner Manager blank dates causes MySQL Error

That's peculiar.
I'm using the same version of MySQL, and can't recreate that problem.
If I leave expiry date and impressions blank, it correctly blanks them out, without throwing any errors.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Aug 2010, 2:08 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Banner Manager blank dates causes MySQL Error

In fact, embracing null was done with specific intent, akin to this prior bug report: http://www.zen-cart.com/forum/showthread.php?t=69347

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Aug 2010, 7:57 PM
#4
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Banner Manager blank dates causes MySQL Error

DrByte:

That's peculiar.
I'm using the same version of MySQL, and can't recreate that problem.
If I leave expiry date and impressions blank, it correctly blanks them out, without throwing any errors.

I left both expiry date and impressions blank and I get this messages:

1292 Incorrect datetime value: 'null' for column 'date_scheduled' at row 1
in:
[UPDATE zen_banners SET date_scheduled = 'null', expires_date = DATE_ADD('null', INTERVAL '23:59:59' HOUR_SECOND), expires_impressions = null WHERE banners_id = 9]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

This was while I was running admin/banner_manager.php?page=1&action=update

Any suggestions?

1 Aug 2010, 8:26 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Banner Manager blank dates causes MySQL Error

What's the schema for your zen_banners table?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

1 Aug 2010, 9:03 PM
#6
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Banner Manager blank dates causes MySQL Error

I figured it out DrByte.

My Database, MySQL 5.1.44, was running in STRICT MODE. Which in turn, prevents the insertion of NULL Variables into the database. After shutting down and restarting, making sure to disable the strict mode, I managed to get to work.

14 Apr 2011, 9:34 AM
#7
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Banner Manager blank dates causes MySQL Error

I've just ran into this issue too (as I'm running MySQL in strict mode).

Is there any way to fix this (other than turning off strict mode)?

My Contributions: Zen Lightbox | Best Sellers Reloaded

14 Apr 2011, 12:48 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Banner Manager blank dates causes MySQL Error

Not without rewriting a bunch of code.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Apr 2011, 9:40 PM
#9
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Banner Manager blank dates causes MySQL Error

Thanks for the update DrByte.

Will this be treated as a bug, or is it the view of the Dev. Team that ZC compatibility with MySQL strict mode doesn't matter?

Always good to hear different people's opinions. :)

All the best,

Alex

My Contributions: Zen Lightbox | Best Sellers Reloaded

15 Apr 2011, 2:00 AM
#10
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Banner Manager blank dates causes MySQL Error

Alex Clarke:

Thanks for the update DrByte.

Will this be treated as a bug, or is it the view of the Dev. Team that ZC compatibility with MySQL strict mode doesn't matter?

Always good to hear different people's opinions. :)

All the best,

Alex

Most servers, at least those I encountered, aren't really run in Strict Mode. I only had it turned on because as I was installing MySQL, I checked the box being an idiot not realizing what I was doing.