Skip to content

Instantly share code, notes, and snippets.

View padraic's full-sized avatar
💭
Contact me by email. I am temporarily inactive on Github.

Pádraic Brady padraic

💭
Contact me by email. I am temporarily inactive on Github.
View GitHub Profile
@padraic
padraic / survey.php
Last active August 29, 2015 13:56
Enumerating Composer packages for PHPCS analysis and data collection
<?php
define('PACKAGE_LIST', 'list.txt');
define('CODING_STANDARD', 'PSR2');
define('SEVERITY', 1);
define('ENCODING', 'utf-8');
define('REPORT', 'source');
define('EXTENSIONS', 'php');
$excluded = [
'*/test/*',
@padraic
padraic / RemoteFilesystem.php
Last active August 29, 2015 13:56
Composer RemoteFilesystem.php version showing missed peer_certificate (see tls-defaults branch on my fork)
<?php
// when replaced for commit: https://github.com/padraic/composer/commit/2972ec3d8621acd9c415b7b1425586b90e7cea40
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
@padraic
padraic / fail.php
Created February 27, 2014 19:29
Failure to capture certs on TLS verification failures.
<?php
$url = 'https://www.packagist.org';
$host = 'xxx.packagist.org';
$ciphers = implode(':', array(
'ECDHE-RSA-AES128-GCM-SHA256',
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-RSA-AES256-GCM-SHA384',
'ECDHE-ECDSA-AES256-GCM-SHA384',
Mutateme_MutableFile
[x] Should maintain file path info once passed in constructor
[x] Should not have mutations before generation
[x] Should not have detected mutables before generation
[x] Should not generate mutables for empty class
[x] Should not generate mutations for empty class
[x] Should not generate mutables if only empty methods in class
[x] Should not generate mutations if only empty methods in class
[x] Should generate mutables even if method body is not viable
[x] Should not generate mutations if method body is not viable
<html>
<body>
<div style="position: absolute; top: 10px; left: 10px; background-color: red; z-index: 1; width: 100px; height: 100px; margin: 0;"><div>
<div style="position: absolute; top: 10px; left: 10px; background-color: green; z-index: 2; width: 100px; height: 100px; margin: 0;"><div>
</body>
</html>
http://framework.zend.com/favicon.ico
GET /favicon.ico HTTP/1.1
Host: framework.zend.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
<?php
require_once 'Zend/Filter/StripTags.php';
$source = <<<string
<img src=http://www.example.com/image.png></img>
string;
$filter = new Zend_Filter_StripTags;
<?php
ini_set('display_errors', 1);
require_once 'Zend/Markup.php';
$source = <<<string
[ adfdsfda [url]http://example.com[url]
string;
$bbcode = Zend_Markup::factory('Bbcode');
echo $bbcode->render($source);
<?php
ini_set('display_errors', 1);
require_once 'Zend/Markup.php';
$source = <<<string
[list]
[*] Subject 1
[list]
[*] First
[*] Second
Fatal error: Call to a member function getName() on a non-object in /home/padraic/projects/zf/trunk/library/Zend/Markup/Parser/Bbcode.php on line 446
Call Stack:
0.0004 619656 1. {main}() /var/www/test.php:0
0.0095 1474976 2. Zend_Markup_Renderer_RendererAbstract->render() /var/www/test.php:17
0.0095 1474976 3. Zend_Markup_Parser_Bbcode->parse() /home/padraic/projects/zf/trunk/library/Zend/Markup/Renderer/RendererAbstract.php:186
0.0096 1479416 4. Zend_Markup_Parser_Bbcode->_parse() /home/padraic/projects/zf/trunk/library/Zend/Markup/Parser/Bbcode.php:184
0.0101 1497968 5. Zend_Markup_Parser_Bbcode->_parseTagStart() /home/padraic/projects/zf/trunk/library/Zend/Markup/Parser/Bbcode.php:198
0.0101 1497968 6. Zend_Markup_Parser_Bbcode->_parseTag() /home/padraic/projects/zf/trunk/library/Zend/Markup/Parser/Bbcode.php:238
0.0101 1498416 7. Zend_Markup_Parser_Bbcode->_endTag() /home/padraic/projects/zf/trunk/library/Zend/Markup/Parser/Bbcode.php:266