ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Postgres Error after update to 1.7.2

September 14, 2009 4:44am

Subscribe [3]
  • #1 / Sep 14, 2009 4:44am

    Milaan

    33 posts

    Hello,

    after the update to CI 1.7.2 i get the following error:

    A PHP Error was encountered

    Severity: Notice

    Message: Undefined property: CI_DB_postgre_driver::$_like_escape_char

    Filename: database/DB_active_rec.php

    Line Number: 728

    Any idea what is causing this?

  • #2 / Sep 14, 2009 7:20am

    Milaan

    33 posts

    Hmmm looks like $this->_like_escape_char is undefined in this function…

    // --------------------------------------------------------------------
    
        /**
         * Like
         *
         * Called by like() or orlike()
         *
         * @access    private
         * @param    mixed
         * @param    mixed
         * @param    string
         * @return    object
         */
        function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
        {
            if ( ! is_array($field))
            {
                $field = array($field => $match);
            }
         
            foreach ($field as $k => $v)
            {
                $k = $this->_protect_identifiers($k);
    
                $prefix = (count($this->ar_like) == 0) ? '' : $type;
    
                $v = $this->escape_like_str($v);
    
                if ($side == 'before')
                {
                    $like_statement = $prefix." $k $not LIKE '%{$v}'";
                }
                elseif ($side == 'after')
                {
                    $like_statement = $prefix." $k $not LIKE '{$v}%'";
                }
                else
                {
                    $like_statement = $prefix." $k $not LIKE '%{$v}%'";
                }
                
                // some platforms require an escape sequence definition for LIKE wildcards
                if ($this->_like_escape_str != '')
                {
                    $like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_char);
                }
                
                $this->ar_like[] = $like_statement;
                if ($this->ar_caching === TRUE)
                {
                    $this->ar_cache_like[] = $like_statement;
                    $this->ar_cache_exists[] = 'like';
                }
                
            }
            return $this;
        }
  • #3 / Sep 17, 2009 3:49am

    Milaan

    33 posts

    Can anyone help?

  • #4 / Sep 17, 2009 9:52am

    wabu

    96 posts

    I was able to reproduce the error with the like() function using CI Rev. 1746 (2009-09-17). It appears that ‘_like_escape_char’ really isn’t defined anywhere in CI.

    This variable doesn’t exist in 1.7.1 so it must be new to 1.7.2 (Change Log mentions the new ‘like’ stuff).

  • #5 / Sep 18, 2009 8:35am

    Milaan

    33 posts

    Can anyone from EllisLab confirm this Bug and maybe post a quick fix ??? Thanks.

  • #6 / Sep 18, 2009 11:02am

    wabu

    96 posts

    All the driver files define ‘$_like_escape_chr’ (not ‘$_like_escape_char’) so it appears it’s a simple error.

    See:

    - postgre_driver.php
    - mysql_driver.php
    - etc.

  • #7 / Sep 18, 2009 11:10am

    Milaan

    33 posts

    OK, its possible to fix this temporarly

    725 // some platforms require an escape sequence definition for LIKE wildcards
    726    if ($this->_like_escape_str != '')
    727 {
    728        $like_statement = $like_statement.sprintf($this->_like_escape_str, @$this->_like_escape_char);
    729 }

    Just add an @ before _like_escape_char in line 728

  • #8 / Sep 23, 2009 11:44am

    Well, i’ve got the same error with my DB_active_rec.php and oci8_driver.php on the same line 728.

    why use @ if the cure is to spell the variable well ?

    i corrected the variable.
    it works.

    maybe, i’ll try to find where to report this bug.

  • #9 / Oct 28, 2009 4:06pm

    Eddie Monge

    9 posts

    Here’s where all the misspelled characters are:

    Search “_like_escape_char” (6 hits in 6 files)

    system\database\DB_active_rec.php (1 hits)
    Line 728:
    $like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_char);


    system\database\drivers\mssql\mssql_driver.php (1 hits)
    Line 392:
    //$sql .= ” LIKE ‘“.$this->escape_like_str($this->dbprefix).”%’ “.sprintf($this->_like_escape_str, $this->_like_escape_char);


    system\database\drivers\oci8\oci8_driver.php (1 hits)
    Line 496:       
    $sql .= ” WHERE TABLE_NAME LIKE ‘“.$this->escape_like_str($this->dbprefix).”%’ “.sprintf($this->_like_escape_str, $this->_like_escape_char);


    system\database\drivers\odbc\odbc_driver.php (1 hits)
    Line 365:       
    //$sql .= ” LIKE ‘“.$this->escape_like_str($this->dbprefix).”%’ “.sprintf($this->_like_escape_str, $this->_like_escape_char);


    system\database\drivers\postgre\postgre_driver.php (1 hits)
    Line 408:       
    $sql .= ” AND table_name LIKE ‘“.$this->escape_like_str($this->dbprefix).”%’ “.sprintf($this->_like_escape_str, $this->_like_escape_char);


    system\database\drivers\sqlite\sqlite_driver.php (1 hits)
    Line 377:       
    $sql .= ” AND ‘name’ LIKE ‘“.$this->escape_like_str($this->dbprefix).”%’ “.sprintf($this->_like_escape_str, $this->_like_escape_char);

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases