Skip to content
cjhaas blog

Basically a place that Chris can post solutions to problems so he can easily find them later

cjhaas blog

Basically a place that Chris can post solutions to problems so he can easily find them later

Category: PHP

PHP

The magic PHP function: test_data()

Posted on June 1, 2023June 1, 2023 By [email protected]

STOP USING IT!!!!! If you don’t know this function, let me show it to you: “But it sanitizes my input” – yes, destructively. I’ll let the trim function pass, although that depends on the data you are sourcing. Always delay escaping until you need to render something. Besides being a…

Read more
PHP

Recursion

Posted on October 6, 2021October 6, 2021 By [email protected]

I’m not going to go into great detail on this, so hopefully the code speaks for itself. But here’s a high level overview. Imagine you have three types, Product, Product Variation, and Product Variation Value. One instance of a Product could be “Pink Floyd Dark Side of the Moon T-Shirt”…

Read more
PHP

PHP Include Path Surprises

Posted on May 21, 2019May 22, 2019 By [email protected]

While diagnosing a potential unconfirmed problem with a certain popular WordPress plugin I did something that every good developer should do every once in a while, which is to humble themselves and read the most basic and obvious documentation for the simplest parts of a language or framework that you…

Read more
PHP

Check your server’s composer files for known PHP vulnerabilities

Posted on August 8, 2017 By [email protected]

The Sensio people have made so cool stuff including the SensioLabs Security Checker. You can use it via composer but you can also download a PHAR file and scan your entire server. wget http://get.sensiolabs.org/security-checker.phar -O ~/security-checker.phar find /var/www -type f -name “composer.lock” -exec php ~/security-checker.phar security:check {} ; Symfony Security…

Read more
PHP

XDebug code coverage in PHP 7 doesn’t reach all code

Posted on March 29, 2017 By [email protected]

I was noticing a lot of white (untouched) code in my XDebug code coverage reports however the method signatures at the top were all green and 100% covered. After some searching I found this thread (don’t bother reading) which led to this thread (scroll fast and occasionally read) which showed…

Read more
PHP

I finally get late static binding in PHP

Posted on March 28, 2017 By [email protected]

Static inheritance in PHP (and really any language) can get tricky sometimes, especially when you’re trying to figure out what self is currently referring to. In PHP, self is always applied to the class that has that declaration, not necessarily the child class. Hmm… that reads weird, let’s make an…

Read more
PHP

PHP: Unexpected behavior when using unset() on class properties

Posted on March 28, 2017 By [email protected]

When you unset a non-dynamic class property you apparently enter a weird limbo state. Take the following simple anonymous class: //Simple anonymous class, nothing to special $c = new class { public $alpha = ‘alpha’; }; Perform a property exists test and show the value: //Do we have the property? echo…

Read more
PHP

strcspn

Posted on March 10, 2017 By [email protected]

Going on 10 years of PHP programming and I’m still finding functions that I never knew about. Today it was strcspn which is one of those functions that essentially maps directly to a C counterpart. int strcspn ( string $subject , string $mask [, int $start [, int $length ]] ) The formal description…

Read more
PHP

PHP RFC: Make Libsodium a Core Extension

Posted on February 15, 2017 By [email protected]

Yes!!!! A unanimous vote to add libsodium as an official PHP extension to the next version of PHP, 7.2.

Read more
nginx

Varnish as a frontend for a remote WordPress install – Part 2

Posted on September 27, 2014 By [email protected]

Part of this setup Nginx, MySql, PHP and WordPress. This part is for configuring Varnish 4.0 on Ubuntu 14.04 On varnish.chris.example.com Install Varnish 4.0 Add Varnish’s GPG key curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | sudo apt-key add – Add the source location echo “deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0” | sudo tee /etc/apt/sources.list.d/varnish-cache.list Update local cache…

Read more
  • 1
  • 2
  • Next

Recent Posts

  • Google open redirect
  • How to use AI to write code
  • Doctrine/Symfony MariaDB DSN connection string
  • Creating a portable copy of pdftotext from source
  • Gravity Forms shortcode getting extra line breaks when used with ACF

Recent Comments

  • jose luis on #2 – VB.Net iTextSharp Tutorial – Add an image to a document
  • Eliezer Castanon on iTextSharp slightly smarter text extraction strategy
  • javad on How to recompress images in a PDF using iTextSharp
  • MANOUS3784 on Flock is awesome
  • Sang on Flock is awesome

Archives

  • June 2026
  • October 2025
  • November 2023
  • September 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • December 2022
  • September 2022
  • April 2022
  • October 2021
  • September 2021
  • April 2021
  • January 2021
  • October 2020
  • August 2020
  • June 2020
  • May 2020
  • December 2019
  • November 2019
  • October 2019
  • July 2019
  • May 2019
  • December 2018
  • October 2018
  • July 2018
  • November 2017
  • October 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • September 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • November 2013
  • May 2013
  • April 2013
  • March 2013
  • January 2013
  • November 2012
  • October 2012
  • July 2012
  • March 2012
  • January 2012
  • October 2011
  • September 2011
  • July 2011
  • February 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • April 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

Categories

  • Accessibility
  • Advanced Custom Fields
  • Authorize.Net
  • BWP Minify
  • Composer
  • Crappy Google Search Results of the Day
  • CSS
  • Doctrine
  • Drupal
  • Drush
  • Elasticsearch
  • Fun links of the day
  • Google Analytics
  • Gravity Forms
  • HHVM
  • HTML
  • iTextSharp
  • JavaScript
  • Linux
  • mysql
  • nginx
  • Optimization
  • PDF
  • PdfPTable
  • PHP
  • Plugins
  • Ramblings
  • Random things I learned
  • Redis
  • Security
  • simplesamlphp
  • SQL Server
  • SSH
  • SSL/TLS/HTTPS
  • Stack Overflow
  • SVG
  • Symfony
  • Synology
  • Uncategorized
  • Unicode
  • Varnish
  • Vendi Best Practice
  • VIP
  • Weird Google Search Results
  • Windows
  • WordPress
  • WP-CLI

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2026 cjhaas blog | WordPress Theme by SuperbThemes