Jump to content


  • Posts

  • Joined

  • Days Won


 Content Type 



IPS4 Providers

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog



Posts posted by CodingJungle

  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.


    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 [];


    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. 

    /* 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')) {
    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()}}
                            1 => [
                                'selector' => 'html > body',
                                'type'     => 'add_inside_end',
                                'content'  => '<!--ipsQueryLog-->',
            return [];
        /* End Hook Data */
        public function globalTemplate($title, $html, $location = [])
                Output::i()->cssFiles = array_merge(
                    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(
            $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] );




    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':

    /* To prevent PHP errors (extending class does not exist) revealing path */
    if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
    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()

  5. [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. 

  6. 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"

    	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.  


  7. On 7/7/2021 at 6:45 AM, Adriano Faria said:

    Any clue?

    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. 

  8. 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. 

    36 minutes ago, Sonya* said:

    Additionally, when Inserts are created and there are many columns, the control buttons (edit/delete) are out of view.

    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. 

  10. 9 hours ago, Joey_M said:

    @CodingJungle: Will this be marked as 4.6 ready or do you need to update the application? I need to renew it, but I am currently on 4.6 and cannot install resources unmarked as 4.6 ready.

    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 🙂 

  11. 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?

  12. On 6/18/2021 at 7:08 PM, media said:

    Are you around @CodingJungle

    sorry for the delay, my minion seems to have skipped out on me. 

    I've been in the hospital for the last month and just got released last week.

    I installed the app to 4.6 and it seems to be working with 4.6 without any issue, i'll double check and do a version bump as a maintenance release. 

  13. my request:

    1. can we get documentation for adding API to our apps, I'm having to add it to 3 different apps atm for a project for a client, and i'm really sorta winging it. looking at what you guys have done, but even then its not all that clear what is being done or why.
    2. please document the graphql api you've added, i'm assuming you are using this in your mobile app, since i can't find any reference to it in any of your php/js code.
    3. '/^\s*\*\s*@([a-z]*)(\t+([^\t]*))?(\t+([^\t]*))?(\t+([^\t]*))?$/', found in /system/Api/Controller.php line 319. hopefully I can express how much misery this regex has caused me. you guys are literally the only software or framework i know of, in php or not, that uses tabs in their code. I use spaces, the rest of the world uses spaces, I have git hooks that will actually reject code for using tabs instead of spaces, my IDE is configured to use spaces. so for like .00001% of the over all app, on stuff that isn't even code, i have to undo ALL of that, just so the api reference docs are processed and shown in the ACP for the other devs on this project to have easy access to that info. I spent a good long while trying to figure out why it was not showing or throwing an exception in the api references, as there was no clear indication as to what was causing it or why. so for sanity sake, please make this regex more robust to look for tabs or space (or better yet, not rely on phpdoc block for api reference, make it a json/xml/txt in <app>/data that can be read and parsed out). 
    4. $this->_respond( json_encode( $output, JSON_PRETTY_PRINT ), $response->httpCode, NULL, $shouldLog, TRUE ); /system/Dispatcher/Api.php line 338/342/348., this code does not always produce valid json. it looks like json, but its not, its corrupted. I've had to add 'JSON_HEX_QUOT | JSON_HEX_TAG ' to the flags section of json_encode to get it to produce valid json (i did this thru a hook, but had to overload the entire method, cause there was no point in the code execution, i would be able to add those 2 flags). So please either add those flags or move the json_encode to a method inside the dispatcher, where all it does is json_encode, that way i can hook it and add those flags or any other flags i might need in the near future. 
    5. editor content from the api doesn't not get the file or url place holders replaced, i was pulling articles and blogs records, and none of the internal links or attachments were showing up, cause they still had the <___base_url___> and <filestore> stuff still in them, so i had to go hook blogs and articles api to parse them (haven't gotten to the other apps yet). 
    6. embed/iframe content also is not loaded, cause the src attribute is empty, as the source is still on data-embed-src (i'm assuming this is apart of the IPS lazy loading that didn't get scrubbed properly).
    7. on db records, you include a title property but in 'fields' property, it also includes the title field content as well, so if that can be removed or at least give us the ID of which field_# is the title, same for description. 
    8. can you also include for any dates, a rfc2822 format along with the rfc3339, as javascript does not like the rfc3339 one (example: DateTime::ts($sometimestamp)->format(RFC::882), this will return a rfc2822 formatted date). heck even a raw unix timestamp would be better than a rfc3339 :). 

    to be completely honest, the api has not been a pleasure to write code for or to work with. it is one of the most difficult API's i've used. I have spent about 20 times longer debugging and finding solutions, than i have actually writing code to use the api. any way, i hope you guys can address these issues, if not, I might be forced to abandon the api and find another solution.

  14. I am not entirely sure when this began. I first noticed it 2 to 4 months ago on my local dev environment, but when i moved from a lamp to docker, the problem went away, so i figured it was just something funky in my lamp stack (as one of the reasons i wanted to move away from LAMP to docker, was using different mysql & php version, along with nginx or apache, to tailor the dev environment to my own clients servers). 

    However, I've been getting reports trickling in that a few of my apps, that the settings will not save. so i've been looking into it, and tonight i installed a few of my apps on my clients site. I configured the apps, all went as fine, and then i went back to change another setting, and the new value would not take. so i thought maybe it was a funky cache of settings, so i ran the support tool, nada. I messed around with it for about 20 minutes, decided to back burner it for now, as i had other things i needed to install and do on the site. I did discover, if I installed/updated an app or plugin, the settings that did not change after they were saved or when i did a cache clear. However if i installed or updated an app or plugin, the values would get updated.

    of course with this being third party code it is happening on, i wanted to completely rule out my own code (which btw is pretty boiler plate way to save the settings from the form, but i wanted to remove the possibility it was something in my own code). so i created a test plugin, put a few settings in it, tested it on 3 different servers (my own production server, and 2 of my clients) and sure enough on my server and one of my clients, once after the initial setup of the settings and saving, any subsequent changes/saves, will not be reflected. (i checked their values in the DB and they had been updated, but the store was stale), however running the support tool did not fix this, only installing/updating an app would have the changed settings reflected.

    next to further debug this, i went over to the dev sites of my clients and my site (again on 3 different servers), i disabled all the 3rd party apps and plugins, with the exception of my test plugin. Again on my server and one of the client server that wouldn't change the settings in the previous test, same thing. the settings would update in the DB, clearing the store with the support tool did not work, but installing/updating an app or plugin, they would (even enabling or disabling an app would have no effect). 

    my next test was just try to update the settings manually with changeValues(), my code was simple.

    $settings = [ 'test_plugin_setting_a' => 1, 'test_plugin_setting_b' => 2, 'test_plugin_setting_c' => 3, 'test_plugin_setting_d' => json_encode([1,2,3,4,5,6]) ];

    still no joy.  the settings do exist, they don't have default values, they've been set by the plugins setting panel. as before,  they would be updated in the DB, but not when viewing the settings, they would only show the new values after installing/updating a new app. 

    this is only happening with some 3rd party apps (more on that later) on my server and my clients, i can not duplicate it with IPS settings in IPS apps, but comparing the code, they are virtually identical. I am unable to figure out what is going on, as i've scoured logs too, nothing. there are no errors. servers are all running the latest version of php 7.4, fpm and apache. they all have filesystem as their storage location for the store, mysql versions variate between the servers, but they are different versions but all above the min. version required by IPS.  there is no cloudflare, or any other cdn or cache programs installed. 

    So i re-enabled all the third party apps and plugins (some mine, some not). So i began to change settings in all of them, to see which ones would update and which ones wouldn't. It was just completely random, some of my apps would do it, but others would not, some other third parties apps created by other devs would do it, others would not. looking at their code and mine, its pretty basic stuff, example:

            if ($values = $form->values()) {
                Output::i()->redirect(Request::i()->url()->setQueryString(['do' => 'manage', 'params' => 1])->csrf());

    the above is from my applications stratagem.

    		if ( $values = $form->values() )
    			if ( isset( $values['forums_popular_now']['never'] ) )
    				$values['forums_popular_now'] = json_encode( array( 'posts' => 0, 'minutes' => 0 ) );
    				$values['forums_popular_now'] = json_encode( $values['forums_popular_now'] );
    			if ( isset( $values['forums_default_view_choose'] ) )
    				$values['forums_default_view_choose'] = ( \is_array( $values['forums_default_view_choose'] ) AND !\count( $values['forums_default_view_choose'] ) ) ? NULL : json_encode( $values['forums_default_view_choose'] );
    			if ( isset( $values['forums_topic_activity'] ) )
    				$values['forums_topic_activity'] = json_encode( $values['forums_topic_activity'] );
    			if ( isset( $values['forums_topic_activity_features'] ) )
    				$values['forums_topic_activity_features'] = json_encode( $values['forums_topic_activity_features'] );
    			if ( isset( $values['forums_topics_show_meta'] ) )
    				$values['forums_topics_show_meta'] = json_encode( $values['forums_topics_show_meta'] );
    			$form->saveAsSettings( $values );
    			/* Clear guest page caches */
    			\IPS\Session::i()->log( 'acplogs__forums_settings' );
    			\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=forums&module=forums&controller=settings&tab=settings' ), 'saved' );

    the above is from forums. they both assign $form->values() to $values, and they both user $form->saveAsSettings($values);, the only difference is you guys are doing some post submit processing on the values, i don't need to, but even on the apps that do some post submit processing, this problem creeps up.

    I'm pretty confident its not a code issue, but a server configuration issue of some kind (as to what configuration is causing this i have no clue). I've compared php and mysql config file between my production server, the other client server that is having this issue, with my local dev and the other clients site that isn't having this issue, but nothing is really all the different, and the configs that were different, i made the changes on my production server without any effect.  I can say with the exception of my local dev, the 3 servers are all running centOS 7, with cpanel, with all the latest updates available to them. 

    I only have a server sample of about 10 different servers i can access to test this issue on my own, you guys have potentially access to thousands, has this problem arose else where or been reported to you and you guys pushed it back to the third party dev thinking it was something wrong with their app? has any third party dev reading this, come across this? were you able to find a solution? any help would be appreciated, at this point my only possibly option would be to hack my around \IPS\Settings on the servers that are affected. 

    P.S. I did think maybe it was opcache, but i disabled this on all 3 servers once i noticed the issue, still no joy. 

  15. 1 hour ago, Daniel F said:

    It seems that Stratagem breaks the Calendar Sitemap generation.


    #0 /var/www/html/105129/init.php(893) : eval()'d code(47): IPS\Patterns\_ActiveRecord::load(133, 'project_calenda...')
    #1 /var/www/html/105129/applications/core/extensions/core/Sitemap/Content.php(186): IPS\calendar\stratagem_hook_calendarEvent::getItemsWithPermission(Array, NULL, NULL, 'read', -1, 0, Object(IPS\Member), NULL, NULL, NULL, true)
    #2 /var/www/html/105129/system/Sitemap/Sitemap.php(85): IPS\core\extensions\core\Sitemap\_Content->getFilenames()
    #3 /var/www/html/105129/applications/core/tasks/sitemapgenerator.php(39): IPS\_Sitemap->buildNextSitemap()
    #4 /var/www/html/105129/system/Task/Task.php(367): IPS\core\tasks\_sitemapgenerator->IPS\core\tasks\{closure}()


    they must not be on the latest version, cause it has a try/catch around that section for this reason.


  16. 40 minutes ago, bfarber said:

    Someone ( @CodingJungle I believe) has a tool which helps support IDE autocomplete, however I'm not certain it helps with templates parameters and syntax.

    about all it does for "templates" is in a limited fashion gives you a template function list for getTemplate (based on the group param) and if it finds the template, will give you param hints (but this is only in phpstorm and if you have the phptoolbox plugin installed for phpstorm).


    for an IDE like phpstorm, i usually assign *.phtml to twig in file types, it doesn't do much, but does add some color.

    before being assign to twig:


    after being assigned to twig:


    but other than that, there isn't any plugin i know of that will assist with IPS templates and i'm not crafty enough with java to make one 🙂 

  17. 8 minutes ago, Midnight Modding said:

    Still confusing, though, how that change made it where only some inputs had the issue and all nodes showed up fine in the selector even then, just sometimes not one selected. I would have expected every one to have the issue when there was a problem with that method in the class. Pretty odd, but not worth me going through figuring out why.

    it was probably silently failing inside the node helper, if you don't have php setup to show errors or have overridden it via ini_set or in htaccess. 

  • Create New...