71 Commits

Author SHA1 Message Date
Dylan K. Taylor
fcfd51dfc7
CrashDump: do not put FALSE into crashdumps in case file_get_contents() failed 2021-02-23 19:39:21 +00:00
Dylan K. Taylor
9ed430acb9
CrashDump: fixed a bug in crashdump generation 2020-12-23 21:53:12 +00:00
Dylan K. Taylor
f0241043de
CrashDump: add server uptime to crash information 2020-12-23 20:26:18 +00:00
Dylan K. Taylor
0604dfc9e5
phpstan 0.12.63 2020-12-18 00:32:55 +00:00
Dylan K. Taylor
104e90b794 CrashDump: more robust core crash detection 2020-12-08 23:27:03 +00:00
Dylan K. Taylor
994062f6dc CrashDump: fixed plugin detection on eval()'d code
it's possible we could clean the path up to detect which plugin caused the crash, but for now I'll be happy to not have them showing up as core crashes ...
2020-12-08 23:11:29 +00:00
Dylan K. Taylor
0b550b346b imports cleanup 2020-10-26 15:43:25 +00:00
Dylan T
69aa7c5ac1
Support for Composer v2 (#3880) 2020-10-24 16:42:38 +01:00
Dylan K. Taylor
804a062c3a CrashDump: report the versions of all Composer libraries installed 2020-04-19 12:11:34 +01:00
Dylan K. Taylor
5c7b05c2ba CrashDump: do not assign possibly-false return value of fopen() directly to non-union field
this would become a problem with typed properties, and also phpstan level 7 doesn't like it.
2020-03-15 15:48:09 +00:00
Dylan K. Taylor
9c86763322 CrashDump: do not assume that error_get_last() always returns array
this returns NULL if there was no error before the shutdown handler was triggered (usually caused by a plugin calling exit() prematurely).
2020-03-15 15:47:07 +00:00
Dylan K. Taylor
35490ca41c CrashDump: do not assume that file() always returns array
phpstan level 7 prep
2020-03-15 15:46:03 +00:00
Dylan K. Taylor
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
Dylan K. Taylor
9eebfa7cc3 populate missing array value types in root namespace 2020-01-30 21:43:00 +00:00
Dylan K. Taylor
ea935a1af5 pocketmine root: sweep missing return type information 2020-01-19 19:40:01 +00:00
Dylan K. Taylor
c22576a266 CrashDump: add void native return types to private methods 2020-01-17 13:55:38 +00:00
Dylan K. Taylor
17720041a3 phpdoc: populate missing parameter typeinfo 2020-01-11 21:53:24 +00:00
Dylan K. Taylor
1eedac87b2 added missing @var property types (reported by phpstan) 2020-01-09 14:13:54 +00:00
Dylan K. Taylor
a145e18c1e CrashDump: use fully qualified reference for GIT_COMMIT constant
this makes it easier to filter out PHPStan noise.
2019-10-25 16:08:37 +01:00
Dylan K. Taylor
6b4d8b91c6 fix crashdump plugin detection
some things which were copy pasting PM classes into plugins were causing incorrect detection here. The path cleaning guarantees that all plugin paths will start with "plugins/", so we can use that to check instead.
2019-07-30 18:58:31 +01:00
Dylan K. Taylor
e9d1af0aee Fixed stack trace encoding bug in CrashDump
it was encoding the real (full) trace, instead of emitting the printable version.
2019-01-16 18:56:56 +00:00
Dylan K. Taylor
22a6b817d7 Distinguish between direct and indirect plugin crash involvement
If a plugin was involved in a crash, we can't safely blame it for the crash, since it might have innocently triggered a core bug. Furthermore, it's difficult to accurately detect plugin causing things like invalid argument crashes.
2019-01-06 18:07:29 +00:00
Dylan K. Taylor
2cdf97b7b5 CrashDump: Scan full stack trace to determine plugin involvement 2019-01-06 18:07:29 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
34a899e28b Clean up Utils error handling functions (internal) 2018-12-16 17:50:00 +00:00
Dylan K. Taylor
b80868040e Utils: fixed getTrace() including itself in trace when no alt trace is given
it always seemed a little strange that crashdump trace would pop 4 frames when only 3 are written in the comment...
2018-12-16 17:15:16 +00:00
Dylan K. Taylor
dcef3cba21 CrashDump: cleanup some version related stuff
this should have been done a long time ago, but we didn't want to cause compatibility problems with CA. Now it enforces version checks, this isn't a problem anymore.
2018-12-08 16:58:06 +00:00
Dylan K. Taylor
5f8a9f8747 Add a new format_version field to crashdumps
this will be used in the future to allow CA to decide how to decode crashdumps and/or refuse crashdumps from incompatible versions.
2018-12-08 16:57:57 +00:00
Dylan K. Taylor
b7062e7bff CrashDump: don't try to report code that doesn't exist
this can happen when eval() is used, and then we get a big blank mess with nothing on it. eval() is a special case that should be handled separately, but for now this is just fixing a bug.
2018-10-16 09:50:59 +01:00
Dylan K. Taylor
1f9bed275a Merged server and API version 2018-06-17 12:54:18 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
4d743ade45 CrashDump: resource hygiene 2018-05-10 11:29:16 +01:00
Dylan K. Taylor
3de5e132a2 CrashDump: fixed broken argv reporting 2018-02-22 22:05:35 +00:00
Dylan K. Taylor
6a996611f8 Move functions from PocketMine.php to Utils
This cleans a lot of mess out of the bootstrap file, and also has the added bonus that threads which do not inherit functions can now get access to them by autoloading Utils.
2018-02-19 11:56:22 +00:00
Dylan K. Taylor
68b30108be CrashDump: fix mis-reporting Composer dependency exceptions as plugin crashes
this is still not foolproof but whatever.
2018-02-03 19:27:59 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00
Dylan K. Taylor
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
966e4bf8a1 Added name field to crashdump data 2017-05-02 19:37:35 +01:00
Dylan K. Taylor
6d90f91be0 Fixed crashes while crashing related to plugins 2017-04-30 16:22:50 +01:00
Dylan K. Taylor
4245274aec Merge branch 'master' into api3/network 2017-03-25 21:26:46 +00:00
Dylan K. Taylor
4c61ad9f2d Stop skipping stack frames (#425) 2017-03-19 10:24:33 +00:00
Dylan K. Taylor
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
Dylan K. Taylor
09a6776674 Fixed a bug in CrashDump
@xxFlare really?
2017-01-25 17:36:40 +00:00
xFlare
8bf8e2e22f Moved crashdumps to their own folder (#275) 2017-01-20 10:52:35 +00:00
Dylan K. Taylor
d6629d6843 More ?? (#131)
* More ??

* fix undefined variable
2016-11-30 10:07:37 +00:00
Shoghi Cervantes
cde2d39029
New statistics system 2015-05-21 11:41:11 +02:00
Shoghi Cervantes
0da628deca
Fixed some crashes related to crashing 2015-01-02 19:19:34 +01:00
Shoghi Cervantes
04bdb13103
Improved move offset check 2015-01-02 19:14:18 +01:00