PHP Warning During Upgrade from 3.1.1 to 3.2.1

Ask questions about installing and configuring ProcessMaker 3

Moderator: amosbatto

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Thu Oct 05, 2017 11:15 am

I am getting this warning/notice when upgrading from 3.1.1 to 3.2.1...

PHP Warning: Missing argument 2 for AppDocument::exists() in /opt/processmaker/workflow/engine/classes/model/AppDocument.php on line 497
PHP Notice: Undefined variable: iVersion in /opt/processmaker/workflow/engine/classes/model/AppDocument.php on line 499

Is this anything to be concerned about? The upgrade does complete successfully and it seems that the new version is working as expected?

amosbatto
Posts: 5322
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby amosbatto » Thu Oct 05, 2017 7:32 pm

The function causing the warning is new in PM 3.2:
public function exists ($sAppDocUid, $iVersion)

When exactly do you see these warning messages? It looks like it is being called without specifying the version number. Grepping throught code, I can't find when this function is being called. We need to figure out what is calling this function to fix the code.

Can you change your code in workflow/engine/classes/model/AppDocument.php from:

Code: Select all

    public function exists ($sAppDocUid, $iVersion)
    {
        $oAppDocument = AppDocumentPeer::retrieveByPK( $sAppDocUid, $iVersion );
        return (is_object( $oAppDocument ) && get_class( $oAppDocument ) == 'AppDocument');
    }

To:

Code: Select all

    public function exists ($sAppDocUid, $iVersion)
    {
        debug_print_backtrace(); die;
        $oAppDocument = AppDocumentPeer::retrieveByPK( $sAppDocUid, $iVersion );
        return (is_object( $oAppDocument ) && get_class( $oAppDocument ) == 'AppDocument');
    }

Then, post the backtrace information here and then delete the debug_print_backtrace(); die; part.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Fri Oct 06, 2017 9:53 am

When I re-ran the Upgrade (with or without the debug_print_backtrace code) I did not get any errors. Therefore I rolled back my server (VM snapshot) to a time prior upgrading from PM 3.1.3 to PM 3.2.1.

Here is the result...

[email protected]:/opt/processmaker# php processmaker upgrade
Checking files integrity...
checksum.txt not found, integrity check is not possible
Integrity check failed, do you want to continue the upgrade? [Y/n] y
Clearing cache...
Upgrading workspaces (1/1): workflow
> Updating database...
-> 1 tables to add
-> 23 tables to alter
-> 15 indexes to add
-> Nothing to change in the data base structure of RBAC
-> Row updated in DASHLET
-> Row updated in DASHLET
-> Row updated in DASHLET
-> Row updated in DASHLET
-> Verifying roles permissions in RBAC
All roles permissions already updated
-> Migrating the Intermediate Email Event
Migrating Itee Done
0 records where patched to use SELF_SERVICE feature.
<*> Database Upgrade Process took 101.76400709152 seconds.
> Check Intermediate Email Event...
<*> Database Upgrade Process took 0.059756994247437 seconds.
> Verify enterprise old...
Without changes...
<*> Verify took 0.00021100044250488 seconds.
> Updating translations...
Updating Database translations with processmaker.en.po
Updating XML form translations with processmaker.en.po
Updating MAFE translations with processmaker.en.po
<*> Updating Translations Process took 44.77089715004 seconds.
> Updating Content...
Rows Processed ---> 260865 .....
Rows Clustered ---> 260865 .....
Rows Unchanged ---> 260865 .....
Rows Inserted ---> 0 .....
Rows Total ---> 260865 .....
<*> Updating Content Process took 7.3596088886261 seconds.
> Check Mafe Requirements...
<*> Check Mafe Requirements Process took 0.071946859359741 seconds.
> Updating Triggers...
<*> Updating Triggers Process took 0.64506697654724 seconds.
> Backup log files...
<*> Backup log files Process took 0.011569976806641 seconds.
> Optimizing content data...
#0 AppDocument->exists(3206945564f96fe4c6aa8c2046807944, 1)
#1 call_user_func_array(Array ([0] => AppDocument Object ([] => ,[] => ,[] => ,[] => ,[] => 1,[] => ,[] => 0,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ,[] => ACTIVE,[] => ,[] => ,[] => ,[] => UNSYNCHRONIZED,[] => ,[] => ,[] => ,[] => Array (),[] => 1,[] => ,[] => Array ()),[1] => exists), Array ([0] => 3206945564f96fe4c6aa8c2046807944,[1] => 1)) called at [/opt/processmaker/workflow/engine/classes/class.wsTools.php:3274]
#2 workspaceTools->migrateContentWorkspace(AppDocument, Array ([uid] => APP_DOC_UID,[alias] => Array ([CON_PARENT] => DOC_VERSION),[fields] => Array ([0] => APP_DOC_TITLE,[1] => APP_DOC_COMMENT,[2] => APP_DOC_FILENAME),[methods] => Array ([exists] => exists)), en) called at [/opt/processmaker/workflow/engine/classes/class.wsTools.php:3382]
#3 workspaceTools->migrateContentRun(workflow, en, Array ([0] => Groupwf,[1] => Process,[2] => Department,[3] => Task,[4] => InputDocument,[5] => Application)) called at [/opt/processmaker/workflow/engine/classes/class.wsTools.php:3224]
#4 workspaceTools->migrateContent(workflow, en) called at [/opt/processmaker/workflow/engine/classes/class.wsTools.php:164]
#5 workspaceTools->upgrade(, workflow, , en, Array ([updateXml] => 1,[updateMafe] => 1)) called at [/opt/processmaker/workflow/engine/bin/tasks/cliUpgrade.php:135]
#6 run_upgrade(Array (), Array ())
#7 call_user_func(run_upgrade, Array (), Array ()) called at [/opt/processmaker/workflow/engine/classes/class.cli.php:300]
#8 CLI::run() called at [/opt/processmaker/workflow/engine/bin/cli.php:127]
#9 include(/opt/processmaker/workflow/engine/bin/cli.php) called at [/opt/processmaker/processmaker:11]
[email protected]:/opt/processmaker#

