Details
-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
3.8.8, 3.9.2
-
None
-
n/a
Description
The concerned class is eZContentClass, described in file kernel/classes/ezcontentclass.php .
Using the api method removeAttributes() may result in some fatal errors due to the use of a non existing variable.
The method called removeAttributes() should allow to remove any attributes given in a parameter array ( http://pubsvn.ez.no/doxygen/3.8/html/classeZContentClass.html#420f01cdbc9ff7a96f91ef55540a72ed ).
00828 if ( is_array( $attributes ) )
00829 {
00830 $db =& eZDB::instance();
00831 $db->begin();
00832 for ( $i = 0; $i < count( $attributes ); ++$i )
00833
00838 $db->commit();
00839 }
But as we can see, the line 836 refers to a variable called $contentObject which is just not defined in a normal context. So I guess the script has been cut or the line forgotten.
As a result, calling the method with an array of attributes just makes it crash.
The method is used elsewhere in the code but not with the first parameter filled, which fortunately doesn't make it a real problem. However the method is not usable this way as a basis api.
Steps to reproduce
In a normal context:
- Instanciate a eZContentClass object
$class = eZContentClass::fetchByIdentifier( 'someClassIdentifier' );
- Create an array of attributes
$attributes = array(); $attribute = $class->fetchAttributeByIdentifier( 'someAttributeIdentifier' ); if( !is_null( $attribute ) ) $attributes[] = $attribute;
- Launch the given attributes removal from the class object
$class->removeAttributes( $attributes );
The operation should result in a fatal error:
Fatal error: Call to a member function on a non-object in kernel/classes/ezcontentclass.php on line 836
Attachments
Issue Links
- relates to
-
EZP-11677 Ezenum options aren't saved
- Closed