Skip to content

Instantly share code, notes, and snippets.

View nikic's full-sized avatar

Nikita Popov nikic

View GitHub Profile
@nikic
nikic / php.pecl.log
Created December 22, 2011 15:32
PECL discussion on SPL exceptions
(3:22:33 PM) johannes: hey ho helly\G
(3:22:33 PM) helly\G: Moin moin
(3:24:21 PM) chregu_ [~chregu@77-58-253-248.dclient.hispeed.ch] entered the room.
(3:25:56 PM) jpauli1: helly\G: helly ! :) morning ^^
(3:26:26 PM) helly\G: Jo
(3:28:41 PM) jpauli1: helly\G: sorry that the guy (forgot his name) who wants to review ext/SPL code seems not here ATM
(3:29:19 PM) nikic: jpauli1: Levi?
(3:29:30 PM) jpauli1: nikic: +1 :)
(3:29:39 PM) helly\G: Spl use or extend?
(3:29:40 PM) jpauli1: nikic: I'm not good at names remembering :p
LinkedList <- Iterator, ArrayAccess, Collection
mixed getFirst()
mixed getLast()
[mixed current()]
mixed getAtIndex(int $index)
void insertFirst(mixed $item)
void insertLast(mixed $item)
void insertBeforeCurrent(mixed $item)
void insertAfterCurrent(mixed $item)
/* {{{ proto string hash_pbkdf2(string algo, string password, string salt, int iterations [, int length = 0, bool raw_output = false])
Generate a PBKDF2 hash of the given password and salt
Returns lowercase hexbits by default */
PHP_FUNCTION(hash_pbkdf2)
{
char *algo, *salt, *pass = NULL;
unsigned char *data, *digest, *temp, *result, *K1, *K2 = NULL;
long loops, result_size, i, j, algo_len, pass_len, iterations, salt_len, length = 0;
int argc = 0;
zend_bool raw_output = 0;
[Old]
Interpol sv: 0.47845602035522
Concat sv: 0.31284117698669
Interpol vs: 0.42951798439026
Concat vs: 0.29083919525146
Interpol vv: 0.43502902984619
Concat vv: 0.28370904922485
Interpol sv+: 1.8611299991608
Concat sv+: 2.1938419342041
Interpol v: 0.31008791923523
@nikic
nikic / TaggedPointer.h
Created January 31, 2012 15:41
Tagged pointer sample implementation
#pragma once
#include <cassert>
// alignedTo defaults to 8 (on 64 bit)
template <typename T, int alignedTo = sizeof(T *)>
class TaggedPointer {
private:
static_assert(
alignedTo != 0 && ((alignedTo & (alignedTo - 1)) == 0),
@nikic
nikic / TaggedPointerOrInt.h
Created January 31, 2012 21:47
Tagged pointer or embedded integer sample implementation
#pragma once
#include <cassert>
// alignedTo defaults to 8 (on 64 bit)
template <typename T, int alignedTo = sizeof(T *)>
class TaggedPointerOrInt {
private:
static_assert(
alignedTo != 0 && ((alignedTo & (alignedTo - 1)) == 0),
<?php
$array = array_fill(0, 2000, '*');
$ref = $array;
function byRef(&$ref) {}
byRef($ref)
(
(?(DEFINE)
(?<label> [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* )
(?<nsSeparator> \s* \\\\ \s* )
(?<ns> (?&label) ((?&nsSeparator) (?&label))* )
)
namespace \s* (?<namespace> (?&ns) ) ;
)mx
diff --git a/Zend/tests/bug60738.phpt b/Zend/tests/bug60738.phpt
new file mode 100644
index 0000000..e0c9793
--- /dev/null
+++ b/Zend/tests/bug60738.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #60738 Allow 'set_error_handler' to handle NULL
+--FILE--
+<?php
((?(DEFINE)
(?<addr_spec> (?&local_part) @ (?&domain) )
(?<local_part> (?&dot_atom) | (?&quoted_string) | (?&obs_local_part) )
(?<domain> (?&dot_atom) | (?&domain_literal) | (?&obs_domain) )
(?<domain_literal> (?&CFWS)? \[ (?: (?&FWS)? (?&dtext) )* (?&FWS)? \] (?&CFWS)? )
(?<dtext> [\x21-\x5a] | [\x5e-\x7e] | (?&obs_dtext) )
(?<quoted_pair> \\ (?: [\x21-\x7e] | [ \t] ) | (?&obs_qp) )
(?<dot_atom> (?&CFWS)? (?&dot_atom_text) (?&CFWS)? )
(?<dot_atom_text> (?&atext) (?: \. (?&atext) )* )
(?<atext> [a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+ )