amosbatto
Posts: 5322
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby amosbatto » Fri Oct 06, 2017 8:01 pm

Thanks jezmathers. That backtrace shows that the version number is defined as 1, so that function call didn't cause the problem. Probably it was called multiple times and one of the times it doesn't have the version number. Could you please run it again with this code?:

Code: Select all

    public function exists ($sAppDocUid$iVersion)
    {
        if (!isset(
$iVersion) or empty($iVersion)) {
           echo 
"------------BackTrace starts--------------\n";
           
debug_print_backtrace();
           echo 
"------------BackTrace stops--------------\n";
        }
        
$oAppDocument AppDocumentPeer::retrieveByPK$sAppDocUid$iVersion );
        return (
is_object$oAppDocument ) && get_class$oAppDocument ) == 'AppDocument');
    } 
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Mon Oct 09, 2017 12:54 pm

Thank you for your help Amos!

Attached is the terminal text...
Attachments
MobaXterm_172.16.17.251_20171009_125111.rtf
(2.85 MiB) Downloaded 1 time

amosbatto
Posts: 5322
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby amosbatto » Mon Oct 09, 2017 4:01 pm

This looks like a bug to me. For now, I recommend changing your code to this:

Code: Select all

public function exists ($sAppDocUid, $iVersion=1)
    {
        $oAppDocument = AppDocumentPeer::retrieveByPK( $sAppDocUid, $iVersion );
        return (is_object( $oAppDocument ) && get_class( $oAppDocument ) == 'AppDocument');
    }

See if you can do the upgrade without error messages now.
Also, please file a bug report about this issue at bugs.processmaker.com and include your backtrace file in the bug report. If you post a link to the bug report here, I will make sure that the developers look at it in the next bug meeting.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Tue Oct 10, 2017 9:09 am

I made the changes to the code and ran an upgrade. I did get one error message:

> Optimizing content data...
PHP Notice: Undefined index: DOC_VERSION in /opt/processmaker/workflow/engine/classes/model/AppDocument.php on line 234
Errors upgrading workspace workflow: This row doesn't exist!

Otherwise the upgrade completed.

Per your suggestion, I have filed a bug here:

http://bugs.processmaker.com/view.php?id=23558

Again, thanks for your help! Please let me know if there is anything I need to do with the above error. Currently this upgrade is in my Test Environment, but would like to upgrade my Production server soon. However, I do not want to do that until it is safe to do so!!

amosbatto
Posts: 5322
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby amosbatto » Tue Oct 10, 2017 5:06 pm

Just out of curiosity, do you have any records in your APP_DOCUMENT table where the DOC_VERSION field is empty? That could be causing your error.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Wed Oct 11, 2017 11:28 am

I have 68,305 rows of Data and every row has a DOC_VERSION number populated (no null or empty field). There are 5376 rows that have a DOC_VERSION > 1.

jezmathers
Posts: 31
Joined: Mon Dec 29, 2014 3:54 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby jezmathers » Fri Oct 13, 2017 11:38 am

Is it safe/recommended that I proceed with the 3.1 to 3.2.1 upgrade on my production server, or should I wait for this bug/issue to be resolved?

gbalbach
Posts: 100
Joined: Thu Mar 29, 2012 4:34 pm

Re: PHP Warning During Upgrade from 3.1.1 to 3.2.1

Unread postby gbalbach » Fri Oct 13, 2017 12:09 pm

For what it is worth, I had the exact same issue when going from 3.1.3 to 3.2 and worked with support on it. It ended up not affecting anything so we moved ahead on our production server and it has been working fine for almost 2 months now. And fyi all of our DOC_VERSION values were set to 1 in APP_DOCUMENT so that wasn't it.


Return to “Installation & Configuration”

Who is online

Users browsing this forum: No registered users and 2 guests