<?php

set_include_path('/usr/share/php/smarty3/');
require('Smarty.class.php');

$error_reporting = 1;

// test for CVE-2024-35226; extracted from upstream.
$tpl = new Smarty();

print "\n### 001_parent.tpl\n";

try {
    $tpl->fetch('string:{include "001_parent.tpl\', var_dump(shell_exec(\'ls\')), 1, 2, 3, 4, 5, 6);}}?>"}');
    print "ERROR\n";
    exit(1);
} catch (Exception $e) {
    echo 'GOOD: Caught exception: ',  $e->getMessage(), "\n";
}

exit(0);

