help needed on debugging my first basic datatype

help needed on debugging my first basic datatype

Tuesday 13 October 2009 8:23:11 am - 7 replies

Author Message

Gaetano Giunta

Tuesday 13 October 2009 9:52:39 am

Check the php error log. You will likely find the cause of the fatal error that eZ Publish fails to log in your debug output...

Principal Consultant International Business
Member of the Community Project Board

Stephane Persyn

Tuesday 13 October 2009 11:38:23 am

Hi, Gaetano

by reproducing the issue (reloading "mdofy class" page), here's what /var/www.html/ezpublish/var/log/error.log displays:

[ Oct 13 2009 20:15:25 ] [192.168.0.50] index:
Undefined module: var
[ Oct 13 2009 20:15:25 ] [192.168.0.50] error/view.php:
Error ocurred using URI: /var/ezwebin_site/cache/public/images/content_tree-open.gif
[ Oct 13 2009 20:15:44 ] [192.168.0.50] index:
Undefined module: var
[ Oct 13 2009 20:15:44 ] [192.168.0.50] error/view.php:
Error ocurred using URI: /var/ezwebin_site/cache/public/images/content_tree-open.gif

any idea about the var module? As soon as I deactivate my "mlcndatatype" extension through admin interface, everything is going fine again.
any othe "log file" I should sneak into? (no specified logfile specified in php.ini even if "log_errors" is set to "On"...

Gabriel Finkelstein

Tuesday 13 October 2009 12:30:57 pm

You have php error reporting turned off. I get the following syntax errors:

Parse error: parse error in C:\Archivos de programa\EasyPHP 3.0\www\ezpublish-4.1.0\extension\mlcndatatype\datatypes\mlcnrating\mlcnratingtype.php on line 132
Fatal error: eZ Publish did not finish its request

The execution of eZ Publish was abruptly ended, the debug output is present below.
Parse error: parse error in C:\Archivos de programa\EasyPHP 3.0\www\ezpublish-4.1.0\extension\mlcndatatype\datatypes\mlcnrating\mlcnratingtype.php on line 140
Fatal error: eZ Publish did not finish its request

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

Stephane Persyn

Tuesday 13 October 2009 1:33:53 pm

Thanks, Gabriel.

So I guess you were the weird IP I saw in the logs :) Yes, I can't turn on php logging errors although with php.ini right directive setup (well i guess not).

I have some update though thanks to Bratt who mentored me for some debug testing on IRC. In summary, the synax error code comes from following code in objectAttributeContent, metadata, and title functions:

return contentObjectAttribute->attribute( "data_int" );

