Skip to content

Instantly share code, notes, and snippets.

./buildconf --force
./configure --enable-debug --enable-mbstring --with-gd --with-gmp --with-openssl --with-pdo-mysql --with-config-file-path=/etc --enable-phalcon --with-curl --with-mcrypt
namespace Phalcon\Mvc;
/**
* Phalcon\Mvc\Dispatcher
*
* Dispatching is the process of taking the request object, extracting the module name,
* controller name, action name, and optional parameters contained in it, and then
* instantiating a controller and calling an action of that controller.
*
*<code>
; Function Attrs: nounwind ssp uwtable
define i32 @x(%struct._zval_struct* %z) #0 {
%1 = alloca %struct._zval_struct*, align 8
store %struct._zval_struct* %z, %struct._zval_struct** %1, align 8
%2 = load %struct._zval_struct** %1, align 8
%3 = getelementptr inbounds %struct._zval_struct* %2, i32 0, i32 2
%4 = load i8* %3, align 1
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
<?php
set_exception_handler(function($e) use ($di) {
file_put_contents(APP_PATH . '/app/logs/error-log' . uniqid("", true) . '.txt' ,
$e->getMessage() . PHP_EOL .
print_r($e->getTrace(), true) . PHP_EOL .
print_r($_POST, true) . PHP_EOL .
print_r($_GET, true) . PHP_EOL .
print_r($_SERVER, true)
<?php
use Phalcon\Events\Event,
Phalcon\Mvc\User\Plugin,
Phalcon\Mvc\Dispatcher,
Phalcon\Acl;
/**
* Security
*
<memory-grow>
if some-condition {
<here-we-need-the-memory-grow>
}
<restore-stack>
<?php
class MyDialect extends \Phalcon\Db\Dialect\Mysql
{
/**
* Gets the column name in MySQL
*
* @param Phalcon\Db\ColumnInterface $column
* @return string
*/
#!/bin/bash
# Check best compilation flags for GCC
export CC="gcc"
export CFLAGS="-march=native -mtune=native -O2 -fno-delete-null-pointer-checks -finline-functions -fomit-frame-pointer -fno-builtin-memcmp"
echo "int main() {}" > t.c
gcc $CFLAGS t.c -o t 2> t.t
if [ $? != 0 ]; then
chmod +x gcccpuopt
BFLAGS=`./gcccpuopt`
@phalcon
phalcon / volt2.php
Last active December 20, 2015 19:09
<?php
$volt = new Phalcon\Mvc\View\Engine\Volt\Compiler();
file_put_contents('x.php', $volt->compileString('{%- macro error_messages(message, field, type) %}
<div>
<span class="error-type">{{ type }}</span>
<span class="error-field">{{ field }}</span>
<span class="error-message">{{ message }}</span>
</div>
PHP_ARG_ENABLE(test, whether to enable test, [ --enable-test Enable test framework])
if test "$PHP_TEST" = "yes"; then
AC_DEFINE(HAVE_TEST, 1, [Whether you have Test])
test_sources="test.c kernel/main.c kernel/memory.c kernel/exception.c kernel/hash.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/alternative/fcall.c kernel/operators.c arithmetic.c flow.c nativearray.c assign.c fibonnaci.c"
PHP_NEW_EXTENSION(test, $test_sources, $ext_shared)
fi