Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 44
  1. #31
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Quote Originally Posted by mc12345678 View Post
    So yeah, on the same/right page/topic. Hopefully as a part of the discussion you've also now started looking at applying the fixes identified up to and including ZC 1.5.5d.
    It almost sounds like you are saying that using the most current version is a good thing. That should be a Slogan.

    Advice from all appreciated and Onward Ho!

  2. #32
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Quote Originally Posted by Website Rob View Post
    It almost sounds like you are saying that using the most current version is a good thing. That should be a Slogan.

    Advice from all appreciated and Onward Ho!
    Can be (a good thing). :) at least on a test server it makes it easier to identify any possible issues ahead of time rather than just responding to what is identified by someone else. :)

    If nothing else, offering some gentle reminders. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #33
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,916
    Plugin Contributions
    13

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    i have seen this problem on a few clients sites.... just to be clear, i have now updated:

    includes/classes/db/mysql/query_factory.php

    to the latest version. and have modified the _sess_write function in:

    includes/functions/sessions.php

    to such:

    Code:
    $sql = $db->bindVars($sql, ':zvalue', $val, 'stringIgnoreNull');
    i'll see if this resolves the error.... i did see that the stringIgnoreNull as part of the bindVars in the query_factory.

    best.

  4. #34
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,971
    Plugin Contributions
    96

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Quote Originally Posted by carlwhat View Post
    i have seen this problem on a few clients sites.... just to be clear, i have now updated:

    includes/classes/db/mysql/query_factory.php

    to the latest version. and have modified the _sess_write function in:

    includes/functions/sessions.php

    to such:

    Code:
    $sql = $db->bindVars($sql, ':zvalue', $val, 'stringIgnoreNull');
    i'll see if this resolves the error.... i did see that the stringIgnoreNull as part of the bindVars in the query_factory.

    best.
    That should correct the issue, @carlwhat, providing the same functionality (without the debug-log) as the original code.

    Update: I just had a drink of coffee and reread your post. To which version of Zen Cart did you "back-port" the query_factory.php class-file?

    My guidance to store owners receiving this error where their store's query_factory.php doesn't include the stringIgnoreNull handling would be to simply cast the value to a string prior to the database update rather than copying the entire class-file.
    Last edited by lat9; 19 Jan 2017 at 01:48 PM. Reason: Added update

  5. #35
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,916
    Plugin Contributions
    13

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    @lat9

    re-reading my posts? sorry, i try to make things as clear and simple as possible...

    my clients sites are at v1.5.5; i have not done any of the updates to a-b-c or d.... the differences in the class file were small; and in fact look solely related to the stringIgnoreNull situation. the date differences were as such:

    Code:
    - * @version $Id: Author: DrByte  Sun Feb 14 17:28:50 2016 -0500 Modified in v1.5.5 $
    + * @version $Id: Author: zcwuilt Fri Apr 15 Modified in v1.5.5 $
    (not sure why the new versioning removed the year, the timestamp i can do without...)

    frankly, it really was a minor annoyance; but i do like to address all debug logs. it's one of those things that the client never says anything about it.

    so far so good.... if i see new errors related to this fix, i will post here in this thread.

    thanks again.

  6. #36
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,971
    Plugin Contributions
    96

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    @carlwhat, I was only saying that my coffee-level (or lack thereof) caused me to mis-read your post initially.

    Migrating the most recent query_factory.php to an earlier ZC 1.5.5 releases should be A-OK; I was just concerned that moving the 1.5.5d version of the module to a site using an earlier Zen Cart version could be problematic.

  7. #37
    Join Date
    Dec 2006
    Location
    Hudson Valley, New York USA
    Posts
    93
    Plugin Contributions
    0

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    I have recently begun running into this issue myself. I tried the solution suggested in post #34 above but that doesn't seen to be taking care of it. I'm posting one of the error logs below. I truncated the value of the session key because it was insanely long. I'm running version 1.5.5e of Zen Cart. Any advice is welcome.
    Code:
    [16-Oct-2017 14:41:43 America/New_York] Request URI: /catalog/metal-wine-racks-c-34_41/?zenid=2ebs3mmgmrqas9h520lq6enla1UNIONALLSELECTNULL--mXuy, IP address: 91.247.38.57
    #1  trigger_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:167]
    #2  queryFactory->show_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:139]
    #3  queryFactory->set_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:266]
    #4  queryFactory->Execute() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/functions/sessions.php:70]
    #5  _sess_write()
    #6  session_write_close() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/application_bottom.php:16]
    #7  require(/XXX/XXX/XXX/public_html/XXX/catalog/includes/application_bottom.php) called at [/XXX/XXX/XXX/public_html/XXX/catalog/index.php:105]
    
    [16-Oct-2017 14:41:43 America/New_York] PHP Fatal error:  1048:Column 'sesskey' cannot be null :: insert into sessions (sesskey, expiry, `value`)
                values (null, 1508180743, 'c2VjdXJpdHlUb2tlbnxzOjMyOiJiMjYwOGQ4ZmIyNDgxMzhhMTE2Mjk3MGJkY2YwNzI1MyI7Y3VzdG9tZXJzX2hvc3RfYWRk')
                ON DUPLICATE KEY UPDATE `value`='c2VjdXJpdHlUb2tlbnxzOjMyOiJiMjYwOGQ4ZmIyNDgxMzhhMTE2Mjk3MGJkY2YwNzI1MyI7Y3VzdG9tZXJzX2hvc3RfYWRk', expiry=1508180743 ==> (as called by) /XXX/XXX/XXX/public_html/XXX/catalog/includes/functions/sessions.php on line 70 <== in /XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php on line 167
    This is what my includes\functions\sessions.php file looks like for the session write function. Did I miss something or do something incorrectly?
    Code:
    function _sess_write($key, $val) {
        global $db;
        if (!is_object($db)) return;
        $val = base64_encode($val);
    
        global $SESS_LIFE;
        $expiry = time() + $SESS_LIFE;
    
        $sql = "insert into " . TABLE_SESSIONS . " (sesskey, expiry, `value`)
                values (:zkey, :zexpiry, :zvalue)
                ON DUPLICATE KEY UPDATE `value`=:zvalue, expiry=:zexpiry";
        $sql = $db->bindVars($sql, ':zkey', $key, 'string');
        $sql = $db->bindVars($sql, ':zexpiry', $expiry, 'integer');
        //$sql = $db->bindVars($sql, ':zvalue', $val, 'string');
        $sql = $db->bindVars($sql, ':zvalue', $val, 'stringIgnoreNull');
        $result = $db->Execute($sql);
    
        return (!empty($result) && !empty($result->resource));
      }
    Last edited by gwynwyffar; 17 Oct 2017 at 09:40 PM.

  8. #38
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Perhaps could identify how your store is different from a default store... plugins, customizations, etc... as well as the other information recommended in the posting tips that wasn't yet covered.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  9. #39
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,971
    Plugin Contributions
    96

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Quote Originally Posted by gwynwyffar View Post
    I have recently begun running into this issue myself. I tried the solution suggested in post #34 above but that doesn't seen to be taking care of it. I'm posting one of the error logs below. I truncated the value of the session key because it was insanely long. I'm running version 1.5.5e of Zen Cart. Any advice is welcome.
    Code:
    [16-Oct-2017 14:41:43 America/New_York] Request URI: /catalog/metal-wine-racks-c-34_41/?zenid=2ebs3mmgmrqas9h520lq6enla1UNIONALLSELECTNULL--mXuy, IP address: 91.247.38.57
    #1  trigger_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:167]
    #2  queryFactory->show_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:139]
    #3  queryFactory->set_error() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php:266]
    #4  queryFactory->Execute() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/functions/sessions.php:70]
    #5  _sess_write()
    #6  session_write_close() called at [/XXX/XXX/XXX/public_html/XXX/catalog/includes/application_bottom.php:16]
    #7  require(/XXX/XXX/XXX/public_html/XXX/catalog/includes/application_bottom.php) called at [/XXX/XXX/XXX/public_html/XXX/catalog/index.php:105]
    
    [16-Oct-2017 14:41:43 America/New_York] PHP Fatal error:  1048:Column 'sesskey' cannot be null :: insert into sessions (sesskey, expiry, `value`)
                values (null, 1508180743, 'c2VjdXJpdHlUb2tlbnxzOjMyOiJiMjYwOGQ4ZmIyNDgxMzhhMTE2Mjk3MGJkY2YwNzI1MyI7Y3VzdG9tZXJzX2hvc3RfYWRk')
                ON DUPLICATE KEY UPDATE `value`='c2VjdXJpdHlUb2tlbnxzOjMyOiJiMjYwOGQ4ZmIyNDgxMzhhMTE2Mjk3MGJkY2YwNzI1MyI7Y3VzdG9tZXJzX2hvc3RfYWRk', expiry=1508180743 ==> (as called by) /XXX/XXX/XXX/public_html/XXX/catalog/includes/functions/sessions.php on line 70 <== in /XXX/XXX/XXX/public_html/XXX/catalog/includes/classes/db/mysql/query_factory.php on line 167
    This is what my includes\functions\sessions.php file looks like for the session write function. Did I miss something or do something incorrectly?
    Code:
    function _sess_write($key, $val) {
        global $db;
        if (!is_object($db)) return;
        $val = base64_encode($val);
    
        global $SESS_LIFE;
        $expiry = time() + $SESS_LIFE;
    
        $sql = "insert into " . TABLE_SESSIONS . " (sesskey, expiry, `value`)
                values (:zkey, :zexpiry, :zvalue)
                ON DUPLICATE KEY UPDATE `value`=:zvalue, expiry=:zexpiry";
        $sql = $db->bindVars($sql, ':zkey', $key, 'string');
        $sql = $db->bindVars($sql, ':zexpiry', $expiry, 'integer');
        //$sql = $db->bindVars($sql, ':zvalue', $val, 'string');
        $sql = $db->bindVars($sql, ':zvalue', $val, 'stringIgnoreNull');
        $result = $db->Execute($sql);
    
        return (!empty($result) && !empty($result->resource));
      }
    Did you edit that log, or was the portion I've highlighted above part of the log? If that was part of the log, then that's the root of the issue.

  10. #40
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,916
    Plugin Contributions
    13

    Default Re: Fatal error: 1048:Column 'value' cannot be null :: insert into sessions (sesskey

    Quote Originally Posted by lat9 View Post
    Did you edit that log, or was the portion I've highlighted above part of the log? If that was part of the log, then that's the root of the issue.
    WOW! great catch @lat9!

    there is nothing the store owner can do to prevent this.

    the store is in the NY state area. the IP address is from ukraine. it looks like someone is trying to do evil via a SQL injection.

    the question exists whether this sort of attempt should generate a log in ZC or not. as there is nothing the store owner can do to prevent someone from manually manipulating the URL.

    its funny, i have modified my function to handle issues like this. i did not post it earlier, as i can not remember why i did it. no doubt i did it to handle issues like this. here is my code. the section in red is the added part, and it certainly would address the error. feel free to use at your own discretion.

    Code:
      function _sess_write($key, $val) {
        global $db;
        if (!is_object($db)) return;
        $val = base64_encode($val);
    
        global $SESS_LIFE;
        $expiry = time() + $SESS_LIFE;
    
        $sql = "insert into " . TABLE_SESSIONS . " (sesskey, expiry, `value`)
                values (:zkey, :zexpiry, :zvalue)
                ON DUPLICATE KEY UPDATE `value`=:zvalue, expiry=:zexpiry";
        $sql = $db->bindVars($sql, ':zkey', $key, 'string');
        $sql = $db->bindVars($sql, ':zexpiry', $expiry, 'integer');
        $sql = $db->bindVars($sql, ':zvalue', $val, 'stringIgnoreNull');
          if ($key != null) {
              $result = $db->Execute($sql);
            }
        return (!empty($result) && !empty($result->resource));
      }
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 
Page 4 of 5 FirstFirst ... 2345 LastLast

Similar Threads

  1. v153 PHP Fatal error: Duplicate entry for key insert into sessions
    By carlwhat in forum General Questions
    Replies: 2
    Last Post: 6 Jan 2015, 02:32 AM
  2. Replies: 2
    Last Post: 11 Dec 2012, 03:58 AM
  3. v151 How to insert a NULL value when using zen_db_perform() ?
    By retched in forum Contribution-Writing Guidelines
    Replies: 2
    Last Post: 17 Nov 2012, 02:04 AM
  4. Fatal Error - Cannot log into Admin Panel
    By featured in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 14 Aug 2008, 10:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg