Doctrine 1
  1. Doctrine 1
  2. DC-184

Doctrine_Connection_Statement->execute() gerenates a PHP warning with Doctrine 1.2 BETA1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-BETA1
    • Fix Version/s: 1.2.0-BETA2
    • Component/s: Connection
    • Labels:
      None
    • Environment:

      Description

      // switch between 1.2 ALPHA3 and 1.2 BETA1
      //require_once('../CMS/Doctrine-1.2.0-ALPHA3-Sandbox/lib/Doctrine.php');
      require_once('../CMS/Doctrine-1.2.0-BETA1-Sandbox/lib/Doctrine.php');
      
      spl_autoload_register(array('Doctrine', 'autoload'));
      $manager = Doctrine_Manager::getInstance();
      $conn = Doctrine_Manager::connection('mysql://user:password@localhost/test');
      
      // table creation (done with Doctrine 1.2 ALPHA3)
      //$conn->export->createTable('test', array('name' => array('type' => 'string')));
      //$conn->execute('INSERT INTO test (name) VALUES (?)', array('vince'));
      
      // retreive data from table
      $stmt = $conn->prepare('SELECT * FROM test');
      $stmt->execute();
      $results = $stmt->fetchAll();
      var_dump($results);
      

      In the code above, $stmt->execute(); generates a warning (but the data is retreived from the table) under 1.2 BETA1 (no problem with 1.2 ALPHA3) :

      Warning: Invalid argument supplied for foreach() in F:\Vince\devweb\CMS\Doctrine-1.2.0-BETA1-Sandbox\lib\Doctrine\Connection\Statement.php on line 245
      Line 245 is part of a block of code added in lib/Connection/Statement.php (execute function) in 1.2 BETA1 :

      $pos = 0;
       foreach ($params as $key => $value) {
          $pos++;
          $param = is_numeric($key) ?  $pos : $key;
          if (is_resource($value)) {
              $this->_stmt->bindParam($param, $params[$key], Doctrine_Core::PARAM_LOB);
          } else {
              $this->_stmt->bindParam($param, $params[$key]);
          }
      }
      

      The call stack from xdebug shows the function : Doctrine_Connection_Statement->execute()

      I see the warning because of my php.ini settings : error_reporting = E_ALL
      I mention this issue because sometimes a warnig may result in a more important error later in the code.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Vincent Delhommeau
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: