Jump to content
View in the app

A better way to browse. Learn more.

Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hook compile errors are discarded silently even in dev

Featured Replies

Posted

Currently, if a hook has a compile error, such as not reflecting the parameters of the method that it overrides (particularly an issue with the backwards-incompatible changes in 4.2), the error is discarded silently, even when IN_DEV. This obviously isn't ideal. Can we kill two birds with one stone and get better exceptions for hooks too, by replacing the monkey patch code with

					$contents = "namespace {$namespace}; ". str_replace( '_HOOK_CLASS_', $realClass, file_get_contents( ROOT_PATH . '/' . $data['file'] ) );
					if (\IPS\IN_DEV) {
						$filename = tempnam(\IPS\TEMP_DIRECTORY, "HOOK_{$namespace}\\{$finalClass}_{$data['file']}");
						$fullContents = "<?php " . $contents;
						\file_put_contents($filename, $fullContents);
						
						register_shutdown_function( function( $temp ) {
							unlink( $temp );
						}, $filename );
						
						require $filename;
						
						$realClass = $data['class'];
					} else {
						try
						{
							if( @eval( $contents ) !== FALSE )
							{
								$realClass = $data['class'];
							}
						} catch ( \ParseError $e ) { }
					}

I have tested this code and not encountered any issues (though on windows there might be a problem with the use of \, in which case maybe a replace to - or _ is needed).

Edited by Colonel_mortis

I'll see if something can be done. Thanks for the suggestion.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.