Symfony security

Updated: 09 February 2026

See https://symfonycasts.com/screencast/symfony-security/firewalls-authenticator
See https://symfony.com/doc/current/security/access_control.html

Notes

At the start of each request, before a Controller is called:

  1. Security system executes a set of authenticators
  2. Each authenticator looks at the request and checks for authentication information it understands e.g. submitted email and password, API key in a header, OAuth.
  3. If the authenticator finds compatible credentials it uses them to query for a user and check the password.

At the start of each request, Symfony iterates over the set of firewalls. The active firewall becomes the first one with a pattern key matching the current URL. If a firewall has no pattern key it will match all requests. Firewall names have no meaning.

For each incoming request, Symfony checks each access_control entry to find one that matches the current request. As soon as it finds a matching access_control entry, it stops – only the first matching access_control is used to enforce access.

PHP yield

Updated: 12 January 2025

  • Any function containing yield is a generator function.
  • When a generator function is called, it returns an iterable object.
  • Effectively, yield pauses execution of the enclosing generator function until next required.
<?php

declare(strict_types=1);

function gen_values(): iterable {
    yield '1st';
    yield '2nd';
    yield from ['3rd', '4th'];
    yield '5th';
}

foreach (gen_values() as $val) {
    echo $val . PHP_EOL;
}

/*
1st
2nd
3rd
4th
5th

PHP disable_functions

Updated: 26 November 2024

See https://www.php.net/manual/en/ini.core.php#ini.disable-functions


PHP INI file setting

disable_functions='get_magic_quotes_gpc'

PHP check script

error_reporting(E_ALL);
get_magic_quotes_gpc();
var_dump(function_exists('get_magic_quotes_gpc'));

Output with PHP 7.4. Note the deprecation warning is still displayed

Deprecated: Function get_magic_quotes_gpc() is deprecated in ...
Warning: get_magic_quotes_gpc() has been disabled for security reasons in ...
bool(false)

CodeIgniter

Updated: 22 January 2025

The framework

CodeIgniter 3, the legacy version of the framework.
https://github.com/bcit-ci/CodeIgniter

https://codeigniter.com/userguide3/

CodeIgniter 4, the latest version of the framework.
https://github.com/codeigniter4/CodeIgniter4

Upgrading notes

To find your current Codeigniter version, look for this constant

define('CI_VERSION', '3.1.7');

The highest version of 3 is 3.1.13
The highest version of 2 is 2.2.6

This is a fork of CodeIgniter 3, with the goal of keeping it up to date with PHP 8.4 and beyond https://github.com/pocketarc/codeigniter

Laravel Homestead

Updated: 06 May 2024

IP address of host from inside of Homestead: 10.0.2.2


Connect via ssh, from the Homestead directory

vagrant ssh

Run composer with php version 7.2

php7.2 /usr/local/bin/composer update

Reset to original state

vagrant destroy --force && vagrant up

Reload

vagrant reload --provision

Check which PHP versions have xdebug enabled

phpquery -v 5.6 -s fpm -m xdebug
phpquery -v 7.0 -s fpm -m xdebug
phpquery -v 7.1 -s fpm -m xdebug
phpquery -v 7.2 -s fpm -m xdebug
phpquery -v 7.3 -s fpm -m xdebug
phpquery -v 7.4 -s fpm -m xdebug
phpquery -v 8.0 -s fpm -m xdebug
phpquery -v 8.1 -s fpm -m xdebug
phpquery -v 8.2 -s fpm -m xdebug
phpquery -v 8.3 -s fpm -m xdebug

Enable the Xdebug module for the fpm SAPI of PHP version 5.6

phpenmod -v 5.6 -s fpm -m xdebug

PHP PECL & PEAR

Updated: 26 November 2024

PECL
https://pecl.php.net

The PHP Extension Community Library

PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.

PEAR
https://pear.php.net

PHP Extension & Application Repository

PEAR is a framework and distribution system for reusable PHP components.

PHP code examples

Updated: 12 March 2024

Read contents of text file into a variable

$file_pointer = fopen('raw_bb_sample.txt', 'r') or die('Unable to open file!');
$sample = fread($file_pointer, filesize('raw_bb_sample.txt'));
fclose($file_pointer);
var_dump($sample);