Skip to content

Instantly share code, notes, and snippets.

@freen
freen / gist:5006382
Created February 21, 2013 17:16
Symfony2 Exception - Attempting to implement a custom Authentication Provider. For some reason SF2 is loading the DaoAuthenticationProvider.
( ! ) Fatal error: Cannot access parent:: when current class scope has no parent in /[...]/WordRot/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php on line 43
Call Stack
# Time Memory Function Location
1 0.0001 228264 {main}( ) ../app_dev.php:0
2 0.0072 1213440 Symfony\Component\HttpKernel\Kernel->handle( ) ../app_dev.php:25
3 0.0187 1698352 Symfony\Bundle\FrameworkBundle\HttpKernel->handle( ) ../bootstrap.php.cache:617
4 0.0187 1700104 Symfony\Component\HttpKernel\HttpKernel->handle( ) ../bootstrap.php.cache:1566
5 0.0187 1700168 Symfony\Component\HttpKernel\HttpKernel->handleRaw( ) ../bootstrap.php.cache:1390
6 0.0187 1701016 Symfony\Component\HttpKernel\Debug\ContainerAwareTraceableEventDispatcher->dispatch( ) ../bootstrap.php.cache:1410
7 0.0189 1713000 Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch( ) ../ContainerAwareTraceableEventDispatcher.php:78
@freen
freen / zf2_sql_offset_limit_order.php
Last active December 15, 2015 14:08
ZF2 Zend\Db\Sql should know (for the MySQL platform) that OFFSET has to follow LIMIT.
<?php
// ...
// This works:
$select->from($table)
->group('id')
->limit($limit)
->offset($offset);
@freen
freen / slim_still_generates_pretty_exception.php
Last active December 16, 2015 15:09
No matter what, I get a pretty Slim Application Error, with a 500 header
<?php
// ...
$loggerSettings = array(
'path' => APPLICATION_PATH . '/api/logs'
);
$app = new Slim(array(
'mode' => APPLICATION_ENV,
'debug' => false,
@freen
freen / zf-form-broken-composer-install.txt
Created May 22, 2013 22:05
Installing zendframework/zend-form via Composer is broken.
My composer.json:
{
"require": {
"slim/slim": "dev-master",
"slim/extras": "dev-develop",
"symfony/class-loader": "2.3.*@dev",
"zendframework/zend-db": "2.1.*@dev",
"zendframework/zend-form": "2.3.*@dev",
"mynetx/codebird-php": "dev-master",
@freen
freen / slimRouteClosureTreatedAsMiddleware.php
Created June 18, 2013 18:45
Slim Route closure is treated as Route Middleware when I include Route Middleware after my Route Closure.
<?php
$app->get('/collection/:id/', function($id) use ($app) {
// This is true:
if('Slim\Route' === get_class($id)) {
die('Oh no it thinks my route closure is route middleware :(');
}
@freen
freen / gist:a7e3bb9099eece25d554
Last active August 29, 2015 14:09
homebrew_php54-http_install_failure_make_log.txt
2014-11-14 18:55:22 -0500
make
/bin/sh /private/tmp/php54-http-iQkoUm/pecl_http-2.1.2/libtool --mode=compile clang -I. -I/private/tmp/php54-http-iQkoUm/pecl_http-2.1.2 -DPHP_ATOM_INC -I/private/tmp/php54-http-iQkoUm/pecl_http-2.1.2/include -I/private/tmp/php54-http-iQkoUm/pecl_http-2.1.2/main -I/private/tmp/php54-http-iQkoUm/pecl_http-2.1.2 -I/usr/local/Cellar/php54/5.4.33/include/php -I/usr/local/Cellar/php54/5.4.33/include/php/main -I/usr/local/Cellar/php54/5.4.33/include/php/TSRM -I/usr/local/Cellar/php54/5.4.33/include/php/Zend -I/usr/local/Cellar/php54/5.4.33/include/php/ext -I/usr/local/Cellar/php54/5.4.33/include/php/ext/date/lib -I/usr/local/include -I/usr/local/Cellar/php54/5.4.33/include/php/ext/hash -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php54-http-iQkoUm/pecl_http-2.1.2/php_http_buffer.c -o php_http_buffer.lo
/bin/sh /private/tmp/php54-http-iQkoUm/pecl_http-2.1.2/libtool --mode=compile clang -I. -I/private/tmp/php54-http-iQkoUm/pecl_http-2.1.2 -DPHP_ATOM_INC -I/private/tmp/php54-http-iQko
@freen
freen / gist:c88d2da05c10cec6b33e
Created November 15, 2014 00:09
homebrew_php54-http_install_failure_verbose_make_log.txt
==> Installing php54-http from homebrew/homebrew-php
==> Downloading http://pecl.php.net/get/pecl_http-2.1.2.tgz
Already downloaded: /Library/Caches/Homebrew/php54-http-2.1.2.tgz
==> Verifying php54-http-2.1.2.tgz checksum
tar xf /Library/Caches/Homebrew/php54-http-2.1.2.tgz
==> PHP_AUTOCONF="/usr/local/opt/autoconf/bin/autoconf" PHP_AUTOHEADER="/usr/local/opt/autoconf/bin/autoheader" /usr/local/Cellar/php54/5.4.33/bin/phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
@freen
freen / useradd-default-shell-ineffectual.sh
Created January 29, 2016 12:43
Even though SHELL=/bin/bash in /etc/default/useradd, useradd fails to set the default shell as bash for new users.
vagrant@local:~$ cat /etc/default/useradd | grep SHELL
# The SHELL variable specifies the default login shell on your
SHELL=/bin/bash
vagrant@local:~$ sudo useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
@freen
freen / etc-default-useradd
Created January 29, 2016 12:53
/etc/default/useradd with SHELL defined
vagrant@local:~$ cat /etc/default/useradd
# Default values for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/bash
#
@freen
freen / puma-fails-to-start-bc-of-syntax-error.txt
Created February 15, 2016 14:21
Syntax error means puma can't start
! Unable to load application: SyntaxError: /vagrant/app/models/order.rb:22: syntax error, unexpected end-of-input, expecting keyword_end
/usr/local/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:492:in `load': /vagrant/app/models/order.rb:22: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from /usr/local/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:492:in `block in load_file'
from /usr/local/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:682:in `new_constants_in'
from /usr/local/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:491:in `load_file'
from /usr/local/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:388:in `block in require_or_load'
from /usr/local/rbenv/versi