Problem with empty strings in database on oxvm_base

Hi all…
I have a weird problem related to DEFAULT value in database…

Introduction:

  • I think problem could be also related with local environment (oxvm_base:v3.1.0 on Ubuntu).
  • I have a module which works perfect in last few years. It has table definition inside where one of column has this definition:
    MYFIELDNAME char(32) NOT NULL DEFAULT ‘’ COMMENT ‘My custom comment…’

Problem:
Problem is, that when oxid model creates a new record in the database with ‘’ inside! Not with real empty string.
Dumped db data looks like this: '\'\'' and it should like this: ''

in result this code:
$result = ('' !== $sPayPalAgreementError) ? $sPayPalAgreementError : false;

should return FALSE but it return value of $sPayPalAgreementError where $sPayPalAgreementError === ''''. When we decode '''' === '\'\''

Already tested:

  • Before reinstall my system, eveything works perfect. I didn’t made any changes in code. Only installation a fres Linux system with Vagrant, etc…
  • I tried reinstall database engine, change mariadb/mysql versions, sql_modes withotu success :frowning:

Any suggestions?

https://bugs.oxid-esales.com/view.php?id=6914

complement:
MYFIELDNAME char(32) NOT NULL DEFAULT ‘’ COMMENT ‘My custom comment…’
You dont need DEFAULT ‘’ because a new char-field with NOT NULL is always empty.

2 Likes

thanks a lot. After reading it, it might have sense :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.