Ask questions about installing and configuring ProcessMaker 3

Moderator: amosbatto

#795798
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?
#795802
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.
#795809
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#
#795817
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');
    } 
#795833
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.
#795838
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!!
#795842
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.
#795872
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.
Slow grid above 20 lines

I have the following problem: I have a grid that i[…]

I cleared the logs in shared/log but it still erro[…]

Thanks amosbatto, How can i create a new plugin […]

Hi coworker the problem seems to be found and so[…]