Symfony 4 get all POST data

“How do get all the submitted form data?” When I was learning Symfony this was something I couldn’t find a noob-level answer to. All the tutorials want to introduce you to the Symfony form module right away. But if you’re like me and want to understand how things fit together before using some overly complicated object to build a simple form then the below information may be useful.

How to get all values from a form submit in Symfony 4.

* @Route("/", name="form_submit",methods={"POST"})
public function my_form_action(Request $request)
$everything = $request->request->all()


Evil Kinevil Jr 2018 Edit

Behold the awesomeness of my 7th grade claymation!

Took me 3-4 months to make this video during free period in 7th grade in 1992.
This video originally had Kenny Loggins Highway to the Danger Zone, but I swapped it out for DFR to avoid any copyright issues.





How I tumbled down a river – The 2014 Quinebaug River Race

I didn’t know what I was getting into…



My brother-in-law said “hey you want to enter a canoe race?”  An excuse to paddle down river in early spring sounded like a great idea. He recruited my father-in-law and I recruited my brother and the four of us entered the All-American Quinebaug River Race. They were #30 in a 14 foot green Old Town canoe, and we were #31 in a battered blue 12 foot Lincoln canoe.

I was unaware that this canoe race had class II rapids.
Continue reading “How I tumbled down a river – The 2014 Quinebaug River Race”

Best practices – a poem

I.T. took away my remote server access today
Now I can only code local-ly
Though I don’t blame them, I’d just like to say
If my code hygiene needs washing
These bugs that I’m squashing
Weren’t found in Q.A.

‘Best practice’ was my first and my middle name
I agiled my scrums, I sprinted my days
Test-driven delivered a build to throw away
But the users don’t understand it
And they simply demanded it
Be fixed right away

Pear's mail_mine not working with Outlook

In a WordPress plugin I am developing, I am using Pear’s mail_mime to generate an HTML email and send it with an attachment. This worked fine for me during testing with my gmail account. However once I started using the plugin to send emails to others, Outlook users were getting a garbled mess. Outlook could not properly understand the generated multipart/mixed message and was showing the raw text. It took a bit of digging to discover the solution, but the root of the issue goes back to an age-old C.S. problem.

Windows uses ‘rn’ to define a line break, while Unix-like systems use ‘n’ to define a line break. Gmail doesn’t care which kind of line break you use, but Outlook requires line breaks to be in the ‘rn’ format.

Mail_mime allows you to pass the default for line breaks as a constructor argument. However, this didn’t work correctly for me. The Mail_mime code uses the End-Of-Line constant (PHP_EOL) and passing the EOL value in was not enough to change the value in all places.

What I had to do to finally get Outlook emails to display correctly was to first define the PHP_EOL constant and then pass it in as well.

// define the PHP_EOL constant
if (!defined('PHP_EOL')) define ('PHP_EOL',"rn");
// pass in the value on create
$mime = new Mail_mime(PHP_EOL);

I had to define the constant AND pass in the value to catch all the places the linebreak characters were used. This seems like a bug in Mail_mime.

I used the comments on this bug report to solve this issue. Unfortunately since this work-around was discovered, the maintainers don’t seem willing to fix this issue.

Apache RewriteRule for Changing Your Permalink Settings

I recently updated my blog’s permalink settings and did away with the year and month in the url structure. I’m experimenting with placing the post name more prominently in the url as it is better for SEO.
Here’s the Apache rewrite rule I used to move my blog posts from /yyyy/mm/post-name to /post-name. The rewrite rule uses a 301 redirect so this should not negatively affect the post’s Google rankings.

# Redirect moved blog posts
RewriteBase /blog/
RewriteRule ^20[0-1][0-9]/[0-9][0-9]/(.*) $1 [R=301,L]

Breaking the RegEx apart:

RewriteBase /blog/
This tells the rewrite engine that we are only going to look at URLs that are under the /blog/ directory

Since we indicated our RewriteBase is “/blog/” on the previous line, “/blog/” will be chopped off of the URLs;
“^” says that our string should now start with the following pattern
I started this blog in 2009, so I only need to target years after 2000. I started my year RegEx with “20” to simplify.
“[0-1]” indicates I’m looking for a number range between zero and one. Since I only need to target between 2009-2013 the next digit could only be a zero or 1.
“[0-9]” indicates that the last digit in the year could be any of these.
“/” the next character should be a forward slash

This RegEx targets the months: any digit zero through nine, followed by any digit zero through nine
“/” the next character should be a forward slash

The rest of the url is our post-name. “(.*)” says take the rest of the url string and remember it as the first variable.

 $1 [R=301,L]
“$1” is the first variable that we got from the (.*) statement above. “R=301” says to 301 redirect this request to whatever url is in the $1 variable. It knows to prepend ‘/blog/’ to the request because we indicated our URLs should start with “/blog/” using the RewriteBase command. “L” indicates that this should be the Last rewrite rule it processes.

Regex can be confusing. Its is often easiest to build up your RegEx bit by bit until you have the completed statement.