Warning: [mysql error 1364] Field 'id' doesn't have a default value
INSERT INTO piwigo_tags
(name,url_name)
VALUES('newtag','newtag') in [...]/include/dblayer/functions_mysqli.inc.php on line 845
Piwigo reports that the tag has been successfully added, but it hasn't.
The same issue occurs when searching:
Warning: [mysql error 1364] Field 'id' doesn't have a default value
INSERT INTO piwigo_search
(rules, last_seen)
VALUES
('a:1:{s:1:\"q\";s:6:\"foobar\";}', NOW() )
; in [...]/include/dblayer/functions_mysqli.inc.php on line 845
Tested using Piwigo 2.9.4, MariaDB 10.3 and PHP 7.
The simple "echo error" in functions_mysqli.inc.php does also cause a Warning: Cannot modify header information - headers already sent by (output started at [...]/include/dblayer/functions_mysqli.inc.php:844) in [...]/include/page_header.php on line 101.
I have the following issue when adding a new tag:
```
Warning: [mysql error 1364] Field 'id' doesn't have a default value
INSERT INTO piwigo_tags
(name,url_name)
VALUES('newtag','newtag') in [...]/include/dblayer/functions_mysqli.inc.php on line 845
```
Piwigo reports that the tag has been successfully added, but it hasn't.
The same issue occurs when searching:
```
Warning: [mysql error 1364] Field 'id' doesn't have a default value
INSERT INTO piwigo_search
(rules, last_seen)
VALUES
('a:1:{s:1:\"q\";s:6:\"foobar\";}', NOW() )
; in [...]/include/dblayer/functions_mysqli.inc.php on line 845
```
Tested using Piwigo 2.9.4, MariaDB 10.3 and PHP 7.
The simple "echo error" in `functions_mysqli.inc.php` does also cause a `Warning: Cannot modify header information - headers already sent by (output started at [...]/include/dblayer/functions_mysqli.inc.php:844) in [...]/include/page_header.php on line 101`.
<!-- github-sync-id:391379219 -->
The issue is in the table schema (e.g. for piwigo_search):
+-----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| id | int(10) unsigned | NO | PRI | NULL | |
| last_seen | date | YES | | NULL | |
| rules | text | YES | | NULL | |
+-----------+------------------+------+-----+---------+-------+
NULL is not allowed for id, but the default is NULL.
This seems to affect all tables in piwigo_structure-mysql.sql that are just using NOT NULL auto_increment.
The issue is in the table schema (e.g. for `piwigo_search`):
```
+-----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| id | int(10) unsigned | NO | PRI | NULL | |
| last_seen | date | YES | | NULL | |
| rules | text | YES | | NULL | |
+-----------+------------------+------+-----+---------+-------+
```
`NULL` is not allowed for `id`, but the default is `NULL`.
This seems to affect all tables in [piwigo_structure-mysql.sql](https://github.com/Piwigo/Piwigo/blob/master/install/piwigo_structure-mysql.sql) that are just using `NOT NULL auto_increment`.
<!-- github-comment-id:447569754 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I have the following issue when adding a new tag:
Piwigo reports that the tag has been successfully added, but it hasn't.
The same issue occurs when searching:
Tested using Piwigo 2.9.4, MariaDB 10.3 and PHP 7.
The simple "echo error" in
functions_mysqli.inc.phpdoes also cause aWarning: Cannot modify header information - headers already sent by (output started at [...]/include/dblayer/functions_mysqli.inc.php:844) in [...]/include/page_header.php on line 101.The issue is in the table schema (e.g. for
piwigo_search):NULLis not allowed forid, but the default isNULL.This seems to affect all tables in piwigo_structure-mysql.sql that are just using
NOT NULL auto_increment.Solved.