Maintainer of @ReactPHP. Creator of @x_framework. Head of clue·engineering.
Professional software engineer using open source to empower web-based projects. 🚀
Mar 15, 2022 • 4 tweets • 2 min read
TIL: Using `error_get_last()` in library code is almost always wrong 💥 #php#gotcha
See why this may or may not return a `Warning: Trying to access array offset on value of type null`?
We only call `error_get_last()` if we're sure an error occurred. However, while the error suppression operator `@` correctly hides errors, it still calls global error handlers set via `set_error_handler()` outside our control. In result, `error_get_last()` would return null! 💥