Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Commit

Permalink
* Fixed throwing undefined property, interrrupting scripts in Zend_Db…
Browse files Browse the repository at this point in the history
…_Table_Abstract zendframework#720
tavy315 committed Sep 26, 2016

Unverified

This user has not yet uploaded their public signing key.
1 parent 6b765aa commit 9ebba76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions library/Zend/Db/Table/Abstract.php
Original file line number Diff line number Diff line change
@@ -749,7 +749,7 @@ protected function _setup()
*/
protected function _setupDatabaseAdapter()
{
if (! $this->_db) {
if (!isset($this->_db)) {
$this->_db = self::getDefaultAdapter();
if (!$this->_db instanceof Zend_Db_Adapter_Abstract) {
require_once 'Zend/Db/Table/Exception.php';
@@ -773,7 +773,7 @@ protected function _setupTableName()
{
if (! $this->_name) {
$this->_name = get_class($this);
} else if (strpos($this->_name, '.')) {
} elseif (strpos($this->_name, '.')) {
list($this->_schema, $this->_name) = explode('.', $this->_name);
}
}
@@ -871,7 +871,7 @@ protected function _getCols()
*/
protected function _setupPrimaryKey()
{
if (!$this->_primary) {
if (!isset($this->_primary)) {
$this->_setupMetadata();
$this->_primary = array();
foreach ($this->_metadata as $col) {
@@ -888,9 +888,9 @@ protected function _setupPrimaryKey()
require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("A table must have a primary key, but none was found for table '{$this->_name}'");
}
} else if (!is_array($this->_primary)) {
} elseif (!is_array($this->_primary)) {
$this->_primary = array(1 => $this->_primary);
} else if (isset($this->_primary[0])) {
} elseif (isset($this->_primary[0])) {
array_unshift($this->_primary, null);
unset($this->_primary[0]);
}
@@ -1313,7 +1313,7 @@ public function find()
}
if ($numberTerms == 0) {
$numberTerms = $keyValuesCount;
} else if ($keyValuesCount != $numberTerms) {
} elseif ($keyValuesCount != $numberTerms) {
require_once 'Zend/Db/Table/Exception.php';
throw new Zend_Db_Table_Exception("Missing value(s) for the primary key");
}

0 comments on commit 9ebba76

Please sign in to comment.