dweeves/magmi-git — pull request #82 by PatrickCronin (2014-07-30 13:51:11+00:00)
Title: Update dbhelper.class.php: filterkvarr()

This problem prevented me from performing a stock update using a fresh install of Magmi 0.7.19a on a fresh install of Magento CE 1.9.0.1. I created two simple products in Magento and tried to update their stock information them using Magmi. I created a two-column CSV ("sku" and "qty") and attempted to import it. I got the following errors:

1 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'use_config_manage_stock' cannot be null -
2 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'use_config_manage_stock' cannot be null - ERROR ON RECORD #1
3 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'use_config_manage_stock' cannot be null -
4 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'use_config_manage_stock' cannot be null - ERROR ON RECORD #2

More details on this error are here: https://sourceforge.net/p/magmi/discussion/1228365/thread/8e722889/

I tracked the problem to filterkvarr(). If the $kvarr has values which are numerical 0's, the function changes their values to null. This is because var_dump(0 == '__NULL__'); // 0 == 0 -> true. However, var_dump(0 === '__NULL__'); // 0 !== '__NULL__' -> false. So I suggest this change. (See PHP's documentation on this: http://us1.php.net/operators.comparison).