On 18 Jul 2023, at 16:13, Larry Garfield <la...@garfieldtech.com> wrote:
> PHP at the moment leans heavily on the "null is error and build tooling 
> around that" approach


Yep, you should never use NULL in your code, the following is catastrophically 
bad...

 
$search = ($_GET['q'] ?? NULL);

$search = (isset($_GET['q']) ? $_GET['q'] : NULL); // Pre PHP 7
 
$search = filter_input(INPUT_GET, 'q');
 
$search = $request->input('q'); // Laravel
$search = $request->get('q'); // Symfony
$search = $this->request->getQuery('q'); // CakePHP
$search = $request->getGet('q'); // CodeIgniter

$search = json_decode('{"q":null}');


And all fields in the database must be set to NOT NULL, never use things like 
LEFT JOIN, etc... :-(


Craig

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to