Author: ts
Date: Mon Jan 7 19:23:51 2008
New Revision: 7094
Log:
- Fixed issue #12108: ezcPersistentStateTransformer::rowToStateArray() relying
on definitions with reverse properties set, but it's not automatic.
Modified:
stable/PersistentObject/1.3/ChangeLog
stable/PersistentObject/1.3/src/internal/state_transformer.php
stable/PersistentObject/1.3/tests/persistent_session_test.php
Modified: stable/PersistentObject/1.3/ChangeLog
==============================================================================
--- stable/PersistentObject/1.3/ChangeLog [iso-8859-1] (original)
+++ stable/PersistentObject/1.3/ChangeLog [iso-8859-1] Mon Jan 7 19:23:51 2008
@@ -1,3 +1,10 @@
+1.3.4 - [RELEASEDATE]
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fixed issue #12108: ezcPersistentStateTransformer::rowToStateArray() relying
+ on definitions with reverse properties set, but it's not automatic.
+
+
1.3.3 - Monday 17 December 2007
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modified: stable/PersistentObject/1.3/src/internal/state_transformer.php
==============================================================================
--- stable/PersistentObject/1.3/src/internal/state_transformer.php [iso-8859-1]
(original)
+++ stable/PersistentObject/1.3/src/internal/state_transformer.php [iso-8859-1]
Mon Jan 7 19:23:51 2008
@@ -35,11 +35,19 @@
*/
public static function rowToStateArray( array $row,
ezcPersistentObjectDefinition $def )
{
+ // Sanity check for reverse-lookup
+ // Issue #12108
+ if ( count( $def->columns ) === 0 )
+ {
+ throw new ezcPersistentObjectException(
+ "The PersistentObject defitnion for class {$def->class} was
not initialized correctly.",
+ 'Missing reverse lookup for columns. Check the definition
manager.'
+ );
+ }
+
$result = array();
foreach ( $row as $key => $value )
{
- // todo: everything in $row is of type string
- // should we convert to the correct PHP type?
if ( $key == $def->idProperty->columnName )
{
$result[$def->idProperty->propertyName] = $value;
Modified: stable/PersistentObject/1.3/tests/persistent_session_test.php
==============================================================================
--- stable/PersistentObject/1.3/tests/persistent_session_test.php [iso-8859-1]
(original)
+++ stable/PersistentObject/1.3/tests/persistent_session_test.php [iso-8859-1]
Mon Jan 7 19:23:51 2008
@@ -788,6 +788,22 @@
$this->removeTempDir();
}
+
+ /**
+ * Test case for issue #12108.
+ */
+ public function testMissingReverseColumnLookup()
+ {
+ // Load def without def manager
+ $def = require dirname( __FILE__ ) . '/data/persistenttestobject.php';
+
+ try
+ {
+ ezcPersistentStateTransformer::rowToStateArray( array(), $def );
+ $this->fail( 'Exception not thrown on state transformation without
proper reverse-lookup.' );
+ }
+ catch ( ezcPersistentObjectException $e ) {}
+ }
}
?>
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components