Skip to content

Instantly share code, notes, and snippets.

@sasezaki
sasezaki / 1_php54array_diff.php
Created March 6, 2012 16:00
Array to string conversion - array_diff_assoc in ZF2
<?php
error_reporting(E_ALL);
array_diff(array('key' => array()), array('key' => array()));
array_diff_assoc(array('key' => array()), array('key' => array()));
@sasezaki
sasezaki / zfincompaticheck.md
Created March 3, 2012 00:43
ZF2 Backward Incompatible Changes check - 3/3 2012

http://docs.php.net/manual/en/migration54.incompatible.php

checking laltest head (beta3 - db3e13d92d866e3f484b1be1c87bfe94145ac79c)

$ find library -iname \*.php -print0 | xargs -0 grep -iwE '(break|continue) +\$|get_magic_quotes_gpc|get_magic_quotes_runtime|set_magic_quotes_runtime|array_combine|(abstract|and|array()|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|old_function|or|private|protected|public|static|switch|throw|try|use|var|while|xor) +(trait|callable|insteadof)|define_syslog_variables|import_request_variables|session_is_registered|session_register|session_unregister|mysqli_bind_param|mysqli_bind_result|mysqli_client_encoding|mysqli_fetch|mysqli_param_count|mysqli_get_metadata|mysqli_send_long_data|mysqli::client_encoding|m
  どかーん!
  (⌒⌒⌒)
   ||
/ ̄ ̄ ̄ ̄ ̄\   もうおこったぞう
| ・ U   |
| |ι     |つ
U||  ̄ ̄ ||
   ̄     ̄
@sasezaki
sasezaki / 01_sample.php
Created January 16, 2012 15:54
ZF2 Http Client Socket read method
<?php
$client = new Zend\Http\Client;
$client->setHeaders(array('Last-Modified' => 'fake'));
var_dump($client->getRequest()->headers());
var_dump($client->getRequest()->headers()->toArray());
/**
object(Zend\Http\Headers)#2 (3) {
["pluginClassLoader":protected]=>
NULL
@sasezaki
sasezaki / autoload_classmap.tpl
Created January 12, 2012 15:10
Idea - to get zf2 autoload_classmap.php by theseer's Autoload(phpab)
<?php
return array(
___CLASSLIST___
);
@sasezaki
sasezaki / zfhimekuri0101.md
Created December 31, 2011 04:14
Zend Framework その7年 (前編)

Zend Framework その7年

あけましておめでとうございます。 Zend Framework 日めくり Calendar 2012の1日目としてお送りします。 この日めくりカレンダー、前月に流行ったAdventカレンダーの、アイデアフォーク(パクリ)となっております。 記事書いていただける方を募集中です。ぜひatndへのリンク先からご登録ください。

@sasezaki
sasezaki / phpunit34.sh
Created December 9, 2011 12:50
Use old PHPUnit (3.4 & 3.5) by installed via pyrus
#!/bin/sh
PYRUS=/path/to/pyrus.phar
php $PYRUS . set bin_dir ./bin
pear download components.ez.no/Base
pear download components.ez.no/ConsoleTools
php $PYRUS . channel-discover pear.phpunit.de
php $PYRUS . channel-discover components.ez.no
php $PYRUS . channel-discover pear.symfony-project.com
php $PYRUS . install Base-1.8.tgz
php $PYRUS . install ConsoleTools-1.6.1.tgz
@sasezaki
sasezaki / spladvent2011.md
Created November 23, 2011 09:53
ぼくの考えた最強のSPL advent calendar

1日目

SPL is your friend (SPLは君の友達)

2日目

SPLで例外なく例外を

3日目

Big Data & SPL

4日目

@sasezaki
sasezaki / gist:1370039
Created November 16, 2011 13:05
keep-alive with HTTP_Request2
<?php
require_once 'HTTP/Request2.php';
$req2 = new HTTP_Request2;
$req2->setConfig('follow_redirects', true);
$req2->setUrl('http://www.google.com');
$req2->setHeader('connection', 'Keep-Alive');
var_dump($req2->send());
@sasezaki
sasezaki / gist:1358388
Created November 11, 2011 16:10
ZF2-99
diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php
index ce448d9..d511ed9 100755
--- a/library/Zend/Http/Client/Adapter/Socket.php
+++ b/library/Zend/Http/Client/Adapter/Socket.php
@@ -331,16 +331,16 @@ class Socket implements HttpAdapter, Stream
$this->method == \Zend\Http\Request::METHOD_HEAD) {
// Close the connection if requested to do so by the server
- if (isset($headers['connection']) && $headers['connection'] == 'close') {
+ if (isset($headers['Connection']) && $headers['Connection'] == 'close') {