Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error saving assigned #11796

Closed
2 tasks
vitormarques86 opened this issue Jun 2, 2022 · 37 comments
Closed
2 tasks

Error saving assigned #11796

vitormarques86 opened this issue Jun 2, 2022 · 37 comments
Assignees
Labels
Milestone

Comments

@vitormarques86
Copy link

vitormarques86 commented Jun 2, 2022

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.1

Bug description

After assigning a ticket to a user, when I try to save, the screen goes blank.

Relevant log output

Uncaught Exception TypeError: Argument 1 passed to Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier() must be of the type string, array given, called in /var/www/html/glpi/src/DBmysql.php on line 1257 in /var/www/html/glpi/src/Toolbox/Sanitizer.php at line 228

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

@cedric-anne
Copy link
Member

Hi,

Have you some active plugins ? In this case, try to deactivate them (especially behaviours plugin) to see if problem persist.

@cconard96
Copy link
Contributor

I see the same error when adding any actors to tickets.
I haven't been able to track down the cause completely yet, but it doesn't seem related to plugins and seemed to have started with a commit merged yesterday or today.

@vitormarques86
Copy link
Author

Even with the plugins disabled, the problem persists.

@vitormarques86
Copy link
Author

Happened after upgrading to version 10.0.1

@brunnersm
Copy link

Me too, after upgrading to version 10.0.1
[2022-06-02 15:46:57] glpiphplog.CRITICAL: *** Uncaught Exception TypeError: Argument 1 passed to Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier() must be of the type string, array given, called in /var/www/html/src/DBmysql.php on line 1257 in /var/www/html/src/Toolbox/Sanitizer.php at line 228
Backtrace :
src/DBmysql.php:1257 Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier()
src/DBmysql.php:1288 DBmysql::quoteValue()
src/DBmysql.php:1312 DBmysql->buildInsert()
src/CommonDBTM.php:705 DBmysql->insert()
src/CommonDBTM.php:1297 CommonDBTM->addToDB()
src/CommonITILObject.php:3006 CommonDBTM->add()
src/CommonITILObject.php:1716 CommonITILObject->addAdditionalActors()
src/Ticket.php:1303 CommonITILObject->prepareInputForUpdate()
src/CommonDBTM.php:1565 Ticket->prepareInputForUpdate()
front/ticket.form.php:84 CommonDBTM->update()

@ariasfonseca
Copy link

Hi, me too not technical aggregation for ticket. event log error:

[2022-06-02 16:11:18] glpiphplog.CRITICAL: *** Uncaught Exception TypeError: Argument 1 passed to Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier() must be of the type string, array given, called in /var/www/html/glpi/src/DBmysql.php on line 1257 in /var/www/html/glpi/src/Toolbox/Sanitizer.php at line 228
Backtrace :
src/DBmysql.php:1257 Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier()
src/DBmysql.php:1288 DBmysql::quoteValue()
src/DBmysql.php:1312 DBmysql->buildInsert()
src/CommonDBTM.php:705 DBmysql->insert()
src/CommonDBTM.php:1297 CommonDBTM->addToDB()
src/CommonITILObject.php:2987 CommonDBTM->add()
src/CommonITILObject.php:1716 CommonITILObject->addAdditionalActors()
src/Ticket.php:1303 CommonITILObject->prepareInputForUpdate()
src/CommonDBTM.php:1565 Ticket->prepareInputForUpdate()
front/ticket.form.php:84 CommonDBTM->update()

@OlegusPF
Copy link

OlegusPF commented Jun 3, 2022

Hi
We resolved this problem. I don.t know is it fully correct or not, but it is work :)
You need to change in the file /glpi/src/Toolbox/Sanitizer.php 228 string to
.... isNsClassOrCallableIdentifier($value) ....
and change the string 231 to
... , (string)$value, ...

@cconard96 cconard96 added the bug label Jun 3, 2022
@cedric-anne
Copy link
Member

