Forums | Mahara Community

Support /
Access for one profile - "A nonrecoverable error occurred"


10 January 2023, 22:55

Hi everyone,

 

Sorry to bother you, but I need expertise : one user of my institution can't access his profile. When he (or I) try to access it, we get "A nonrecoverable error occurred".

When I check the error.log, I found this : 

  • [WAR] (lib/errors.php:530) [DivisionByZeroError]: Modulo by zero \xc3\xa0 ./htdocs/lib/web.php:4344
  • [WAR] (lib/web.php:4344) A non-numeric value encountered
  • [WAR] (lib/errors.php:530) [DivisionByZeroError]: Modulo by zero \xc3\xa0 ./htdocs/lib/web.php:4344

This warning seems to be a known "issue" for php's developpers but I don't understand why this issue occured for just one user. Did you already encounter this kind of issue ?

 

Thanks in advance !

 

Best regards,

Thibault.

Robert Lyon's profile picture
Posts: 764

11 January 2023, 11:07

Hi Thibault,

The only way I could replicate this issue was to make a change direct to the database.

So what I believe is causing the problem is the pagination system in Mahara takes an 'offset' and 'limit' value and does a Modulo math expression on them. If the limit isn't 0 but is equivalent to 0, eg 00 it will cause this error.

Can I get you to check the blocks on the offending profile page via:

SELECT bi.id, bi.blocktype, bi.configdata FROM block_instance bi JOIN view v ON v.id = bi.view JOIN usr u ON u.id = v.owner WHERE v.type = 'profile' and u.id = [ID of the profile owner]

Where [ID of the profile owner] is the id of the person eg 4

If there is any data in configdata that is setting the 'limit' or 'limitto' that looks strange (or you are not sure) you can try deleting the row and see if the page can be accessed again. Once you find the offending block you can then edit the profile page and try adding it again.

Cheers

Robert

 

11 January 2023, 22:25

Hi Robert,

 

Thank you for taking time to check and reproduce my issue, really appreciate it !

 

So I check the database with your SQL query and found this in the configdata coulumn :

  • Support - Access for one profile - A nonrecoverable error occurred - confidata.jpg

I deleted the configdata rows (if I well understood what you suggest) but still can't access the profile. Do you think this Modulo error could denied the access of a profile ?

 

Thanks again !

 

Best regards,

Thibault.

12 January 2023, 3:58

Hi Robert,

 

Problem solved !

I asked previously :"Do you think this Modulo error could denied the access of a profile ?". The error.log returned a "[WAR] [DivisionByZeroError]: Modulo by zero ./htdocs/lib/web.php:4344" and "A non-numeric value encountered". It's in fact an error (not a Warning) that could denied the access of a profile. I'm not a developper so I asked two experts at work who helped me identified the problem.

 

First, we looked at the line 4344 of web.php, add :

  • error_log("SERIALIZED ".serialize($params['limit']));
  • error_log("==".json_encode($params['limit'],JSON_PRETTY_PRINT));

And when we refresh the profile page, we found this in the error.log : "SERIALIZED s:6:"aucune";". Now we have our non-numeric value ("aucune" means "none"). But this value is obviously nowhere in mahara's code.

So we looked in our DB, and search where this value could come from. We found it in the configdata row of the block-instance table :

  • a:4:{s:11:"artefactids";a:1:{i:0;i:*****;}s:5:"count";s:6:"aucune"...

We changed it with :

  • a:4:{s:11:"artefactids";a:1:{i:0;i:*****;}s:5:"count";s:6:"1"...

And when we refresh the profile page, it worked !

 

So the problem is that, this string (s:6) must be a numeric value (except "0"). But if it's occured, that's because in the edit block of the user's profile, there's an "<input type="text"..." that let the user the possibility to write a non-numeric value :

  • Profile - Edit block.jpg

While it should be "<input type="number"..." with a limit to "1" :

  • Profile - Edit block2.jpg

Can you confirm if it's a bug in our Mahara ?

 

Thanks again, I hope my explanation was clear !

 

Best regards,

Thibault.

Robert Lyon's profile picture
Posts: 764

16 January 2023, 13:54

Hi Thibault,

Yes I can confirm it is a bug in Mahara and I've filed a bug report for it

https://bugs.launchpad.net/mahara/+bug/2002924

And I've created a patch to fix this issue

https://reviews.mahara.org/c/mahara/+/13620

Cheers

Robert

18 January 2023, 21:23

Hi Roberts,

 

Thanks for your work and your involvement !

 

I applied your modification :

  • Profile - Plans.jpg

It seems to work perfectly fine now ;) !

 

Thank you again !

Best regards,

Thibault.

 

 

6 results