[albums] mysql error 1048] Column 'nb_images' cannot be null #59

Closed
opened 2026-10-04 23:41:49 +02:00 by adam · 4 comments
Owner

Reported by durenor on 1 Jan 2008 05:41

Version: 1.7.0

error can occurs in multiple places.

  1. synchronizing "only directories" or directories that contains no images
  2. disassociating all images from a category

Steps to reproduce: 1. goto Admin > Categories > Synchronize
2. create empty folders in galleries
2. choose "only directories"
3. uncheck "only perform a simulation"

Additional information: admin/include/functions.php at line: 600

600c600

< if (isset($data[$key]) and $data[$key] != '')

> if (isset($data[$key]) and strlen($data[$key]) > 0)

Piwigo Bugtracker #788

**Reported by durenor on 1 Jan 2008 05:41** **Version:** 1.7.0 error can occurs in multiple places. 1. synchronizing &quot;only directories&quot; or directories that contains no images 2. disassociating all images from a category **Steps to reproduce:** 1. goto Admin &gt; Categories &gt; Synchronize 2. create empty folders in galleries 2. choose &quot;only directories&quot; 3. uncheck &quot;only perform a simulation&quot; **Additional information:** admin/include/functions.php at line: 600 600c600 ## &lt; if (isset($data[$key]) and $data[$key] != &#039;&#039;) &gt; if (isset($data[$key]) and strlen($data[$key]) &gt; 0) [Piwigo Bugtracker #788](http://piwigo.org/bugs/view.php?id=788) <!-- github-sync-id:97225449 -->
adam closed this issue 2026-10-04 23:41:49 +02:00
Author
Owner

Comment posted by VDigital on 1 Jan 2008 11:14

Please open a topic on forum
Steps to reproduce don't work... Synchro is perfectly running.
Your case is specific and can be solved on the forum.
Please add link here to the topic when done.

**Comment posted by VDigital on 1 Jan 2008 11:14** Please open a topic on forum Steps to reproduce don&#039;t work... Synchro is perfectly running. Your case is specific and can be solved on the forum. Please add link here to the topic when done. <!-- github-comment-id:124890319 -->
Author
Owner

Comment posted by durenor on 2 Jan 2008 01:50

interesting, i'm not sure why it did not work.
anyway, i made the changes in 'Additional Information' section, and it works.

**Comment posted by durenor on 2 Jan 2008 01:50** interesting, i&#039;m not sure why it did not work. anyway, i made the changes in &#039;Additional Information&#039; section, and it works. <!-- github-comment-id:124890356 -->
Author
Owner

Comment posted by VDigital on 2 Jan 2008 07:14

If with php 5.2.5

$data[$key] != '' give a different response than
strlen($data[$key]) > 0

We must know it!
You will get a lot of errors elsewhere!
Not only within PhpWebGallery !!!

Please create a topic on our Forum anyway!

**Comment posted by VDigital on 2 Jan 2008 07:14** If with php 5.2.5 $data[$key] != &#039;&#039; give a different response than strlen($data[$key]) &gt; 0 We must know it! You will get a lot of errors elsewhere! Not only within PhpWebGallery !!! Please create a topic on our Forum anyway! <!-- github-comment-id:124890379 -->
Author
Owner

Comment posted by mathiasm on 29 Jan 2008 20:05

From the forum: http://forum.phpwebgallery.net/viewtopic.php?id=12427
Grum said:

The best way to do the test is to use the strict comparator !== because it seems that with != PHP assume '0' as a null string....

if (isset($data[$key]) and $data[$key] !== '') {

for regressives problems, I thinks it's ok, but no regressives tests could be a good thing.
mass updates is used everywhere in synchronization, so tests have to be made.

**Comment posted by mathiasm on 29 Jan 2008 20:05** From the forum: http://forum.phpwebgallery.net/viewtopic.php?id=12427 Grum said: The best way to do the test is to use the strict comparator !== because it seems that with != PHP assume &#039;0&#039; as a null string.... if (isset($data[$key]) and $data[$key] !== &#039;&#039;) { for regressives problems, I thinks it&#039;s ok, but no regressives tests could be a good thing. mass updates is used everywhere in synchronization, so tests have to be made. <!-- github-comment-id:124890422 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#59