Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- cairo_stroke() function --SKIPIF-- <?php if(!extension_loaded('cairo')) die('skip..

Decoded Output download

--TEST--
cairo_stroke() function
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
?>
--FILE--
<?php
$surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
var_dump($surface);

$context = cairo_create($surface);
var_dump($context);

cairo_stroke($context);

// bad type hint is an E_RECOVERABLE_ERROR, so let's hook a handler
function bad_class($errno, $errstr) {
	echo 'CAUGHT ERROR: ' . $errstr, PHP_EOL;
}
set_error_handler('bad_class', E_RECOVERABLE_ERROR);

// check number of args - should accept ONLY 1
cairo_stroke();
cairo_stroke($context, 1);

// check arg types, should be CairoContext
cairo_stroke(1);
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
}
object(CairoContext)#%d (0) {
}

Warning: cairo_stroke() expects exactly 1 parameter, 0 given in %s on line %d

Warning: cairo_stroke() expects exactly 1 parameter, 2 given in %s on line %d
CAUGHT ERROR: Argument 1 passed to cairo_stroke() must be an instance of CairoContext, integer given

Warning: cairo_stroke() expects parameter 1 to be CairoContext, integer given in %s on line %d

Did this file decode correctly?

Original Code

--TEST--
cairo_stroke() function
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
?>
--FILE--
<?php
$surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 50, 50);
var_dump($surface);

$context = cairo_create($surface);
var_dump($context);

cairo_stroke($context);

// bad type hint is an E_RECOVERABLE_ERROR, so let's hook a handler
function bad_class($errno, $errstr) {
	echo 'CAUGHT ERROR: ' . $errstr, PHP_EOL;
}
set_error_handler('bad_class', E_RECOVERABLE_ERROR);

// check number of args - should accept ONLY 1
cairo_stroke();
cairo_stroke($context, 1);

// check arg types, should be CairoContext
cairo_stroke(1);
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
}
object(CairoContext)#%d (0) {
}

Warning: cairo_stroke() expects exactly 1 parameter, 0 given in %s on line %d

Warning: cairo_stroke() expects exactly 1 parameter, 2 given in %s on line %d
CAUGHT ERROR: Argument 1 passed to cairo_stroke() must be an instance of CairoContext, integer given

Warning: cairo_stroke() expects parameter 1 to be CairoContext, integer given in %s on line %d

Function Calls

extension_loaded 1

Variables

None

Stats

MD5 ba6f9c0961ecf68b1e0c2c0b1dde8e8f
Eval Count 0
Decode Time 112 ms