ezemailtype.php bug?

Author Message

Luis Micunco

Tuesday 28 July 2009 3:34:27 am

I noticed when customizing a register form. When submit i get:

Fatal error: Call to a member function attribute() on a non-object in /........../kernel/classes/datatypes/ezemail/ezemailtype.php on line 102
Fatal error: eZ Publish did not finish its request

The execution of eZ Publish was abruptly ended, the debug output is present below.

line 102 is:

else if ( !$classAttribute->attribute( 'is_information_collector' ) and $contentObjectAttribute->validateIsRequired() )

I think its because $classAttribute is defined inside the "if" statement above "else if".

Luis Micunco

Tuesday 28 July 2009 3:46:17 am

Full function here:

/*!
     Validates the input and returns true if the input was
     valid for this datatype.
    */
    function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
    {
        if ( $http->hasPostVariable( $base . '_data_text_' . $contentObjectAttribute->attribute( 'id' ) ) )
        {
            $email = $http->postVariable( $base . '_data_text_' . $contentObjectAttribute->attribute( 'id' ) );
            $classAttribute = $contentObjectAttribute->contentClassAttribute();

            $trimmedEmail = trim( $email );

            if ( $trimmedEmail == "" )
            {
                // we require user to enter an address only if the attribute is not an informationcollector
                if ( !$classAttribute->attribute( 'is_information_collector' ) and
                     $contentObjectAttribute->validateIsRequired() )
                {
                    $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes',
                                                                         'The email address is empty.' ) );
                    return eZInputValidator::STATE_INVALID;
                }
            }
            else
            {
                // if the entered address is not empty then we should validate it in any case
                return $this->validateEMailHTTPInput( $trimmedEmail, $contentObjectAttribute );
            }
        }
        else if ( !$classAttribute->attribute( 'is_information_collector' ) and $contentObjectAttribute->validateIsRequired() )
        {
            $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes', 'Missing email input.' ) );
            return eZInputValidator::STATE_INVALID;
        }

        return eZInputValidator::STATE_ACCEPTED;
    }

Peter Keung

Tuesday 28 July 2009 8:41:49 am

Your form is probably missing a required attribute (not just that someone didn't fill it in, but it's not even being posted as empty). Make sure that all necessary form fields are present, and that they are named correctly. To do this, you can double-check with how all fields would be named if they were output using attribute_view_gui.

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:38:59
Script start
Timing: Jan 18 2025 18:38:59
Module start 'layout'
Timing: Jan 18 2025 18:38:59
Module start 'content'
Timing: Jan 18 2025 18:39:00
Module end 'content'
Timing: Jan 18 2025 18:39:00
Script end

Main resources:

Total runtime0.7322 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 587.9063152.6250
Module start 'layout' 0.00530.0028 740.531339.4297
Module start 'content' 0.00820.7222 779.9609542.9688
Module end 'content' 0.73040.0018 1,322.929712.1875
Script end 0.7321  1,335.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4464160.0002
Check MTime0.00130.1793160.0001
Mysql Total
Database connection0.00070.100710.0007
Mysqli_queries0.686793.7879570.0120
Looping result0.00070.0940550.0000
Template Total0.702095.920.3510
Template load0.00240.330520.0012
Template processing0.699595.541020.3498
Template load and register function0.00020.032810.0002
states
state_id_array0.00090.123110.0009
state_identifier_array0.00130.172120.0006
Override
Cache load0.00170.2348140.0001
Sytem overhead
Fetch class attribute can translate value0.00080.105320.0004
Fetch class attribute name0.00200.275440.0005
XML
Image XML parsing0.00070.095220.0003
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00090.1269170.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs