error when trying to view fields in admin view #967

Closed
opened 2022-12-29 23:11:03 +00:00 by alanwebsites · 7 comments

When I am using component builder everything works fine until I try to edit the fields from the admin view.

Reproduce:

Admin view
Fields
Edit (to add more fields)

I get

An error has occurred.

0 Argument 1 passed to VDM\Joomla\Utilities\GetHelper::between() must be of the type string, null given, called

Expected it to show fields to edit.

Joomla latest version
PHP 7.4
Firefox

Thanks

When I am using component builder everything works fine until I try to edit the fields from the admin view. Reproduce: Admin view Fields Edit (to add more fields) I get An error has occurred. 0 Argument 1 passed to VDM\Joomla\Utilities\GetHelper::between() must be of the type string, null given, called Expected it to show fields to edit. Joomla latest version PHP 7.4 Firefox Thanks
Owner

Joomla latest version

Do you mean Latest Joomla 3.10 version?

Area you using JCB v3.1.12?

> Joomla latest version Do you mean Latest Joomla 3.10 version? Area you using JCB [v3.1.12](https://git.vdm.dev/joomla/pkg-component-builder/archive/v3.1.12.zip)?
Author

Hi

I'm using JCB 3.1.12 and Joomla 3.10.11

thanks

Alan

Hi I'm using JCB 3.1.12 and Joomla 3.10.11 thanks Alan
Owner

From what I am seeing it is possible that this error comes because you have fields that are not having properties set. Since with the new search function I looked over all the places where we use this function: GetHelper::between(), you will have to search for Helper::getBetween( as we are pulling the function via the helper class at this point. This will change going forward.

But okay in my search for this string, in the admin view I found only 8 places its used:

image

Since your speaking about the admin view, that is ID:14, which means there are only two places this can go wrong:

image

Here we are getting the field select options, if the field is a list field.

image

This is used to get the all the places the view is linked to.

Both of these will only respond with that error because a field in your system does not have properties set.

image

How this happened I don't know. How to find this would be to open PHPmyAdmin and search over this table.

image

Should you not find it this way... you may need to manually go over the table looking at the xml column and see if you find something strange.

From what I am seeing it is possible that this error comes because you have fields that are not having properties set. Since with the new search function I looked over all the places where we use this function: `GetHelper::between()`, you will have to search for `Helper::getBetween(` as we are pulling the function via the helper class at this point. This will change going forward. But okay in my search for this string, in the admin view I found only 8 places its used: ![image](/attachments/049005ba-a5f7-4375-9778-59cbb9c64151) Since your speaking about the admin view, that is ID:14, which means there are only two places this can go wrong: ![image](/attachments/809ff03b-8e1c-4109-8fdb-db45f3a47f93) Here we are getting the field select options, if the field is a list field. ![image](/attachments/2cf4931f-71f5-4a07-8dc9-15ad90979346) This is used to get the all the places the view is linked to. Both of these will only respond with that error because a field in your system does not have properties set. ![image](/attachments/262238d8-88d2-4ec8-b946-2c260480e660) How this happened I don't know. How to find this would be to open PHPmyAdmin and search over this table. ![image](/attachments/48b14d86-5a06-4438-8032-84ddb7146fe7) Should you not find it this way... you may need to manually go over the table looking at the xml column and see if you find something strange.
Author

Thanks for the detailed reply :)

I've looked in the table and all the xml values are filled in.

Is it possible for me to adjust the code to get it to tell me where the problem is? Could I add something to checkArray($_fields) to get a list of the problems.

Argument 1 passed to VDM\Joomla\Utilities\GetHelper::between() must be of the type string, null given, called in /mnt/storage/vhosts/firstsight1.com/httpdocs/libraries/jcb_powers/VDM.Joomla/src/Utilities.php on line 397

I put some debug code into Component builder protected function getLinkedTo($view, $id, $guid)

but it looks like it's not reaching this point.

Can you tell me the order things get called once you clikc edit-> in the admin fields view and I'll try to trace it that way - or any other suggestions.

thanks

Alan

Thanks for the detailed reply :) I've looked in the table and all the xml values are filled in. Is it possible for me to adjust the code to get it to tell me where the problem is? Could I add something to checkArray($_fields) to get a list of the problems. Argument 1 passed to VDM\Joomla\Utilities\GetHelper::between() must be of the type string, null given, called in /mnt/storage/vhosts/firstsight1.com/httpdocs/libraries/jcb_powers/VDM.Joomla/src/Utilities.php on line 397 I put some debug code into Component builder protected function getLinkedTo($view, $id, $guid) but it looks like it's not reaching this point. Can you tell me the order things get called once you clikc edit-> in the admin fields view and I'll try to trace it that way - or any other suggestions. thanks Alan
Author

Hi

I've adjusted

/httpdocs/libraries/jcb_powers/VDM.Joomla/src/Utilities.php

Line 397:

I added the if statement to the function

public static function getBetween($content, $start, $end, $default = '')
{
    if(!$content){
        $content="";
    }
	return GetHelper::between($content, $start, $end, $default);
}

This now allows editing but the formatting is a bit of a mess.

So it seems that whatever is passing $content isn't passing it correctly.

Alan

Hi I've adjusted /httpdocs/libraries/jcb_powers/VDM.Joomla/src/Utilities.php Line 397: I added the if statement to the function public static function getBetween($content, $start, $end, $default = '') { if(!$content){ $content=""; } return GetHelper::between($content, $start, $end, $default); } This now allows editing but the formatting is a bit of a mess. So it seems that whatever is passing $content isn't passing it correctly. Alan
Owner

Well I showed you the only places this is done, and if you can not debug it around those areas I can't really help, since I have never had this issue. The rule of debugging is the ability to reproduce the issue, and that is why I pointed you to the right places in the code, as I am unable to reproduce this issue on my side.

You should know I have 10+ different JCB instance running with many different projects and I don't get see this bug. What is true is all my instances run in a dockerized environment, and on PHP 7.4 (critical at this point). I am planing to push out a release to move us to PHP 8+ soon... been working very hard to achieve this.

Well I showed you the only places this is done, and if you can not debug it around those areas I can't really help, since I have never had this issue. The rule of debugging is the ability to reproduce the issue, and that is why I pointed you to the right places in the code, as I am unable to reproduce this issue on my side. You should know I have 10+ different JCB instance running with many different projects and I don't get see this bug. What is true is all my instances run in a dockerized environment, and on **PHP 7.4 (critical at this point)**. I am planing to push out a release to move us to PHP 8+ soon... been working very hard to achieve this.
Owner

As we now have a beta (nightly-build) branch with all the latest fixes, I will direct you to it and consider this issue resolved. If you discover that the beta branch does not address the issue, please leave a comment here explaining what you found, and I will reopen this issue.

https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip

As we now have a beta (nightly-build) branch with all the latest fixes, I will direct you to it and consider this issue resolved. If you discover that the beta branch does not address the issue, please leave a comment here explaining what you found, and I will reopen this issue. https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#967
No description provided.