Skip to content

Instantly share code, notes, and snippets.

View NotLazy's full-sized avatar
🧑‍💻
Contributing to Mechvibes

Luna Alfien NotLazy

🧑‍💻
Contributing to Mechvibes
View GitHub Profile
@NotLazy
NotLazy / php8.1_jsonwrapper.php
Last active August 30, 2022 14:35
PHP 8.1 Workaround for json_decode deprecating null
<?php
// If you're anything like me, you upgraded from PHP 7.x to PHP 8.x and discovered that everywhere you were using
// JSON in your code, there were some new deprecation warnings getting in your way.
//
// So, since I use auto_prepend_file in my php.ini, this was a super easy solution.
// My recommendation is to do the same thing. Create an auto_prepend file, and put this snippet in it.
// the new function
define("decode", "json_decode");
define("encode", "json_encode");