Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Allaert patrickallaert

View GitHub Profile
View debug_backtrace-limit.patch
Index: Zend/zend_builtin_functions.c
===================================================================
--- Zend/zend_builtin_functions.c (revision 309942)
+++ Zend/zend_builtin_functions.c (working copy)
@@ -227,6 +227,7 @@
ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_backtrace, 0, 0, 0)
ZEND_ARG_INFO(0, options)
+ ZEND_ARG_INFO(0, limit)
ZEND_END_ARG_INFO()
View debug_print_backtrace-limit.patch
Index: Zend/zend_builtin_functions.c
===================================================================
--- Zend/zend_builtin_functions.c (revision 309942)
+++ Zend/zend_builtin_functions.c (working copy)
@@ -2047,11 +2048,11 @@
}
}
-/* {{{ proto void debug_print_backtrace([int options]) */
+/* {{{ proto void debug_print_backtrace([int options[, int limit]]) */
@patrickallaert
patrickallaert / array-to-string-notice.patch.txt
Created Jun 2, 2011
Notice on array to string conversion
View array-to-string-notice.patch.txt
diff --git a/Zend/zend.c b/Zend/zend.c
index 07bdf98..bcc52f1 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -247,6 +247,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
Z_STRLEN_P(expr_copy) = sprintf(Z_STRVAL_P(expr_copy), "Resource id #%ld", Z_LVAL_P(expr));
break;
case IS_ARRAY:
+ zend_error(E_NOTICE, "Array to string conversion");
Z_STRLEN_P(expr_copy) = sizeof("Array") - 1;
@patrickallaert
patrickallaert / array-to-string-notice-tests.patch.txt
Created Jun 2, 2011
Notice on array to string conversion (tests)
View array-to-string-notice-tests.patch.txt
diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt
index d06daa2..76576de 100644
Binary files a/Zend/tests/cast_to_string.phpt and b/Zend/tests/cast_to_string.phpt differ
diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat_001.phpt
index be12976..1773add 100644
--- a/Zend/tests/concat_001.phpt
+++ b/Zend/tests/concat_001.phpt
@@ -50,26 +50,46 @@ var_dump($d.$d);
echo "Done\n";
?>
@patrickallaert
patrickallaert / array_notice.patch
Created Jun 20, 2011
Notice on array to string conversion (combined)
View array_notice.patch
commit 6ab2b746cc6b2d2f51c096e5ae672c051abd6230
Author: Patrick Allaert <pa@ez.no>
Date: Fri Jun 17 22:18:21 2011 +0200
Changed silent conversion of array to string to produce a notice.
diff --git a/NEWS b/NEWS
index 284dd85..507fc03 100644
--- a/NEWS
+++ b/NEWS
@patrickallaert
patrickallaert / function_definition.php
Created Apr 5, 2012
function_definition.php with alignment
View function_definition.php
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
*/
$FunctionList = array();
$FunctionList['locale_list'] = array( 'name' => 'locale_list',
'operationTypes' => array( 'read' ),
@patrickallaert
patrickallaert / function_definition.php
Created Apr 5, 2012
function_definition.php without alignment
View function_definition.php
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
*/
$FunctionList = array();
$FunctionList['locale_list'] = array(
'name' => 'locale_list',
@patrickallaert
patrickallaert / function_definition.php.diff
Created Apr 5, 2012
Diff on function_definition.php with alignment
View function_definition.php.diff
diff --git function_definition.php function_definition.php
index 6e3fc12..cf96158 100644
--- function_definition.php
+++ function_definition.php
@@ -6,58 +6,58 @@
$FunctionList = array();
-$FunctionList['locale_list'] = array( 'name' => 'locale_list',
- 'operation_types' => array( 'read' ),
@patrickallaert
patrickallaert / function_definition.php.diff
Created Apr 5, 2012
Diff on function_definition.php without alignment
View function_definition.php.diff
diff --git function_definition.php function_definition.php
index a19b12a..ae42490 100644
--- function_definition.php
+++ function_definition.php
@@ -8,12 +8,12 @@ $FunctionList = array();
$FunctionList['locale_list'] = array(
'name' => 'locale_list',
- 'operation_types' => array( 'read' ),
- 'call_method' => array(
@patrickallaert
patrickallaert / Results.txt
Last active Dec 14, 2015
Comparing CPU time and memory usage between classes and arrays.
View Results.txt
PHP 5.4:
========
$ php54 bench1.php
0.36937880516052
292432712
$ php54 bench2.php
0.47057294845581
193929016