Hi We resolved this problem. I don.t know is it fully correct or not, but it is work :) You need to change in the file /glpi/src/Toolbox/Sanitizer.php 228 string to .... isNsClassOrCallableIdentifier($value) .... and change the string 231 to ... , (string)$value, ...

Well, you just hide the problem, and it will probably add corrupted data into your database, so it is not a good idea.

@OlegusPF
Copy link

OlegusPF commented Jun 3, 2022

ok, thanks, i was revert it back. waiting for resolve )

@dani
Copy link

dani commented Jun 3, 2022

I have the same issue on one instance of GLPI, but on another instance, I can't reproduce. Both are almost similar. Have been upgraded from 10.0.0 to 10.0.1 today, running on AlmaLinux with the same version of PHP (8.0.19) and almost the same MariaDB (10.6.7 vs 10.6.8). I'm trying to figure out the difference which make the problem reproducible.

@wevrard
Copy link

wevrard commented Jun 3, 2022

in my fresh update from 10.0.1, i have a same error.

[2022-06-03 16:12:02] glpiphplog.CRITICAL: *** Uncaught Exception TypeError: Argument 1 passed to Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier() must be of the type string, array given, called in /var/www/html/glpi/src/DBmysql.php on line 1257 in /var/www/html/glpi/src/Toolbox/Sanitizer.php at line 228
Backtrace :
src/DBmysql.php:1257 Glpi\Toolbox\Sanitizer::isNsClassOrCallableIdentifier()
src/DBmysql.php:1288 DBmysql::quoteValue()
src/DBmysql.php:1312 DBmysql->buildInsert()
src/CommonDBTM.php:705 DBmysql->insert()
src/CommonDBTM.php:1297 CommonDBTM->addToDB()
src/CommonITILObject.php:3006 CommonDBTM->add()
src/CommonITILObject.php:1716 CommonITILObject->addAdditionalActors()
src/Ticket.php:1303 CommonITILObject->prepareInputForUpdate()
src/CommonDBTM.php:1565 Ticket->prepareInputForUpdate()
front/ticket.form.php:84 CommonDBTM->update()

@cconard96
Copy link
Contributor

I'm trying to figure out the difference which make the problem reproducible.

Do you have any Business Rules for Tickets on the non-working instance? Are they triggered by Add, Update or both?

@dani
Copy link

dani commented Jun 3, 2022

The problem is not triggered when assigning a user through the mass action button on the ticket list view

@dani
Copy link

dani commented Jun 3, 2022

I'm trying to figure out the difference which make the problem reproducible.

Do you have any Business Rules for Tickets on the non-working instance? Are they triggered by Add, Update or both?

Indeed, the "broken" instance has business rules (Add / Add+Update), while the working instance has no business rule at all

@cosmedd
Copy link
Contributor

cosmedd commented Jun 3, 2022

We have the same problem with GLPI 10.0.1

It didn't happen with GLPI 10.0 until commit 3de7b01

We can confirm that the problem persists with all plugins disabled.

Only happens when assigning or changing the status of already created tickets. It is not reproduced in new tickets after upgrading to GPI 10.0.1.

@cconard96
Copy link
Contributor

cconard96 commented Jun 3, 2022

Issue seems like it started with the commit from #11728 but it does not seem to be the cause directly. The code that seems to be the issue is old so I don't know why the issue hasn't presented before now.

The issue would only affect updates from the form (not massive actions) because of the different way it handles actors.

@dani
Copy link

dani commented Jun 3, 2022

I can confirm that adding a single business rule (triggered on Add/Update) is enough to make my working instance broken too

@cosmedd
Copy link
Contributor

cosmedd commented Jun 3, 2022

Hello, for us it seems that the problem starts with this commit: eef8275 that is the one indicated by cconard96

Also, as dani points out, if you don't use business rules for tickets, the bug is not reproduced.

