I get the error pasted below when I do the following.

1. Create a new Org AA then save
2. Create a new Project B and assign it to existing Org B then save
3. Reopen Project B and change the Org from Org B to Org AA

Recoverable fatal error: Argument 2 passed to db_query() must be an array, string given, called in /media/sf_sandbox/pm/sites/all/modules/pm/pminvoice/pminvoice.module on line 292 and defined in db_query() (line 2342 of /media/sf_sandbox/pm/includes/database/database.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juliangb’s picture

Status: Active » Needs review
FileSize
4.74 KB

Here's a patch for this issue.

Status: Needs review » Needs work

The last submitted patch, pm-nodechange.patch, failed testing.

juliangb’s picture

Status: Needs work » Needs review

#1: pm-nodechange.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, pm-nodechange.patch, failed testing.

juliangb’s picture

Status: Needs work » Needs review
FileSize
4.74 KB

Try rerolling. Locally I can't reproduce this error.

[path]/modules/pm$ php -l pmticket/pmticket.module
No syntax errors detected in pmticket/pmticket.module
[path]/modules/pm$ php -l pminvoice/pminvoice.module
No syntax errors detected in pminvoice/pminvoice.module
dbt102’s picture

FileSize
107.68 KB

Patch applied cleanly. When working through issue reporting scenario I get this message. (see attached printout ... includes Devel node access results)

Strict warning: Creating default object from empty value in pmproject_update() (line 584 of /media/sf_sandbox/pm/sites/all/modules/pm/pmproject/pmproject.module).
Strict warning: Creating default object from empty value in pmproject_update() (line 589 of /media/sf_sandbox/pm/sites/all/modules/pm/pmproject/pmproject.module).

juliangb’s picture

Status: Needs review » Active

Thanks for the feedback. I've committed the patch, and will post again to fix the warnings that you mention.

juliangb’s picture

Status: Active » Postponed (maintainer needs more info)

@dbt102 Would you mind checking this scenario again please?

I could not reproduce this just now, so either other issues have fixed the issues, or I need to use a specific way to trigger the problem.

juliangb’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Hopefully this issue is already fixed.

gapa’s picture

I too have this (or similar) problem. I just tried PM module and I have created new organization, new person, and new project. If I try to view created project I get WSOD. And if I try to edit it and save it I get this message:
Warning: Creating default object from empty value in pmproject_update() (line 580 of /var/www/clients/client1/web33/web/sites/all/modules/pm/pmproject/pmproject.module).

It seems that I cannot save price amount. Everytime I try to save value for price I get this error. So I guess this issue is not closed.

juliangb’s picture

Status: Closed (cannot reproduce) » Active

Reopening issue.

juliangb’s picture

Status: Active » Postponed (maintainer needs more info)

I still can't reproduce this.

Please could you post detailed instructions for how to see this error?

gapa’s picture

FileSize
19.36 KB

I have created organization, one person (people) in one organization, and one project. I have filled fields for project like in picture. If I try to edit this project I can (can't save hourly price thoug), if I try to view it I get WSOD.
pm-project

dbt102’s picture

FileSize
79.5 KB

I'm not able to reproduce this (#13) exactly, however seems if I go into an existing project and change the price mode - say from hourly to daily - then save ... there is a warning that pop up. (see attached)

juliangb’s picture

To summarise points outstanding:
1 - Cannot view project - WSOD - I cannot reproduce this error.
2 - Cannot save price field - I have reproduced this error
3 - Warning after save - I cannot reproduce this error

I will try again on a fresh installation, and see if that helps to see this.

I am currently testing on the demo site (http://drupal-7.project-management-module.org/)

gapa’s picture

I have also installed on fresh installation. But problems still remains. I also send you (juliangb) admin access for my test site.

gapa’s picture

I also tried on my local machine (xampp,win7) and still have the same problem. With first alpha release.

juliangb’s picture

I have now tried this on a fresh installation, and also cannot reproduce the error, although did see the error when trying on your site. When the error occurs, there is no log message saying what has happened.

I also noted on your site the warning message that @dbt102 has seen.

Therefore, I'm a bit confused - I can see that there is a problem, but cannot reproduce it myself at the moment.

I notice that we're using different versions of PHP, which could potentially cause something like this.

It would be ideal if others that see this issue could post as well, and hopefully then we can narrow down what is going on.

Raphael Dürst’s picture

Could this have something to do with this?
Line 578 in pmproject.module:

->condition('n.nid', '$node->manager_nid')

$node->manager_nid is inside a string (which is really not necessary), maybe this causes problems with some PHP versions.

Edit: I just realized, that the variable is inside a single-quoted string. There is no way, this is working (variables can only work in double-quoted strings).

Raphael Dürst’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
524 bytes

Here's a patch. I'm not sure, if this actually fixes this issue, but it can't hurt either.

juliangb’s picture

Thanks for that - looks like a change we should make anyway.

@dbt102 and @gapa, could you test to see if this solves either problem please?

gapa’s picture

FileSize
34.91 KB

This patch solved only that it didn't display warning after save. But price value is still not saved.
I have tried many different things. Last thing that I tried was to uninstall all module but pmorganization and pmproject. And then I tried to create new project. I could create it and view it (finaly) but I recived this message:

Warning: Creating default object from empty value in pmproject_update() (line 582 of /var/www/clients/client1/web33/web/sites/all/modules/pm/pmproject/pmproject.module).
Warning: Creating default object from empty value in pmproject_update() (line 587 of /var/www/clients/client1/web33/web/sites/all/modules/pm/pmproject/pmproject.module).

And also if I had all pm modules enabled and I tried to create new ticket i recived this message:

Notice: Trying to get property of non-object in pmticket_update() (line 595 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).

I could edit ticket and after save I recived upper error, and I couldn't view it. I got error message (on the picture)
ticket error

All this I tried on local machine (xampp 3.2.1.) and production server (debian wheezy). Same results.

Any idea? What else can I try?

Raphael Dürst’s picture

FileSize
3.39 KB

This patch solved only that it didn't display warning after save. But price value is still not saved.

Saving the price & duration values were commented out (in hook_insert & hook_update) for some reason.
It's working now with this patch.

Warning: Creating default object from empty value in pmproject_update() (line 582 of /var/www/clients/client1/web33/web/sites/all/modules/pm/pmproject/pmproject.module).
Warning: Creating default object from empty value in pmproject_update() (line 587 of /var/www/clients/client1/web33/web/sites/all/modules/pm/pmproject/pmproject.module).

This error only appears, when E_STRICT warnings are enabled. I guess, that's the reason, only you saw these.
It tries to assign a value to the property title of a non-existing object ($manager / $assigned).
I just created the object before assigning a value.

Notice: Trying to get property of non-object in pmticket_update() (line 595 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).

It tries to get a value from the object $p which doesn't exist. Fixed this as well.

Other fixes: Price in pmticket was also not saved.
In pmtask_pmproject_change, it tries to update the pmproject table, when it should've updated the pmtask table.

gapa’s picture

I tried with your patch. I uninstalled pm modules, deleted old content and tried with patched modules. I created 2 organization and 1 person successfully, but when I tried to create new project I recived this:

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'price' at row 1: INSERT INTO {pmproject} (vid, nid, organization_nid, organization_title, projectcategory, projectstatus, projectpriority, pricemode, price, currency, durationunit, duration, manager_nid, manager_title, assigned_nid, assigned_title, billable, billed) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17); Array ( [:db_insert_placeholder_0] => 16 [:db_insert_placeholder_1] => 16 [:db_insert_placeholder_2] => 12 [:db_insert_placeholder_3] => Jotajomo Gašper Žnidaršič Bečaj s.p. [:db_insert_placeholder_4] => development [:db_insert_placeholder_5] => inserted [:db_insert_placeholder_6] => 1-low [:db_insert_placeholder_7] => not applicable [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => USD [:db_insert_placeholder_10] => hour [:db_insert_placeholder_11] => [:db_insert_placeholder_12] => 0 [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => 0 [:db_insert_placeholder_15] => [:db_insert_placeholder_16] => 0 [:db_insert_placeholder_17] => 0 ) in pmproject_insert() (line 548 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmproject\pmproject.module).

And project didn't create at all.
This was tested localy (xampp).

Raphael Dürst’s picture

FileSize
4.95 KB

Ok, this happened, because you didn't set a value for price (or duration). You would receive the same error, if you'd put in any non-numeric values.

I also added a check for non-numeric values, and if the value is invalid, it just set 0.

We can add proper form validation in a later step, I think.

gapa’s picture

Did the same procedure as before. With uninstalling and recreating content. With saving I recive this error:

Fatal error: Unsupported operand types in C:\xampp\htdocs\pm\includes\theme.inc on line 1075
Call Stack
# Time Memory Function Location
1 0.0000 136776 {main}( ) ..\index.php:0
2 0.2030 2337872 menu_execute_active_handler( ) ..\index.php:21
3 0.2040 2338496 call_user_func_array ( ) ..\menu.inc:517
4 0.2040 2338680 node_page_view( ) ..\menu.inc:517
5 0.2060 2345704 node_show( ) ..\node.module:2760
6 0.2060 2346008 node_view_multiple( ) ..\node.module:1478
7 0.2180 2372104 node_view( ) ..\node.module:2676
8 0.2180 2372168 node_build_content( ) ..\node.module:1343
9 0.2190 2373008 node_invoke( ) ..\node.module:1418
10 0.2190 2373112 pmproject_view( ) ..\node.module:921
11 0.2250 2438344 theme( ) ..\pmproject.module:725
12 0.2310 2694288 theme_pmproject_view( ) ..\theme.inc:1146
13 0.2320 2696864 theme( ) ..\pmproject.theme.inc:62

But projects gets saved (also price is saved). And I receive this error also on view.

So I guess it is getting better, but not there yet.
Thanks for your patches.

Raphael Dürst’s picture

FileSize
5.75 KB

Did you have the pminvoice module enabled?
One theme function was not called correctly, but I didn't get your error. Strange...

I fixed it in this patch. Could you try it and look if you still get this error? Thanks!

gapa’s picture

I think that this patch solved problems with project creation.

But... :)
With creating ticket (only fields that are marked with red *) I again recive this message:
Fatal error: Unsupported operand types in C:\xampp\htdocs\pm\includes\theme.inc on line 1075
Call Stack
# Time Memory Function Location
1 0.0000 136776 {main}( ) ..\index.php:0
2 0.1200 2360872 menu_execute_active_handler( ) ..\index.php:21
3 0.1200 2361496 call_user_func_array ( ) ..\menu.inc:517
4 0.1200 2361680 node_page_view( ) ..\menu.inc:517
5 0.1220 2368712 node_show( ) ..\node.module:2760
6 0.1220 2369016 node_view_multiple( ) ..\node.module:1478
7 0.1270 2395112 node_view( ) ..\node.module:2676
8 0.1270 2395176 node_build_content( ) ..\node.module:1343
9 0.1270 2396016 node_invoke( ) ..\node.module:1418
10 0.1280 2396120 pmticket_view( ) ..\node.module:921
11 0.1310 2465064 theme( ) ..\pmticket.module:775
12 0.1350 2720896 theme_pmticket_view( ) ..\theme.inc:1146
13 0.1350 2723472 theme( ) ..\pmticket.theme.inc:62

when I go back I recive this error:
Notice: Undefined property: stdClass::$datebegin in _pmticket_beforesave() (line 707 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).
Notice: Undefined property: stdClass::$dateend in _pmticket_beforesave() (line 708 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).
Notice: Undefined property: stdClass::$datebegin in pmticket_insert() (line 556 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).
Notice: Undefined property: stdClass::$dateend in pmticket_insert() (line 557 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmticket\pmticket.module).

if I try to edit this ticket and save it (without any change) I don't recive any error. But I cannot view it.

And when I try to create task I recive this:
Notice: Undefined property: stdClass::$datebegin in _pmtask_beforesave() (line 778 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmtask\pmtask.module).
Notice: Undefined property: stdClass::$datebegin in _pmtask_beforesave() (line 782 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmtask\pmtask.module).
Notice: Undefined property: stdClass::$dateend in _pmtask_beforesave() (line 785 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmtask\pmtask.module).
Notice: Undefined property: stdClass::$dateend in _pmtask_beforesave() (line 789 of C:\xampp\htdocs\pm\sites\all\modules\pm\pmtask\pmtask.module).

Also this error is shown when I view this task.
And again if I try to edit and save all is ok. But this time I don't receive any error on view.
So I guess this happens only with first save.

Raphael Dürst’s picture

Well, this issue (and patch) is about projects.
I think, we should commit this patch (if there are no errors) and open another issue for other errors.

D34dMan’s picture

@Raphael, will you please assign the issue to yourself if you are working on it. ( and anybody who is working on any issue for that matter). I intend to clean up few issues and don't want to duplicate efforts. Thank you. Thanks for the patches you are awesome.

dbt102’s picture

Applied patch (#27) cleanly. This was done after 'git reset --hard' then 'git pull origin'.

Created new project, making sure to fill in all variables, and this saved without throwing any errors.

Then, went back and created new project , this time filling out the minimal # of fields.

This worked OK for me too,

Awesome work!

dbt102’s picture

Also, ran coder check on PMProject ...

Coder reports ...

"Coder found 1 projects, 6 files, 17 normal warnings, 0 warnings were flagged to be ignored "

So looks good to me from that perspective also...

gapa’s picture

Can this also be commited to dev?

juliangb’s picture

Title: Recoverable fatal error when switching Organizations on Project » Error viewing Project
Assigned: Unassigned » Raphael Dürst
Status: Needs review » Needs work

This patch doesn't apply - perhaps due to the other issues that I've already committed.

Could we reroll please?

@D34dMan Thanks for the reminder on assigning issues - I've been getting forgetful on this myself.
@Raphael I've assigned this one to you (hope that's OK)

gapa’s picture

I just tested with alpha1 version. with no problems. I will try later with newest dev version.

D34dMan’s picture

Status: Needs work » Needs review

#27: 1996886-26.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1996886-26.patch, failed testing.

Raphael Dürst’s picture

Ok, I guess that's because of other patches that were committed.
I'll fix the patch and upload it again later.

gapa’s picture

I think that the problem is in pmticket.module section of the patch.

diff --git a/pmticket/pmticket.module b/pmticket/pmticket.module
index 2b77e4f..cbfdb36 100644
--- a/pmticket/pmticket.module
+++ b/pmticket/pmticket.module
@@ -556,9 +556,9 @@ function pmticket_insert($node) {
'datebegin' => $node->datebegin,
'dateend' => $node->dateend,
'durationunit' => $node->durationunit,
-// 'duration' => $node->duration,
+ 'duration' => $node->duration,
'pricemode' => $node->pricemode,
-// 'price' => $node->price,
+ 'price' => $node->price,
'currency' => $node->currency,
'assigned_nid' => $node->assigned_nid,
'assigned_title' => $node->assigned_title,

This part of code was giving me errors. But I was unable to fix it for some unknown reason.

Raphael Dürst’s picture

Status: Needs work » Needs review
FileSize
5.84 KB

I fixed the patch, it should now apply to the current HEAD.

gapa’s picture

It does apply with no problems.
Thank you.

dbt102’s picture

Applied patch (#40) cleanly. This was done after 'git reset --hard' then 'git pull origin'.

Created new project, making sure to fill in all variables, and this saved without throwing any errors.

Then, went back and created new project , this time filling out the minimal # of fields.

This worked OK for me too,

Again...Awesome work!

juliangb’s picture

Status: Needs review » Fixed

Thanks, I've committed this patch.

So - this will be in the -dev release from midnight, and the next point release from early August.

Status: Fixed » Closed (fixed)

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

  • Commit 2771f62 on 7.x-1.x, 7.x-2.x by juliangb:
    Issue #1996886 by juliangb | dbt102: Fixed Recoverable fatal error when...
  • Commit 32ae5e1 on 7.x-1.x, 7.x-2.x authored by Raphael Dürst, committed by juliangb:
    Issue #1996886 by Raphael Drst, juliangb | dbt102: Fixed Error viewing...