修复高版本MySQL+Php环境下News Box Manager出错
1292 Incorrect datetime value: 'NULL' for column 'news_end_date' at row 1 in: [insert into box_news (news_start_date, news_end_date, news_added_date, news_status) values ('2026-10-12 00:00:00', 'NULL', now(), '0')] 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.
出错原因
- 结束日期使用了字符串 'NULL'
- 日期校验与空值处理不一致
- 新增文章时没有处理 news_image 字段
- 数据库处于严格模式
修复方式
生效日期 新增文章时,默认当天
结束日期 新增文章时,默认 2099-12-31
日期比较 使用实际日期值进行比较,不再依赖字符串 'NULL'
封面图片 新建文章时允许暂时为空,后续通过原有封面管理功能设置
数据库写入 让 PHP 插入的数据与数据库字段约束一致
替换文件到AdminPath下
news_box_manager.zip
最后更新于 2026-10-12 「部分内容存在时效性,如有失效请留言反馈」
除注明外为 过气码农的自留地 原创文章,转载请注明出处。
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
本文链接:http://185858.xyz/blog/index.php/zencart/zencart_news_box_manager_fix.html