Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
ircmaxell / expect.php
Created July 15, 2015 19:54
Expectations
<?php
class Foo {
public $name;
public $age;
public function __construct($name, $age) {
}
}
@ircmaxell
ircmaxell / code.php
Created July 11, 2015 00:06
Tuli output
<?php
$a = 1.0;
$b = 2;
$c = foo($a, $b);
$d = foo($b, $c);
function foo(int $a, int $b): int {

This gist determines keys for the "RADICORE ENCRYPTION CLASS": http://pastebin.com/2j2G83AH.

It relies on knowing the settings, but not the key.

See the demo.php file for a test situation using weak random keys.

It takes approximately 10 seconds to work out a 50 character random key.

One interesting thing is that there are colliding keys for a given plaintext.

<?php
function fibo(int $n): int {
return match($n) {
case 1: 1;
case 0: 1;
case _<0: throw new Exception("Less than 0 is not allowed, " . _ . " provided");
case _: fibo(_ - 1) + fibo(_ - 2);
};
}
@ircmaxell
ircmaxell / test.c
Created February 20, 2015 15:22
Check
if (file_ast->children > 0 && !(
file_ast->child[0] == ast // First statement in the file
|| ( // after a non-block namespace declaration
file_ast->child[0]->kind == ZEND_AST_NAMESPACE
&& file_ast->child[0]->child[1] == NULL // non-block mode namespace declaration
&& file_ast->child[1] == ast
))) {
zend_error_noreturn(E_COMPILE_ERROR, "Encoding declaration pragma must be "
"the very first statement in the script");
}
<?php
trait VerifyPrecondition {
protected $parent;
protected function verifyPrecondition($method, array $args) {
$objs = [new ReflectionMethod($this->parent, $method)];
foreach ((new ReflectionObject($this->parent))->getInterfaces() as $iface) {
if ($iface->hasMethod($method)) {
$objs[] = $iface;
}
@ircmaxell
ircmaxell / votes.json
Last active August 29, 2015 14:15
Votes
{
"stas": [
"PHP: rfc:group_use_declarations - Should Grouped Use Declarations be added to PHP 7: 3",
"PHP: rfc:skipparams - Should PHP 7 support parameter skipping as described in this RFC?: 1",
"PHP: rfc:scalar_type_hints - Accept the Scalar Type Hints RFC and merge patch into master?: 2",
"PHP: rfc:scalar_type_hints - Type aliases: 1",
"PHP: rfc:scalar_type_hints - Reserve type names if RFC does not pass?: 2",
"PHP: rfc:combined-comparison-operator - Accept the Combined Comparison (Spaceship) Operator RFC and merge patch into master?: 1",
"PHP: rfc:error_handler_callback_parameters_passed_by_reference - Allow error_handler callback parameters to be passed by reference: 3",
"PHP: rfc:php7timeline - php7timeline: 1",
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 4f12834..8094dda 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -1189,12 +1189,10 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest,
if (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
- if (Z_COPYABLE_P(arg) && Z_REFCOUNT_P(arg) > 1) {
- Z_DELREF_P(arg);
<?php
$url = 'https://qa-orderapi.intelispend.com/Processes/IntelispendAPI/IntelispendOrderAPI/SubmitFileService.serviceagent?wsdl';
$opts = array(
'http' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
$context = stream_context_create($opts);
$client = new \SoapClient($url,
@ircmaxell
ircmaxell / test.php
Last active August 29, 2015 14:14
A simple functional experimental language in PHP
<?php
$code = "
= print (-> #text (
echo (chr text)
print
))