Editor/DataTables not working with Oracle 11g after upgrade to PHP version 1.7.4

Editor/DataTables not working with Oracle 11g after upgrade to PHP version 1.7.4

zajczajc Posts: 67Questions: 10Answers: 2
edited August 2018 in Bug reports

After the upgrade to PHP version 1.7.4, queries from Oracle 11g stops working. I'm getting the following errors (2 times):

Warning: Declaration of DataTables\Database\DriverOracleResult::fetch() should be compatible with DataTables\Database\Result::fetch($fetchType = PDO::FETCH_ASSOC) in /var/www/html/php/lib/Database/Driver/Oracle/Result.php on line 22

Warning: Declaration of DataTables\Database\DriverOracleResult::fetchAll() should be compatible with DataTables\Database\Result::fetchAll($fetchType = PDO::FETCH_ASSOC) in /var/www/html/php/lib/Database/Driver/Oracle/Result.php on line 22

I have tried to copy Oracle driver .php files from version 1.7.3, but the same error occured. I was forced to downgrade back to 1.7.3.

Replies

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    My apologies, you are absolutely right. The Oracle Result.php file should be:

    <?php
    /**
     * Oracle database driver for Editor
     *
     *  @author    SpryMedia
     *  @copyright 2014 SpryMedia ( http://sprymedia.co.uk )
     *  @license   http://editor.datatables.net/license DataTables Editor
     *  @link      http://editor.datatables.net
     */
    
    namespace DataTables\Database;
    if (!defined('DATATABLES')) exit();
    
    use PDO;
    use DataTables\Database\Result;
    
    
    /**
     * MySQL driver for DataTables Database Result class
     *  @internal
     */
    class DriverOracleResult extends Result {
        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * Constructor
         */
    
        function __construct( $dbh, $stmt, $pkey_val )
        {
            $this->_dbh = $dbh;
            $this->_stmt = $stmt;
            $this->_pkey_val = $pkey_val;
        }
    
    
    
        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * Private properties
         */
    
        private $_stmt; // Result from oci_parse
        private $_dbh; // Result from oci_connect
        private $_rows = null;
        private $_pkey_val;
    
    
    
        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         * Public methods
         */
    
        public function count ()
        {
            return count($this->fetchAll());
        }
    
    
        public function fetch ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
        {
            return oci_fetch_assoc( $this->_stmt );
        }
    
    
        public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
        {
            if ( ! $this->_rows ) {
                $out = array();
            
                oci_fetch_all( $this->_stmt, $out, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC );
    
                $this->_rows = $out;
            }
    
            return $this->_rows;
        }
    
    
        public function insertId ()
        {
            return $this->_pkey_val;
        }
    }
    

    That will be corrected in the next release!

    Regards,
    Allan

  • zajczajc Posts: 67Questions: 10Answers: 2

    Thanks. It works now.

This discussion has been closed.