Strange enough, is that commenting these lines makes my datatype work (can add a mlcnRating attribute to a new content class, edit the content class, even creat a content object, and modify it.... isn't that WEIRD?

Here's the IRC chat log with Bratt for details. ALL help is still appreciated. I am about to wonder what's the actual role of the 3 functions mentionned above, as if they don't return anything it does't seem to have any impact which i can't beleive one second....

<slaine> Hi, guys.
<slaine> just thought i could say hello on irc, and ask for some help...
<slaine> does anyone can actually help me understand what's going on with my veeeery baaaaasic datatype. 
<slaine> See forum post : http://ez.no/developer/forum/developer/help_needed_on_debugging_my_first_basic_datatype
<slaine> I am sue it's (as usual) a very basic mistake, but still i am stuck. as a newbie, i might have all insight on the fundamental concepts.
<slaine> pls read "I might NOT have all insight" :)
<slaine> is there any "up & running" people here? :)
<Bratt> slaine: Gaetano told you to check the _php_ error log, not eZ Publish error log
<Bratt> slaine: Check Apache error log file?
<slaine> no didn't. let me check :)
<slaine> Bratt: is that talking to you: [Tue Oct 13 20:50:37 2009] [error] [client 192.168.0.50] PHP Parse error:  syntax error, unexpected T_OBJECT_OPERATOR in /var/www/html/ezpublish/extension/mlcndatatype/datatypes/mlcnrating/mlcnratingtype.php on line 132, referer: http://adminmalicorn.dyndns.org/class/grouplist
<Bratt> slaine: Yepp, you have a syntax error in your code. Fix it :)
<slaine> Bratt: how can this be a syntax error: return contentObjectAttribute->attribute( "data_int" );
<slaine> Sorry if it's obvious, but I am very newbie :)
<Bratt> It's not. Try commenting it out, see if it works then
<scrieler> Bratt: I got a ez4.2 install, yeeeeeeeeeehaw :D
<slaine> Bratt: now i get same error a few line below first. same error, same cause, same "return contentObjectAttribute->attribute( "data_int" );"
<slaine> in fact I used this return values for functions: objectAttributeContent, metadata, and title
<slaine> strange enough, as this is the exact copy of eZInteger datatype code
<Bratt> Did you copy the file, or copy and paste in an editor?
<slaine> copy paste i beleive... don't tell me I copied some hidden caracters... :)
<Bratt> Did you copy some hidden characters? :)
<Bratt> Try rewriting the line by hand
<slaine> Bratt: no... now the httpd/error.log shows again an issue on first occurence of faulty code (rewrited by hand)...
<Bratt> Hmmm
<slaine> Bratt: I guess theres something else in my code elsewhere that makes this return... bla bla messing up
<slaine> btw, what's a T_OBJECT_OPERATOR?
<Bratt> Try rewriting it
<Bratt> return "test"; or something
<slaine> now comes back to line 140 on second occurence (as first is now return "test";)
<Bratt> Hm....weird
<slaine> pff as usual with me :)
<Bratt> Ok, comment out both lines, and var_dump( $contentObjectAttribute );
<slaine> ok
<slaine> Bratt: now I can access the page (modify class) without errors, i can even see my mlcnRating datatype appear in the dropdown list. issue is that i can't use it indeed, as I return no value from function objectAtributeContent...
<slaine> anywhere to look (i suppose var_dump shows details on the variable contentObjectAttribute?)
<Bratt> slaine: But do you see the var dump?
<Bratt> It should be in the top of the html page, I would think
<slaine> Bratt: I see no var dumps anywhere on the page. tried even to add a mlcnRating, on a new class, said ok, accessed the view template aso.. no var_dumps
<Bratt> Hmm
<Bratt> Add a die(); after the var_dump, then you should see it :)
<slaine> it doesn't show up :)
<Bratt> If you publish an object of the class?
<slaine> strange enough, i can create actual content, value seems to be actually stored, and can be modified... can you explain this magic?
<Bratt> Hmm...no
<slaine> look yourself: http://stephane.persyn.free.fr/fre-FR3.html
<slaine> nouvelle classe is just involving an ezinteger, and a mlcnRating...
<slaine> sorry i didn't upload the folder with all images and all the stuff..
<slaine> but with only the html file you can  see the "view content class" page
<slaine> as well as the debug output clearly showing ez accessed the mlcnrating.tpl file (content/view one)
<slaine> Can't understand what's going on...
<Bratt> Me neither. Try the forums again, write an update with the new info
<slaine> ok thanks still for your guidance..

Bruce Morrison

Tuesday 13 October 2009 6:24:12 pm

Hi Stephane

You may have already worked it out but the contentObjectAttribute var in mlcnRatingType::objectAttributeContent & mlcnRatingType::metaData is missing a leading '$' and should read

    /*!
     Returns the content.
    */
    function objectAttributeContent( $contentObjectAttribute )
    {
        return $contentObjectAttribute->attribute( "data_int" );
    }

    /*!
     Returns the meta data used for storing search indeces.
    */
    function metaData( $contentObjectAttribute )
    {
        return $contentObjectAttribute->attribute( "data_int" );
    }

Just like the mlcnRatingType::title method.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Gaetano Giunta

Wednesday 14 October 2009 1:11:56 am

@Stephane - not sure if you can change error logging or not in php.ini, but, fyi, if there is no error log specified and error logging is set to on, the php errors will be found in the Apache error log

Principal Consultant International Business
Member of the Community Project Board

Stephane Persyn

Wednesday 14 October 2009 1:50:40 pm

Gaetano, Bruce:

Thanks for your replies... and yes you both are right :)

Gaetano: Yes, I've found the error logging through apache error log, and saw there was 2 errors, while I had 3 times same "incriminated" code.

Bruce: Yes, I had worked it out very few minutes since my last post. It was a silly mistyping error. Next time, I'll use a better text editor with php code highlighting. It would have saved me a lot of time.

Thanks to all people having helped me. The good news, is that means it was not due at all to the fact I couldn't fully figure out how datatypes work, as I was believing first.

Now, let's optimize this draft datatype, and go on with template operators.

Once I'll feel more confident, I'll be glad to help others (my turn).

Cheers,

Stéphane

You must be logged in to post messages in this topic!

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