Jump to content



  • Posts

  • Joined

  • Days Won


CodingJungle last won the day on March 14

CodingJungle had the most liked content!

About CodingJungle

  • Birthday 08/18/1981

IPS Marketplace

  • Resources Contributor
    Total file submissions: 15

Recent Profile Visitors

27,708 profile views

CodingJungle's Achievements

  1. yeah i originally thought it was the hookData, cause when i looked at the IPS code in the section the error was referencing i thought that was the only one that it could be, cause hookData() use to do something and use to be required to call it πŸ™‚ , so i'm not entirely sure when they changed that, cause it is almost identical to the 4.5 code and my sister has my laptop so i can't look up previous versions atm. anyway, if you are overloading a template, you need to put that container code in it, to check to see if it is callable, then use call_user_func_array to call the method instead of parent.
  2. @Adriano Faria its not 4.6 that is at fault per se, IPS is at some fault here due to the way they engineered how the theme hooks work, but it's the latest php 7.4 and 8.0 that is the issue. example: <?php class myclass { public function myfunction(){ return parent::myfunction(); } } this will error out on the new versions of 7.4 and 8.0, cause myclass isn't a child class of anything, so there is no parent to call. the theme hooks get eval'ed as stand alone classes, they replaced the " extends _HOOK_FILE" with "_tmp" (same with parent::hookData() gets replaced with array() ), so the class would be something like class my_theme_hook_temp {}. during the eval process, it it validating the code and that validation is failing on anything with parent::myfunction() that is being called in the code, that is why the call_user_func_array is working for toolbox, cause it passes the validation, so the template will build. so its not the parent::hookData() that i original thought it was, cause i just took a cursory look at the code, patched my files, it seemed to work cause my datastore wasn't cleared, but as soon as it cleared, i got that error. so in any template overrides you are doing, you need to wrap it with a if(\is_callable('parent::myfunction')){} and then inside the if statement, call the parent method with: return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); like i have done in the example hook i posted a few post up. if you need further help, send me the app, and i will make the changes so you can see within your code what i'm talking about πŸ™‚
  3. on the hookData() method, just do: public static function hookData(){ return []; } or public static function hookData(){ return parent::hookData(); } it gets replaced by an empty array anyway before its eval'ed the solution i came up with last night is to overridden templates methods, look at the test.tar hooks folder, you will see what i mean. its a theme hook in php mode. the other thing you should do, is manually delete everything in the datastore folder, there would be times when i was testing that would be causing the issue. here is one of the them hooks i use in my toolbox apps, i have two template methods i'm overriding to be able to manipulate their parameters. //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ use IPS\Output; use IPS\Request; use IPS\Theme; if (!defined('\IPS\SUITE_UNIQUE_KEY')) { exit; } class toolbox_hook_adminGlobalTemplate extends _HOOK_CLASS_ { /* !Hook Data - DO NOT REMOVE */ public static function hookData() { if (\is_callable('parent::hookData')) { return array_merge_recursive( [ 'globalTemplate' => [ 0 => [ 'selector' => '#ipsLayout_header', 'type' => 'add_inside_start', 'content' => '{{if $menu = \IPS\toolbox\Menu::i()->build()}} {$menu|raw} {{endif}}', ], 1 => [ 'selector' => 'html > body', 'type' => 'add_inside_end', 'content' => '<!--ipsQueryLog-->', ], ], ], parent::hookData() ); } return []; } /* End Hook Data */ public function globalTemplate($title, $html, $location = []) { Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css('devbar.css', 'toolbox', 'admin') ); if ( \is_callable('parent::globalTemplate') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); } } public function tabs( $tabNames, $activeId, $defaultContent, $url, $tabParam = 'tab', $tabClasses = '', $panelClasses = '' ) { if (Request::i()->app === 'core' && Request::i()->module === 'applications' && Request::i( )->controller === 'developer' && !Request::i()->do) { $tabNames['SchemaImports'] = 'dtdevplus_schema_imports'; } if ( \is_callable('parent::tabs') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, [$tabNames, $activeId, $defaultContent, $url, $tabParam, $tabClasses, $panelClasses] ); } } }
  4. let me know, it seems to have worked for the toolbox, now i possibly gotta figure out a clever way to automate this for the future πŸ™‚
  5. @Adriano Faria if ( \is_callable('parent::includeCSS') ) { return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() ); } something like this appears to work (change the if statement to the method you are overriding). i haven't tested it exhaustively, but it might be better than waiting for ips 4.12 for a fix πŸ˜›
  6. test 1.0.0.tar here is a proof of concept app for this issue, it is just one theme hook in php mode, overriding 'includeCss': //<?php /* To prevent PHP errors (extending class does not exist) revealing path */ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) ) { exit; } class test_hook_globalTemplate extends _HOOK_CLASS_ { /* !Hook Data - DO NOT REMOVE */ public static function hookData() { return parent::hookData(); } /* End Hook Data */ public function includeCSS(){ return parent::includeCSS(); } } parent::hookData() gets replaced with an empty array before you eval it, so the only thing that can be causing it is the parent call to includeCss()
  7. [Thu Jul 08 19:00:59.697206 2021] [proxy_fcgi:error] [pid 3910:tid 6158315520] [client ::1:51242] AH01071: Got error 'PHP message: PHP Fatal error: Cannot use "parent" when current class scope has no parent in /Users/michael/public_html/dev/system/Theme/Theme.php(2613) : eval()'d code on line 57', referer: http://localhost/~michael/dev/ this is the error that shows up in my apache log. i've tried several different things, even checking if parent is callable on the overloaded templates in the hook, still causes this error to pop up in php 8, not sure about 7.4, but i'd imagine it will there too as well. the line number might be a bit off for Theme.php as inserted some code to try to catch which theme hooks were erroring out.
  8. Okay after a bit more digging into the code, i see why this can happen. it is any theme hook, that has an override for a template in it or aka "theme hook in php mode" try{ if ( eval( "namespace IPS\\Theme;\n\n" . str_replace( array( ' extends _HOOK_CLASS_', 'parent::hookData()' ), array( '_tmp', 'array()' ), file_get_contents( $path . '/' . $data['file'] ) ) ) !== FALSE ) { $class = "IPS\\Theme\\" . $data['class'] . "_tmp"; $templateHooks = array_merge_recursive( $templateHooks, $class::hookData() ); } } catch ( \ParseError $e ) { } in php 8.0 it is now a fatal error to call a non existing parent class/method, in the latest php 7.4 it is a deprecated. so since at this point, the hook in php mode isn't actually extending another class, it is blowing up. this is def an engineering issue on IPS side of things. so technically any theme hook in php mode, that eval and try to call a parent method that doesn't exist, will throw this fatal/warning in the current versions of php. we don't see it while IN_DEV cause templates are compiled differently there. i wonder now if it happens with class hooks, that get wrapped up by IPS try/catch block they place inside every method, even if the method doesn't exist in the parent.
  9. yeah, after further debugging, that wasn't the solution, might've been a stale opcache on my end that made me think it was working. I really don't know now toolbox has a ton of hooks, its gonna take a lot of work to go thru each one and try to find the culprit.
  10. i submitted an update for it a few days ago to the market, so i don't know how long it will be till it is approved.
  11. i've released 2.4.0 of stratagem to the marketplace and my website (the marketplace one might take a little bit to be approved, i heard they have quite a backlog). here is the changelog for 2.4.0, a few new features and several fixes. fixed issue with project filters (they now work again :)), also fixed it showing cards that meet 1 or 2 of the criteria for filters instead of all of them. fixed issue for notifications, when a user is removed from a private project, they should now no longer be able to receive new notifications. fixed issue with "limit card view", due to a permission misconfiguration, wouldn't show all cards with a team member who had the permission to "card sort" or "card assign" fixed/change how calendar integration works. now we use a more custom solution, instead of directly using the calendar app. (still requires the calendar app to be installed, as this new method uses the css/js from calendar). this solution should prevent duplication of strategem calendars and duplicate stratagem events on that calendar, the calendar is now generated at access time, and the card events are generated then and there as well. NOTE: you can safely delete any stratagem calendars that were created by previous versions, as they will no longer be used. Copying: added in copying of project/column/cards. you will enable in project settings if you want copying to be enabled, and then assign the permissions to the teams as you see fit. Note: if a project is has limit card view enabled, then team members will only be able to copy the cards they can see (this also applies if they copy the project, it will only copy the cards they can see). This also applies to columns that have restrictions, if they aren't on the allow list (een if they can see the column and its cards), they will not have the copy option nor will they be copied if the project is copied. Note2: copying cards is a instant action, but copying a column or project runs thru a task, so there might be a delay between copying the column/project, before it shows up or is completed. Note3: A lot of the settings for a project will be copied, but things like "real time mode", "due date", "publish date", "slack hooks", "git repos", and a few others, will not carry over to a copied project, nor will teams. all copied cards from a project, will have their creation date and author updated to the time it was copied and the user who copied the project. Several new history entries, mostly related to copying cards/columns/projects. fixed issue with quick access, it should now update properly for any changes to columns. fixed "lock project" and limit card view settings, before if you locked a project with limit card view enabled, it would show the restricted cards to anyone who viewed the project, now it will function as it would before locking the project.
  12. just fyi, i got annoyed with the interface issues, and on my toolbox app, one of the tabs that is added is "table imports", this allows you to insert the data thru like phpmyadmin/adminer and then import it into your application.
  13. i'm working on a 4.6 update. one of the bigger aspects of this update i'm working on, will be is a custom calendar section, as trying to integrate into the calendar has had varying amounts of success and issues, so i've decided to add a calendar section to stratagem, it will still require calendar as it uses its JS and css, but it doesn't actually use the calendar app itself. this should allow for more things i can do with it eventually πŸ™‚
  14. On my localhost, with php 7.4 i have E_ALL enabled, and if i am not in_dev mode, my theme hooks for my toolbox app causes this error: Cannot use β€œparent” when current class scope has no parent i've tracked it down to the hookData() method: public static function hookData() { return parent::hookData(); } i've been able to correct it with this code: public static function hookData() { if (is_callable('parent::hookData')) { return parent::hookData(); } return []; } now i am not entirely sure why i have to do this, it only seem to have started with 4.6 (maybe its a change i'm unware of, but i am not sure if it is happening in any of my other apps, as i don't often make theme hooks nor am i often not IN_DEV). now on a proper production server, E_DEPRECATED should be suppressed and this isn't a super priority, its more of a curiosity why it is happening, and why i had to make the change, was it a change in 4.6 theme hooks? is my code just bad? i mean i know some of it is clunky and nonsensical sometimes, but its happening even on the theme hooks that i don't add a theme hook, but i'm overloading a theme method, so the hookData() is just empty, returning the parent. it happens both on my mac and linux pc, so i'm not sure what to think. php version is the latest 7.4 on both. so any ideas?
  15. First off, great interview. Secondly, who's next? please be @Lindy πŸ˜› Thirdly, since linux was mentioned in this thread, and having been a long time user and advocate of opensource software and using linux as my daily driver for the last 15 to 16 years. I must say, i'm glad to see the passion still out there for linux and the hopes of the "year of the linux desktop", it takes me back :). However, I don't believe linux is quite for everyone, or even sure it ever will be. I'm a very experienced user with it and there are things that i still run into that make me bash my head into my desk. Linux and its distro's (just being plural) shows how fragmented the linux ecosystem truly is. so much resources/code and developers are spread out over so many different things. Like example, the desktop managers, there are possibly hundreds of them (i'm including window managers as well). sure these things give users choice, but also at the same time, it keeps linux on the fringe. Not to mention some of the absolute state of some of the subsystems, like audio and display. The audio sub-system has been a mess for years, pulse was a bandage, but that bandage has been peeling off for years. I can't count how many times a week i have to switch back to my speakers from waking up or restarting, cause pulse thinks my micronphone is a speaker...I guess there are some new bandaids out there on the horizon, like pipewire that fedora is using, but i don't think it addresses the underlying problem, that audio is crap under linux and i don't really see it getting better. Same with xorg and wayland, they are both in absolute embarrassing state. xorg cause it is bogged down by 1980's backwards compatibility and tacked on "modern" features, as well as its security issues. then you have wayland, which just completely lacks direction, the developers of it are hostile, and considering how much money and other resources that have been dumped into it, its debut date was suppose to be back in ubuntu 11.04, we are now on ubuntu 21.04 and it only supports a small fraction of gpu's out there and even less compatible with popular applications. sure we can get into a petty fight like apple does about how nvidia is the worst, but nvidia is like that, cause they are popular and on top and have been for a very long time, so they've sorta earned the right, where a project like wayland has no real credibility to be telling the largest gpu manufacturer in the world what they should be doing. Sure you can make a lot of things work with it, but as i've grown older, i've also become frustrated with linux. One reason why i am hoping wsl becomes a shiny beacon in the night in windows for development (cause development in windows just sucks, sucks so much that it has made me endure the inadequacies of linux all these years). I also just purchased a mac mini, god help me that i don't become one of "those" computer users πŸ™‚. the appeal of the new architecture, with most of the benefits that linux offers, without most of the headache, is very appealing to me at this point in my life. on a finally note to steer the conversation back, I would like to add my two cents about anonymity and toxicity. I have over the years, as many of you can attest, have been toxic myself. I will say things i would never say in real life to others, as well as try to purposely raise the temperature just to get a reaction out of people. A lot of that is cause i've always viewed the internet as sort of the "wild wild west", that it offered a level of "freedom" that polite society doesn't offer. It is also easy to forget that the avatar/username you are replying to, has a person at the other end, they lack humanity unless they are in your circle. as for a solution to that, i don't know if there is one. any way, good interview, will look forward to future ones.
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy