Skip to content

Instantly share code, notes, and snippets.

View m6w6's full-sized avatar

Michael Wallner m6w6

View GitHub Profile
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 204c33b..fe42cf2 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -397,8 +397,9 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */
#if STREAM_DEBUG
{
char out[200] = "";
- fprintf(stderr, "stream_free: %s:%p[%s] in_free=%d opts=%s\n",
- stream->ops->label, stream, stream->orig_path, stream->in_free, _php_stream_pretty_free_options(close_
@m6w6
m6w6 / zend_operators_IS_INDIRECT.diff
Created January 22, 2015 10:10
reading original declared properties returns indirect zvals
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 0173251..d6d6a9f 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -713,6 +713,9 @@ try_again:
case IS_REFERENCE:
op = Z_REFVAL_P(op);
goto try_again;
+ case IS_INDIRECT:
+ op = Z_INDIRECT_P(op);
@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)
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 / 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;
@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';
}
}
<?php
namespace pq
{
interface ConverterInterface
{
abstract public function convertTypes();
abstract public function convertFromString($data);
@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) {
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])
<?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");