Since updating my server earlier in the year, and thus moving to PHP 8, I would’ve been able to update to Symfony 6. I didn’t get around to it until today, though. I’ve been fixing deprecations in my code mostly as they appear (in profiler, console, logs, or automated tests) so I didn’t have a lot to do this time. I changed ^5.4 to ^6.4 in my composer.json and then had to adjust a few minor things in config. Some of those took longer than they should’ve though.
symfony posts
Upgraded Symfony 4.4 to 5.4
I’ve upgraded my website to Symfony 5.4 from 4.4. I’ve continued on without Symfony Flex, as I had when updating from 3.4 to 4.4. The procedure was fairly similar to that, fixing any Symfony 4 deprecations and then updating the composer version constraints, fixing anything broken after that. I also switched from requiring the symfony/symfony repo to requiring individual components. It went fairly smoothly, aside from needing to fix a few things after the composer update.
Ansible, Vagrant, and Symfony `var` permissions
I have moved to using VirtualBox VM’s for my local web development. I use Vagrant and Ansible to set them up. For my site, I use synced folders to share the site files from the local machine to the dev VM. This limits what permissions can be set on the files though, and doesn’t work well for Symfony’s var folder stuff, eg cache and logs. The normal Symfony permissions for those folders use ACL’s, but those cannot be set on Vagrant synced files. My solution was to create a /var/www/var folder to store such folders for any sites on the VM, and symlink them into place in the shared folder location. I did this with Ansible so that it would be reproducible. Since I ran into some issues getting it working, I thought I’d blog about it.
Up way later than I wanted to be, fighting with Symfony’s framework bundle trapping PHP errors from getting to my Apache logs, and Apache’s ErrorLogFormat not being able to display REQUEST_URI. Gonna have to come back to these later.
This morning, shortly after waking up, I got a text that a site was down and others were having problems all weekend.
Continue reading post "#2384"Upgrade Symfony 3 to 4 without Flex
I’ve upgraded my site from Symfony version 3 to 4, without using Symfony Flex. I didn’t upgrade so much for new features, but mainly to be up to date, especially with Symfony 5 not far off.
Continue reading post "Upgrade Symfony 3 to 4 without Flex"Symfony console: Freeing up default short options
I like Symfony’s console component, and use it for much of my command line scripting these days. One thing I dislike is that it takes use of some short option characters for itself. The built in handling of verbosity with -v is nice and is fairly common in the CLI world, but some, like -h and -n, are more varied in use and would be desirable to have for various purposes in my own commands. I decided to remove these defaults in my own console app recently, and will describe how to do so.
Server upgrade: Ubuntu 18.04
I’ve finally updated my server to Ubuntu 18.04 using do-release-upgrade.
Nice: in Symfony 4.1 we will finally be able to specify that an imported route shouldn’t have a trailing slash.
Continue reading post "#1902"Symfony router: check for match on different host
I found myself wanting to check if a given URL path exists on another host of a multi-host Symfony application from within a controller action. The router service, which is the instance of Symfony’s routing component used to route requests to actions, has a match() method, but it only accepts the path part of the URL. It also has a matchRequest() method, but that seems to ignore the HTTP_HOST and SERVER_NAME of the passed Request object.