Skip to content

Instantly share code, notes, and snippets.

View m6w6's full-sized avatar

Michael Wallner m6w6

View GitHub Profile
Currently int64 support is disabled by default, size_t support is enabled by default
to build with size_t and int64 support use –enable-zint64 , size_t is enabled by default
to build without size_t and int64 support, use –enable-zstrlen , int64 is disabled by default
Relevant headers
Zend/zend_types.h
Zend/zend_int.h
Zend/zend_stream.h
@m6w6
m6w6 / gist:7888478
Last active December 30, 2015 21:39
Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version.
To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead.
<?php
use http\Client, http\Client\Request;
use http\QueryString;
$params = new QueryString;
$params["foo"] = "bar";
$params["bar"] = "foo";
$request = new Request("POST", "http://example.com");
diff --git a/config9.m4 b/config9.m4
index ce63132..73b2298 100644
--- a/config9.m4
+++ b/config9.m4
@@ -353,6 +353,8 @@ dnl ----
AC_DEFINE([PHP_HTTP_HAVE_PHP_RAPHF_H], [1], [Have ext/raphf support])
PHP_ADD_INCLUDE([$HTTP_EXT_RAPHF_INCDIR])
fi
+ ], [
+ AC_MSG_ERROR([Please install pecl/raphf])
@m6w6
m6w6 / google100.php
Created August 20, 2014 13:35
artax 100xgoogle
<?php
require "vendor/autoload.php";
require "vendor/rdlowrey/after/lib/functions.php";
$promises = (new Artax\Client)->requestMulti(array_fill(0, 100, "http://www.google.com"));
$responses = After\all($promises)->wait();
foreach ($responses as $response) {
<?php
namespace pq
{
interface ConverterInterface
{
abstract public function convertTypes();
abstract public function convertFromString($data);
@m6w6
m6w6 / opcache-segv.php
Created November 5, 2014 19:14
php -d opcache.enable_cli=1 opcache-segv.php
<?php
class Foo {
const FOO = 'Foo';
const FOOBAR = self::FOO.'Bar';
function baz() {
echo $segfault = self::FOOBAR.'Baz';
}
}
@m6w6
m6w6 / defl.php
Last active August 29, 2015 14:10
http\Encoding\Stream
<?php
use http\Encoding\Stream;
$stream = new Stream\Deflate(
Stream::FLUSH_SYNC |
Stream\Deflate::TYPE_RAW );
$encoded = "";
$threshold = 500;
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 10efd7a..369852f 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3504,7 +3504,7 @@ ZEND_API int zend_fcall_info_argp(zend_fcall_info *fci TSRMLS_DC, int argc, zval
fci->params = (zval *) erealloc(fci->params, fci->param_count * sizeof(zval));
for (i = 0; i < argc; ++i) {
- ZVAL_COPY_VALUE(&fci->params[i], &argv[i]);
+ ZVAL_COPY(&fci->params[i], &argv[i]);
@m6w6
m6w6 / z_obj_custom.diff
Created December 5, 2014 15:03
Accessors for custom objects
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index ac0965a..40bb3cb 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -158,6 +158,9 @@ extern ZEND_API zend_object_handlers std_object_handlers;
#define zend_get_function_root_class(fbc) \
((fbc)->common.prototype ? (fbc)->common.prototype->common.scope : (fbc)->common.scope)
+#define zend_get_custom_obj_ptr(zobjp) \
+ (void *)((char *) (zobjp) - (zobjp)->handlers->offset)