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-- PDO_4D: Get image from PICTURE field (needs a testImage table with an 'image' PIC..

Decoded Output download

--TEST--
PDO_4D: Get image from PICTURE field (needs a testImage table with an 'image' PICTURE field with at least one reccord)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip no PDO');
if (!extension_loaded('gd')) die('skip no GD');
if (!extension_loaded('pdo_4d')) die('skip no PDO for 4D extension');

require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
?>
--FILE--
<?php
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');

//$db->query('CREATE TABLE foobar (id INT)');

$r = $db->query('SELECT * FROM testImage')->fetchAll();
//var_dump($r);

$img = imagecreatefromstring($r[0]['image']);

var_dump($img);

?>
--EXPECTF--
resource(%d) of type (gd)

Did this file decode correctly?

Original Code

--TEST--
PDO_4D: Get image from PICTURE field (needs a testImage table with an 'image' PICTURE field with at least one reccord)
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip no PDO');
if (!extension_loaded('gd')) die('skip no GD');
if (!extension_loaded('pdo_4d')) die('skip no PDO for 4D extension');

require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
?>
--FILE--
<?php
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');

//$db->query('CREATE TABLE foobar (id INT)');

$r = $db->query('SELECT * FROM testImage')->fetchAll();
//var_dump($r);

$img = imagecreatefromstring($r[0]['image']);

var_dump($img);

?>
--EXPECTF--
resource(%d) of type (gd)

Function Calls

dirname 1
extension_loaded 3

Variables

None

Stats

MD5 5916cd28360ad0320b967a466e8d2536
Eval Count 0
Decode Time 106 ms