@dani
Copy link

dani commented Jun 3, 2022

Can we safely revert this single commit so we can assign tickets again ? (waiting for a proper fix)

@cosmedd
Copy link
Contributor

cosmedd commented Jun 3, 2022

Regardless of whether or not it is safe to revert it at the very least I can confirm that it is not done cleanly. That is, it would be necessary to revert more commits or perform a manual cleanup.

@brunnersm
Copy link

I copied 10.0.0/src/RuleTicketcCollection.php to production and it fixed the problem, until the fix came.

@ariasfonseca
Copy link

thanks @brunnersm this solution work for me

@brunoproza
Copy link

@brunnersm this solution work for me too, Tks

@vitormarques86
Copy link
Author

@brunnersm tks!

@cmoreno038
Copy link

I only found this difference
imagen

@OlegusPF
Copy link

OlegusPF commented Jun 3, 2022

@cmoreno038
After hiding the lines this solution works for me. THX

@DooBio
Copy link

DooBio commented Jun 7, 2022

Hello

I'm sorry but the fix doesn't work for me.
I am in 10.0.1 and I have modified line 130 to 148 the file src/RuleTicketCollection.php

// append _actors values to awaited indexes by rule engine
        if (isset($input['_actors']) && count($input['_actors'])) {
            foreach (['requester', 'observer', 'assign'] as $actortype) {
                if (isset($input['_actors'][$actortype]) && count($input['_actors'][$actortype])) {
                    foreach ($input['_actors'][$actortype] as $actor) {
                        $input_key = "_" .
                                    getForeignKeyFieldForItemType($actor['itemtype']) .
                                    "_" .
                                    $actortype;

                        if (!isset($input[$input_key])) {
                            $input[$input_key] = [];
                        }

                        $input[$input_key][] = $actor['items_id'];
                    }
                }
            }
        }

In my ticket when I want to add an actor and I save I come across this blank page "http://.../glpi/front/ticket.form.php?id=2022002385"

and I confirm via the Action button I have no assignment problem

Thanks for your help

@DooBio
Copy link

DooBio commented Jun 7, 2022

After applying : #11812

I confirm it works

Thx 😉

@paulopera
Copy link

paulopera commented Jun 7, 2022

I'm facing the same problem on some tickets (NOT ALL) BUT if I use the Associate Myself button it works.
I can't assign only on SOME tickets to another technician but myself.
After I sent the comment I saw the DooBio comment and indeed, applying the pull #11812 fixed the problem.

@mulbzh
Copy link

mulbzh commented Jun 8, 2022

I don't find where is the solution in #11812, what is the code to change ?

@mulbzh
Copy link

mulbzh commented Jun 8, 2022

Ok, i found the code to change, there is a way to download all the file with the new code ?

@DooBio
Copy link

DooBio commented Jun 8, 2022

Here is the commit link Commit 30cf046

I just made the changes made by cconard96

@orthagh orthagh added this to the 10.0.2 milestone Jun 15, 2022
@DamBn
Copy link

DamBn commented Jun 15, 2022

Hello

I don't find where is the solution in #11812 what is the code to change ?
/src/ticket.php is no fonctional

@paulopera
Copy link

paulopera commented Jun 15, 2022

as @DooBio mentioned above here's the direct commit link or you can download the file (backup the original first) and replace in you environment.
What you mean /src/ticket.php is not functional?
Did you check the permissions?

@DamBn
Copy link

DamBn commented Jun 16, 2022

@paulopera I replaced the ticket.php file but nothing changes. I'm using PHP 8.0.5 does this have impact ?

@variamus
Copy link

I copied 10.0.0/src/RuleTicketcCollection.php to production and it fixed the problem, until the fix came.

It's working. However, is it safe to do ? No database corruption or anything else ?
Thanks

@cedric-anne
Copy link
Member

Hi,

It should be fixed by #11957.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests