Hi,

I'm not sure if this is a bug or not. I do not know enough about the internals of coder_upgrade

I've been getting this fatal error on a module I'm working on upgrading and did a print_r on $function.

The last few lines are

PGPNode Object *RECURSION* [previous] => [line] => ) [line] => 405 ) [line] => ) [count:private] => 1 [debug:protected] => ) [next] => PGPNode Object *RECURSION* [previous] => PGPNode Object ( [container] => PGPList Object *RECURSION* [type] =>  assign [data] =>  =>  [next] =>  PGPNode Object *RECURSION* [previous] => PGPNode Object ( [container] => PGPList Object *RECURSION* [type] => key [data] => PGPExpression Object ( [warning] => [extra] => [parent] => [first:private] => PGPNode Object ( [container] => PGPExpression Object *RECURSION* [type] => [data] => [next] => PGPNode Object ( [container] => PGPExpression Object *RECURSION* [type] => operand [data] => Array ( [type] => 314 (T_CONSTANT_ENCAPSED_STRING) [value] => '%name' ) [next] => PGPNode Object ( 

i check for line 405 and found this part of a form

$form['name'] = array(
    '#type' => 'markup',
    '#value' => '<h3>'. t('Biography for %name', array('%name' => $data['name'])) .'</h3>',
    );

Any suggestions on whether this is a coder_upgrade issue or code itself. In D7 there's a 3rd parameter in the t() function but don't think coder even gets this far on

'#value' => '<h3>'. t('Biography for %name', array('%name' => $data['name'])) .'</h3>',

A couple of months ago when running this through upgrade it didn't have this error but then again it said it completed but with a zero size patch.

CommentFileSizeAuthor
#5 debug.txt74.78 KBctmattice1

Comments

solotandem’s picture

Line 827 in the latest version of call.inc has no code. Can you retry this module upgrade using the latest code from CVS for coder_upgrade and grammar_parser?

If an error occurs, please try to determine the code in the module you are upgrading that encountered the error. You can review the log.txt file (link available from admin/config/development/coder/upgrade) to see what file it was on. Next, from the line number of the error, you should be able to determine what code snippet it was trying to upgrade. At this point, I would extract the code snippet to a separate file and only run it. If you set $debug = TRUE in coder_upgrade_start() of main.inc, it will dump a whole lot of stuff to files/coder_upgrade/debug.txt. The debug information will provide very helpful information.

Or, if the module you are working on is in CVS, or you can provide me a copy, I can take a look at the error.

Also, if you want to print information on one of the grammar objects, please use the custom print_r() functions provided by the module. The easiest way is to use cdp($object, 'your description'). This requires the global $debug variable to equal TRUE. This function avoids all the messy recursion you get with the built-in print_r().

Thanks for using this module.

ctmattice1’s picture

@solotandem: Thanks for your tips.

ctmattice1’s picture

Title: fatal error, line 827 of coder_upgrade.call.inc » fatal error, line 872 of coder_upgrade.call.inc

My mistake solotandem the line number that fatals is 872. The module in cvs is quotes ver 6.1.40, guess my dyslexia kicking in again.

when I go to "admin/config/development/coder/coder_upgrade" it errors with

Warning: parse_ini_file(): Filename cannot be empty in _coder_review_7x_optional_block_review_callback() (line 1000 of C:\sites\d7testsuite\sites\all\modules\coder\coder_review\includes\coder_review_7x.inc).

and then runs coder through coder_review. I did find the log.txt file in default/files/coder_upgrade and the debug file

log text last line is "Calling hook_upgrade_call_alter" which I think is a separate issue already filed for coder_upgrade.

The last use case in the debug file is

Use case 3: Assignment variable includes return variable
variable has one index
inside coder_upgrade_callback_return_case3
Array
(
[0] => quotes_admin_settings
[1] => quotes_blocks_settings
[2] => quotes_export
[3] => quotes_bios
[4] => _quotes_block_delete
)
inside coder_upgrade_upgrade_regex_alter
inside coder_upgrade_convert_function_calls

Is it possibly the _quotes part that's throwing coder_upgrade into a fatal?

solotandem’s picture

Title: fatal error, line 872 of coder_upgrade.call.inc » drupal_get_form() upgrade routine fails when form callback has no parameters
Category: support » bug

In my original post #2, I had "admin/config/development/coder/coder_upgrade" but realized the last part was wrong and changed it as now shown in #2. That URL is invalid but Coder Review is trying to process it. Hence the error messages.

I looked at the 6.1.40 release of the Quotes module. The issue is the form builder routines, like quotes_admin_settings() and quotes_export(), that have no $form_state parameter. The upgrade routine was expecting at least this variable and generates an error because there are no parameters. If you add $form_state to these functions, then this routine should succeed.

In this business of upgrading code, the difficulty is trying to anticipate the myriad of code styles and deciding which to handle. Thanks for finding this bug. I will fix in an upcoming release.

If you can work around this error and keep running the upgrades on this module and report back your results, that would be appreciated.

I noted that there are some issues with the db_query() calls. We will be fixing these soon as well.

ctmattice1’s picture

StatusFileSize
new74.78 KB

@solotandem: Sure thing, I added the $form_state parameter and coder_upgrade ran through that part. Your correct on the db_query() stuff. That hit me next with a fatal.

here's the fatal screen message

array(0) { } ERROR: Undefined offset: 3 on line 743 in C:\sites\d7testsuite\sites\all\modules\grammar_parser\engine\grammar_parser.editor.inc ERROR: Undefined offset: 3 on line 744 in C:\sites\d7testsuite\sites\all\modules\grammar_parser\engine\grammar_parser.editor.inc ERROR: Undefined offset: 2 on line 743 in C:\sites\d7testsuite\sites\all\modules\grammar_parser\engine\grammar_parser.editor.inc ERROR: Undefined offset: 2 on line 744 in C:\sites\d7testsuite\sites\all\modules\grammar_parser\engine\grammar_parser.editor.inc ERROR: Undefined offset: 2 on line 197 in C:\sites\d7testsuite\sites\all\modules\coder\coder_upgrade\conversions\coder_upgrade.db.inc ERROR: Undefined offset: 1 on line 199 in C:\sites\d7testsuite\sites\all\modules\coder\coder_upgrade\conversions\coder_upgrade.db.inc ERROR: Undefined offset: 1 on line 202 in C:\sites\d7testsuite\sites\all\modules\coder\coder_upgrade\conversions\coder_upgrade.db.inc ERROR: Undefined offset: 3 on line 212 in C:\sites\d7testsuite\sites\all\modules\coder\coder_upgrade\conversions\coder_upgrade.db.inc Fatal error: Call to a member function stripComments() on a non-object in C:\sites\d7testsuite\sites\all\modules\coder\coder_upgrade\conversions\coder_upgrade.call.inc on line 872 

but it looks like the fatal still has to deal with earlier problems. here's the last log entry

*************************
Converting the file => quotes.module
*************************
Calling hook_upgrade_regex_alter
Completed hook_upgrade_regex_alter
Calling hook_upgrade_call_alter

I'll attach the debug text file for you as well. I haven't had a chance to see where in the module file it breaks and if there is a form there without the $form_state variable. Will check into and get back with you.

solotandem’s picture

The error in db.inc occurs on the multi-line query in one of the db_query() calls in your module. If you edit the db.inc file, there is a commented out return statement in the db_query_alter() function. If you uncomment the return, that will prevent this routine from running, but the rest of them should succeed. If you grab the latest code from CVS it will work better but still have trouble with this query.

We are hoping to improve the db_query routine next week. It does not have enough checks for unexpected results. Stay tuned and thanks for your persistence.

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

Fixed by commit on July 8.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.