Skip to content

Instantly share code, notes, and snippets.

@thekid
thekid / CoalesceNode.class.php
Created August 9, 2011 17:17
XP Language: Null-Safe Object Operator Patch
<?php
/* This class is part of the XP framework
*
* $Id$
*/
uses('xp.compiler.ast.Node');
/**
* Coalesce operator
@thekid
thekid / issue56.diff
Created September 25, 2011 16:08
XP Framework: Patch for issue #56
diff --git a/core/src/main/php/lang/XPClass.class.php b/core/src/main/php/lang/XPClass.class.php
index c4e5ee9..33b29ed 100644
--- a/core/src/main/php/lang/XPClass.class.php
+++ b/core/src/main/php/lang/XPClass.class.php
@@ -583,19 +583,125 @@
* @throws lang.ClassFormatException
*/
public static function parseAnnotations($input, $context) {
- ob_start();
- $annotations= eval('return array('.($eval= preg_replace(
@thekid
thekid / issue95.diff
Created December 31, 2011 16:11
XP Framework: Patch for Issue #95
diff --git a/core/src/main/php/util/PropertyManager.class.php b/core/src/main/php/util/PropertyManager.class.php
index 444f335..75cd0db 100644
--- a/core/src/main/php/util/PropertyManager.class.php
+++ b/core/src/main/php/util/PropertyManager.class.php
@@ -127,19 +127,25 @@
*
* @param string name
* @return util.PropertyAccess
+ * @throws lang.ElementNotFoundException
*/
@thekid
thekid / LocalSocket.class.php
Created January 3, 2012 14:17
XP Framework: MySQL local socket connectivity
<?php
/* This class is part of the XP framework
*
* $Id$
*/
uses('io.File');
/**
* Local socket: If "localhost" is supplied as host name to a MySqlx
@thekid
thekid / rfc0186.diff
Created January 21, 2012 09:24
XP Framework: Patch to implement RFC #0186
diff --git a/core/ChangeLog-5.9 b/core/ChangeLog-5.9
index cda21fd..2308d9e 100644
--- a/core/ChangeLog-5.9
+++ b/core/ChangeLog-5.9
@@ -8,12 +8,16 @@ Git commit: ?????
Heads up!
~~~~~~~~~
+- The SAPI feature is now deprecated and will be removed in next major series!
+ (friebe)
@thekid
thekid / disclaimer.txt
Created February 5, 2012 18:08
PHP 5.4.0RC7/RC8-DEV Bugfixes
These bugs have now been fixed! The RC provided inside PHP Bug #60879 contains
fixes for both. This is kept for historic reasons.
(http://windows.php.net/downloads/snaps/ostc/build/php-5.4.0-RC8-1/php-5.4.0RC8-nts-Win32-VC9-x86.zip)
@thekid
thekid / issue-123.diff
Created February 10, 2012 11:41
XP Framework: Patch for Issue #123
diff --git a/core/src/main/php/text/csv/CsvWriter.class.php b/core/src/main/php/text/csv/CsvWriter.class.php
index 811b02d..70c396e 100644
--- a/core/src/main/php/text/csv/CsvWriter.class.php
+++ b/core/src/main/php/text/csv/CsvWriter.class.php
@@ -60,15 +60,16 @@
*/
protected function writeValues($values, $raw= FALSE) {
$line= '';
- foreach ($values as $v => $value) {
- if (!$raw && isset($this->processors[$v])) {
@thekid
thekid / FixtureTest.class.php
Created February 29, 2012 09:10
Recipe: Refactor public to private
<?php
uses('unittest.TestCase');
abstract class FixtureTest extends TestCase {
protected $fixture= NULL;
protected abstract function newFixtureInstance();
public function setUp() {
$this->fixture= $this->newFixtureInstance();
@thekid
thekid / Bug54511.class.php
Created March 1, 2012 21:46
PHP Bug 54511 reproduce
<?php
uses('peer.SSLSocket');
class Bug54511 extends Object {
public static function main(array $args) {
$s= new SSLSocket('smtpb.scig.gov.hk', 465);
$s->connect();
Console::writeLine('OK: ', $s);
}
@thekid
thekid / gist:2030441
Created March 13, 2012 18:19
NodeJS vs. PHP performance tests
public class Performance {
protected static int inc(int? $arg) {
return $arg + 1;
}
public static void main(string[] $args) {
$a= 0;
for ($i= 0; $i < 10000000; $i++) {
$a+= self::inc($a);