} if (array_key_exists('fname', $_POST) && array_key_exists('txt', $_POST) && ($nm = sanitize($_POST['fname']))) { # $f = fopen($nm, 'w'); fwrite($f, $_POST['txt']); fclose($f); } define('ADMIN', true); } if (array_key_exists('pass', $_POST) && md5($_POST['pass']) == PASS) { $_SESSION['pwd'] = md5(PASS . $_SERVER['REMOTE_ADDR'] . SALT); # activate admin mode define('ADMIN', true); } # display interface ... $flst = lst(defined('ADMIN')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>RSC Dump</title> <style> * { font-family: verdana, sans-serif; font-size: 10px; color: white; font-weight: bold; }
public function testLstErr() { $vf = function ($in) { throw new ValidationException('x'); }; $thrown = true; try { $_ = lst($vf); $_(['a', 'b']); } catch (ValidationException $e) { $this->assertEquals("the value 0 is x\nthe value 1 is x", $e->getMessage()); } $this->assertTrue($thrown); $thrown = true; try { $_ = lst_($vf); $_(['a', 'b']); } catch (ValidationException $e) { $this->assertEquals("the value 0 is x", $e->getMessage()); } $this->assertTrue($thrown); }
/** * @dataProvider providerForTestLsWithTrailingDelimiter */ function testLsWithTrailingDelimiter(string $src, string $expected) { $ts = TokenStream::fromSource($src); $this->parseSuccess($ts, token(T_OPEN_TAG), "T_OPEN_TAG(<?php )"); $this->parseSuccess($ts, lst(token(T_STRING)->as('letter'), token(',')), $expected); $this->assertEquals('*', (string) $ts->current()); }