When Pay Per View (ms_ppv) is activated and you go to views to "Add New View" the following error occurs ... when Pay Per View (ms_ppv) is deactivate error disappears.
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/mysite/public_html/2ndhand/includes/unicode.inc).
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/mysite/public_html/2ndhand/includes/unicode.inc).
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/mysite/public_html/2ndhand/includes/unicode.inc).
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/mysite/public_html/2ndhand/includes/unicode.inc).
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | moneysuite-mb_strtolower_warning-2616012-15-D7.patch | 475 bytes | sagar ramgade |
Comments
Comment #2
Farreres commentedI have myself ppv and views activated and this error is not showing in my install. I have tried to locate if there is some views related function, but as the file is called pay per view, there are tons of view texts in the file. I will have to do it with more time.
Comment #3
Farreres commentedChecked, there is no views related code in ms_ppv. No idea where this error could come from.
Comment #4
tontoman commentedI can confirm that after a new Drupal install with Moneysuite and dependents only. That:
The Error appears on the http://example.com/hand/#overlay=admin/structure/views after Selecting the "Add new view" on this page: http://example.com/hand/#overlay=admin/structure/views/add
1) The Error occurs directly after the "Pay Per view" Module is Activated.
2) The Error is removed once the "Pay Per View" Module is Deactivated.
3) Activated all other sub-modules of Moneysuite and Error is NOT present
4) Once "Pay Per View" is reactivated the Error is Back:
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/co/public_html/hand/includes/unicode.inc).
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of /home/co/public_html/hand/includes/unicode.inc).
Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 529 of Warning: uasort() [function.uasort]: Array was modified by the user comparison function in views_fetch_fields() (line 5234 of /home/co/public_html/hand/sites/all/modules/views/includes/admin.inc).
This is a "Pay Per View" Conflict views .... and prevents use of views and displays.
Comment #5
Farreres commentedDoes this happen even after the last patches? Have you tried latest dev version?
Comment #6
Farreres commentedHmmm I think it must be related with the database storage. After modifying protected messages, they were textarea and now they are text_format, but in the database they are still expected to be textareas. I think I need to update the database schema in the way this post indicates: https://api.drupal.org/comment/30738#comment-30738
I will do it as soon as I can.
Comment #7
Farreres commentedHmmm, the last error of the set is this:
Warning: uasort() [function.uasort]: Array was modified by the user comparison function in uasort() (line 5227
There is a PHP bug that may be related to this:
https://bugs.php.net/bug.php?id=50688
They say php 7 has this bug fixed. Can you update your machine's PHP to 7 and see if this still happens? Maybe it's not something we have done wrong...
I am in paralel trying to find about the other errors:
Warning: mb_strtolower() expects parameter 1 to be string, array given in mb_strtolower() (line 529
Comment #8
tontoman commentedFarreres,
@ #5 , I always double check for the latest Drupal and moneysuite and make sure no patches or update have been missed.... everything is current.
@ #6 , Let me know if database schema has been updated.
@ # 7, I will follow up regarding Php7 Upgrade to see if its viable and if its a possible fix.
Comment #9
Farreres commentedI have been working 3 days on this with no success. I know the problem and I don't know the solution. Maybe someone can help.
Right now the messages for protected content have been changed into text_format. This causes that the field content is no more text but an array composed of text and format. This pair should be flattened before saving in the database. All I have found explains how to do it with a field, but our text_format is within a formatter.
I first found here http://stackoverflow.com/questions/6241710/wysiwyg-in-custom-field-in-dr... someone having a similar problem. Developing on the field_validate solution in the answers I could manage to flatten the form and removing the views error but then the form lost its contents.
I also played with implementing hook_field_presave() so that form fields would be flattened before saving, but I can't manage to get the hook called. It seems a module must be created for the field.
The problem is that the text_format that is causing problems is not really one field, but one formatter that is adding fields to the form via hook_form_alter. I haven't found anywhere explaining how to manage text_format fields as formatter fields.
Maybe someone can help. Or maybe I didn't explain too clearly... I can give more details if you want.
Comment #10
Farreres commentedAs this problem surpasses my knowledge of drupal I have created a support request in the support forum: https://www.drupal.org/node/2632016
Let's see if someone helps.
Comment #11
Farreres commentedI have checked where does this error in create view comes from, and I got this:
error in mb_strtolower: array ( 0 => 'MS PPV Custom Node Price Revisions', 1 => 'Content revision', )
So, when create new view link is selected, we end up with function mb_strtolower having a parameter array ( 0 => 'MS PPV Custom Node Price Revisions', 1 => 'Content revision', ) instead of string. No idea why...
Comment #12
Farreres commentedI have located a problem, although I don't really know where does it come from.
I have checked the Warning: uasort() [function.uasort]: Array was modified by the user comparison function in uasort() (line 5227. It happens in file views/includes/admin.inc function views_fetch_fields.
The problem comes in the uasort function in line 5227. Checking the table that uasort receives I see that sometimes the base titles are tables. For example in this case:
The content in title within base is what reaches mb_string and then it complains about not having a string.
Somehow it seems ms ppv is keeping revisions (I don't really know why is it necessary) and it is creating titles that generate errors.
Anyone has an idea how to solve this?
Comment #13
Farreres commentedLet's see, I think I have solved this problem. I have commented out revisions of ms ppv custom node price and this removes the error. If someone needs to activate revisions again, the mechanism should be revised so it doesn't generate errors again. I have also flattened formatter protected message, it should solve also some errors. Maybe this flattening should be applied to more places, but right now it is applied to only the formatter message field.
Please, try and verify it is working ok. Maybe you will need to edit formatter protected message and format, this update is probably not backwards compatible.
Comment #14
Farreres commentedComment #15
sagar ramgade commentedYes it seems removing revisions table from hook_entity_info resolves the problem. The patch attached resolves it after clearing the cache.
Comment #17
Farreres commented@Sagar: I chose to comment out the lines referring revisions table in case someone needed it in the future and it could be done correctly. Do you think it is ok just to remove it? If so I will do. Right now they are commented out.
Comment #18
sagar ramgade commentedHi Farrese,
Its better to keep it commented for now, We need someone to test the patch with revisions to confirm that everything works fine.