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

Gp_menu -problem #699

Open
gtbu opened this issue Oct 20, 2022 · 0 comments
Open

Gp_menu -problem #699

gtbu opened this issue Oct 20, 2022 · 0 comments

Comments

@gtbu
Copy link

gtbu commented Oct 20, 2022

I get (tested under php5.6 , php7.4.10 and php8.0) for GetSubMenu the error : Error: Unsupported operand types: gp\Page\Edit -- int in line 122.

  • A var_dump of search_level shows, that it is an object-array : ( object(gp\Page\Edit) (46) { ... } ).

  • I do not understand the -1 in max(0, search_level -1) i.e. array-subtraction of an int (-1) - such max also in lower php-versions not possible ! Evtl it should be max(0, search_level, -1) ?

  • Completely without the -1 gives the error : Object of class gp\Page\Edit could not be converted to int

  • one remains : Object of class gp\Page could not be converted to int in: ...\include\tool\Output\Menu.php on line: 141 ($level == $search_level )

  • And another problem is : echo max(0,'hello'); before PHP 8.0 will return int(0) but since PHP 8.0 it returns string("hello")!!

Up to tp5.0b2 no error comes up - first in tp5.0rc1 ( both php5.6).
Up to tp50beta2 the first sublevel of the sidemenu functions - in tp5.0rc1 it doesnt.
In both versions the menu.php is identical, and so the incoming data must be different :

A deeper look at $search_level (which is initialized with 'false' ) direct after global $page; with var_dump shows, that the strangley contained object(gp\Page\Edit) (46) { ... } is the problem :
gp\Page\Edit Object (
[draft_file:protected] => I:/Xa/xampp/htdocs/tp50rc1/data/_pages/zvDWE1u_k/draft.php
[draft_exists:protected] =>
[draft_stats:protected] => Array ( ) ....

**while in tp50b2 it contains bool(false) **
After adding $search_level=false behind $reset_level = 0; (to remove the object) the submenu disappears
Unclear from where the content *object(gp\Page* comes. Drafts appear in gp/page edit.php ( SetVars)

Perhaps has Joshua an idea (the code exists already in gpeasy 4.4.

P.S. After long nights here a workaround : Add $search_level=0; before $reset_level = 0; (empty line 119)

  • with 0 You get the full submenu with the other lower levels
  • with 1 You get only the first sub-level
  • with 2 You get only the second sub-level
    This should be worth to reprogram it so far, that < ? php GetSubMenu() > can be used with (,,1...3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant