Forums / General Questions / var-type undefined: stringIgnoreNull(Daniel) - Account Edit

var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Results 1 to 20 of 20
26 May 2016, 09:21
#1
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Hi
Getting this var-type undefined: stringIgnoreNull(Daniel) , on account edit page trying to update some info.

There's no log report on this one..... javascript ?

Thanks
26 May 2016, 09:23
#2
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

I have rewards points on this page.... but not sure what should I be looking
26 May 2016, 09:28
#3
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

And also happening in address_book_process .........
26 May 2016, 09:46
#4
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

ok, I've narrow down the issue to this type stringIgnoreNull
If I change all this :
$sql_data_array = array(array('fieldName'=>'customers_firstname', 'value'=>$firstname, 'type'=>'stringIgnoreNull'),

to this :

$sql_data_array = array(array('fieldName'=>'customers_firstname', 'value'=>$firstname, 'type'=>'string'),


Life is much better.
But I guess, this is here for a reason. So where could this error coming from ? php, mysql version ?
Using php5.6.15 , mysql mysqlnd 5.0.11...

Thanks
26 May 2016, 10:11
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Where is this code from? Looks like information possibly related to ZC 1.5.5a or the recent sanitization software that should be installed/incorporated into ZC 1.5.x.
26 May 2016, 10:20
#6
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Hi
I just found out, but yes, probably that's it... I've check the lasted download package and compare it and
I had no

case 'stringIgnoreNull':
        return '\'' . $this->prepare_input($value) . '\'';
        break;



in query_factor.php .
I've downloaded the last update that you've mentioned... but there was no change on this file... Or probably I've updated to 155a and miss this file ( and hopefully, nothing else )
It's working now !

Thanks
26 May 2016, 10:35
#7
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

But looking at the docs folder changed_files-v1-5-5.html, I see no changes reported to this file...
But no one has reported this.... so I guess it's a matter of karma :)
26 May 2016, 11:46
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

1. To help others that come along this thread, could you please identify what version of ZC you are/were using when this issue arose?
2. You said something about 1.5.5 and some sort of file comparison, but how did the version of ZC you are using come to be?
3. Was this an upgrade?
4. Is/was this happening with your ZC base code or was it in relation to a plugin?
26 May 2016, 12:27
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

It's possible that the query_factory file might not have been listed in the docs as one of the changed files. But it definitely was changed!
26 May 2016, 13:14
#10
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

mc12345678:

1. To help others that come along this thread, could you please identify what version of ZC you are/were using when this issue arose?
2. You said something about 1.5.5 and some sort of file comparison, but how did the version of ZC you are using come to be?
3. Was this an upgrade?
4. Is/was this happening with your ZC base code or was it in relation to a plugin?


My current version is 155a

I started with v155
Looking at the original files from 155, this type stringIgnoreNull is not there in \includes\classes\db\mysql\query_factor.php

So it has been added on update 155a.
But it was not mentioned in the changed files docs that I followed when I updated to 155a... so... error.

This type stringIgnoreNull is use around 5 files, related to customers, accounts edits, etc...

So it's better to "reupload" the query_factor.php from 155a... in case one gets this error.

I think I've express my self very badly :)
29 May 2016, 16:20
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Note that the full name of this file is:

./includes/classes/db/mysql/query_factory.php

(for people searching for "query_factory.php")
29 May 2016, 16:29
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

It would be "really nice" if that function could be updated to log the issue rather than simply displaying it, i.e. changing the 1.5.5a version from:
  function getBindVarValue($value, $type) {
    $typeArray = explode(':',$type);
    $type = $typeArray[0];
    switch ($type) {
      case 'csv':
        return $value;
      break;
      case 'passthru':
        return $value;
      break;
      case 'float':
        return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
      break;
      case 'integer':
        return (int)$value;
      break;
      case 'string':
        if (preg_match('/NULL/', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'stringIgnoreNull':
        return '\'' . $this->prepare_input($value) . '\'';
        break;
      case 'noquotestring':
        return $this->prepare_input($value);
      break;
      case 'currency':
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'date':
        if (preg_match('/null/i', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'enum':
        if (isset($typeArray[1])) {
          $enumArray = explode('|', $typeArray[1]);
        }
        return '\'' . $this->prepare_input($value) . '\'';
      case 'regexp':
        $searchArray = array('[', ']', '(', ')', '{', '}', '|', '*', '?', '.', '$', '^');
        foreach ($searchArray as $searchTerm) {
          $value = str_replace($searchTerm, '\\' . $searchTerm, $value);
        }
        return $this->prepare_input($value);
      default:
      die('var-type undefined: ' . $type . '('.$value.')');
    }
  }

to
  function getBindVarValue($value, $type) {
    $typeArray = explode(':',$type);
    $type = $typeArray[0];
    switch ($type) {
      case 'csv':
        return $value;
      break;
      case 'passthru':
        return $value;
      break;
      case 'float':
        return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
      break;
      case 'integer':
        return (int)$value;
      break;
      case 'string':
        if (preg_match('/NULL/', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'stringIgnoreNull':
        return '\'' . $this->prepare_input($value) . '\'';
        break;
      case 'noquotestring':
        return $this->prepare_input($value);
      break;
      case 'currency':
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'date':
        if (preg_match('/null/i', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'enum':
        if (isset($typeArray[1])) {
          $enumArray = explode('|', $typeArray[1]);
        }
        return '\'' . $this->prepare_input($value) . '\'';
      case 'regexp':
        $searchArray = array('[', ']', '(', ')', '{', '}', '|', '*', '?', '.', '$', '^');
        foreach ($searchArray as $searchTerm) {
          $value = str_replace($searchTerm, '\\' . $searchTerm, $value);
        }
        return $this->prepare_input($value);
      default:
      trigger_error ("var-type undefined: $type ($value).", E_USER_ERROR);
    }
  }
29 May 2016, 17:20
#13
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Posts:
597
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

trigger_error - I like how things look so simple !
01 Jun 2016, 23:01
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

lat9:

It would be "really nice" if that function could be updated to log the issue rather than simply displaying it, i.e. changing the 1.5.5a version from:
  function getBindVarValue($value, $type) {
    $typeArray = explode(':',$type);
    $type = $typeArray[0];
    switch ($type) {
      case 'csv':
        return $value;
      break;
      case 'passthru':
        return $value;
      break;
      case 'float':
        return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
      break;
      case 'integer':
        return (int)$value;
      break;
      case 'string':
        if (preg_match('/NULL/', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'stringIgnoreNull':
        return '\'' . $this->prepare_input($value) . '\'';
        break;
      case 'noquotestring':
        return $this->prepare_input($value);
      break;
      case 'currency':
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'date':
        if (preg_match('/null/i', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'enum':
        if (isset($typeArray[1])) {
          $enumArray = explode('|', $typeArray[1]);
        }
        return '\'' . $this->prepare_input($value) . '\'';
      case 'regexp':
        $searchArray = array('[', ']', '(', ')', '{', '}', '|', '*', '?', '.', '$', '^');
        foreach ($searchArray as $searchTerm) {
          $value = str_replace($searchTerm, '\\' . $searchTerm, $value);
        }
        return $this->prepare_input($value);
      default:
      die('var-type undefined: ' . $type . '('.$value.')');
    }
  }

to
  function getBindVarValue($value, $type) {
    $typeArray = explode(':',$type);
    $type = $typeArray[0];
    switch ($type) {
      case 'csv':
        return $value;
      break;
      case 'passthru':
        return $value;
      break;
      case 'float':
        return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
      break;
      case 'integer':
        return (int)$value;
      break;
      case 'string':
        if (preg_match('/NULL/', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'stringIgnoreNull':
        return '\'' . $this->prepare_input($value) . '\'';
        break;
      case 'noquotestring':
        return $this->prepare_input($value);
      break;
      case 'currency':
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'date':
        if (preg_match('/null/i', $value)) return 'null';
        return '\'' . $this->prepare_input($value) . '\'';
      break;
      case 'enum':
        if (isset($typeArray[1])) {
          $enumArray = explode('|', $typeArray[1]);
        }
        return '\'' . $this->prepare_input($value) . '\'';
      case 'regexp':
        $searchArray = array('[', ']', '(', ')', '{', '}', '|', '*', '?', '.', '$', '^');
        foreach ($searchArray as $searchTerm) {
          $value = str_replace($searchTerm, '\\' . $searchTerm, $value);
        }
        return $this->prepare_input($value);
      default:
      trigger_error ("var-type undefined: $type ($value).", E_USER_ERROR);
    }
  }

lat9, are you encountering cases where that scenario actually occurs?
02 Jun 2016, 15:20
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

DrByte:

lat9, are you encountering cases where that scenario actually occurs?

I've only run into that scenario during a customization's development. I'll admit that it threw me off a bit and took additional time to debug, but no "production" cases where that issue arises.
04 Oct 2016, 22:34
#16
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

I had the same issue, upgrading from 1.5.4 to 1.5.5a. Reuploading (or uploading for the first time?) the query_factory file seems to have resolved it.
04 Oct 2016, 22:37
#17
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

Note that ./includes/classes/db/mysql/query_factory.php changed from 1.5.5 to 1.5.5a, so if you upgraded but neglected to upgrade this file, or used the 1.5.5 copy, that would cause this problem.
11 Oct 2016, 03:36
#18
dtomlinson avatar

dtomlinson

New Zenner

Join Date:
Jan 2016
Posts:
23
Plugin Contributions:
0

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

It's possibly uglier? I downloaded 1.5.5a from git-hub,

* @version GIT: $Id: Author: Ian Wilson Modified in v1.6.0 $

which has different definition for 'string' and no definition for 'stringIgnoreNull'

Is it now being taken out of the latest code?

Ouch!
11 Oct 2016, 05:15
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

DTomlinson:

It's possibly uglier? I downloaded 1.5.5a from git-hub,

* @version GIT: $Id: Author: Ian Wilson Modified in v1.6.0 $

which has different definition for 'string' and no definition for 'stringIgnoreNull'

Is it now being taken out of the latest code?

Ouch!

Are you trying to say something's not working properly in your v155 site?
18 Dec 2016, 14:25
#20
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Posts:
10,620
Plugin Contributions:
212

Re: var-type undefined: stringIgnoreNull(Daniel) - Account Edit

This should only happen in situations where there are customizations that have not been brought up to date. Prior to the Trustwave fixes, the array to be passed to $db->perform could be updated like this:

          $sql_data_array['tax_id'] = $tax_id;
          $sql_data_array['tax_exempt'] = $tax_exempt;


Now it needs to be updated like this:

          $sql_data_array[] = array('fieldName'=>'tax_id', 'value'=>$tax_id, 'type'=>'stringIgnoreNull');
          $sql_data_array[] = array('fieldName'=>'tax_exempt', 'value'=>$tax_exempt, 'type'=>'stringIgnoreNull');