Issues (69)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

EMT/EMTTretText.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
* Evgeny Muravjev Typograph, http://mdash.ru
5
* Version: 3.4 Gold Master
6
* Release Date: September 20, 2014
7
* Authors: Evgeny Muravjev & Alexander Drutsa  
8
*/
9
10
namespace Fenrizbes\TypographBundle\EMT;
11
12
/**
13
 * @see EMTTret
14
 */
15
16
class EMTTretText extends EMTTret
17
{
18
	public $classes = array(
19
			'nowrap'           => 'word-spacing:nowrap;',
20
		);
21
	
22
	/**
23
	 * Базовые параметры тофа
24
	 *
25
	 * @var array
26
	 */
27
	public $title = "Текст и абзацы";
28
	public $rules = array(	
29
		'auto_links' => array(
30
				'description'	=> 'Выделение ссылок из текста',
31
				'pattern' 		=> '/(\s|^)(http|ftp|mailto|https)(:\/\/)([^\s\,\!\<]{4,})(\s|\.|\,|\!|\?|\<|$)/ieu', 
32
				'replacement' 	=> '$m[1] . $this->tag((substr($m[4],-1)=="."?substr($m[4],0,-1):$m[4]), "a", array("href" => $m[2].$m[3].(substr($m[4],-1)=="."?substr($m[4],0,-1):$m[4]))) . (substr($m[4],-1)=="."?".":"") .$m[5]'
33
			),
34
		'email' => array(
35
				'description'	=> 'Выделение эл. почты из текста',
36
				'pattern' 		=> '/(\s|^|\&nbsp\;|\()([a-z0-9\-\_\.]{2,})\@([a-z0-9\-\.]{2,})\.([a-z]{2,6})(\)|\s|\.|\,|\!|\?|$|\<)/e',
37
				'replacement' 	=> '$m[1] . $this->tag($m[2]."@".$m[3].".".$m[4], "a", array("href" => "mailto:".$m[2]."@".$m[3].".".$m[4])) . $m[5]'
38
			),
39
		'no_repeat_words' => array(
40
				'description'	=> 'Удаление повторяющихся слов',
41
				'disabled'      => true,
42
				'pattern' 		=> array(
43
					'/([а-яё]{3,})( |\t|\&nbsp\;)\1/iu',
44
					'/(\s|\&nbsp\;|^|\.|\!|\?)(([А-ЯЁ])([а-яё]{2,}))( |\t|\&nbsp\;)(([а-яё])\4)/eu',
45
					),
46
				'replacement' 	=> array(
47
					'\1',
48
					'$m[1].($m[7] === \Fenrizbes\TypographBundle\EMT\EMTLib::strtolower($m[3]) ? $m[2] : $m[2].$m[5].$m[6] )',
49
					)
50
			),			
51
		'paragraphs' => array(
52
				'description'	=> 'Простановка параграфов',
53
				'function'	=> 'build_paragraphs'
54
			),
55
		'breakline' => array(
56
				'description'	=> 'Простановка переносов строк',
57
				'function'	=> 'build_brs'
58
			),
59
		
60
		);
61
62
    /**
63
	 * Расстановка защищенных тегов параграфа (<p>...</p>) и переноса строки
64
	 *
65
	 * @return  void
66
	 */	
67
	protected function do_paragraphs($text) {
68
		$text = str_replace("\r\n","\n",$text);
69
		$text = str_replace("\r","\n",$text);
70
		$text = '<' . self::BASE64_PARAGRAPH_TAG . '>' . trim($text) . '</' . self::BASE64_PARAGRAPH_TAG . '>';
71
		//$text = $this->preg_replace_e('/([\040\t]+)?(\n|\r){2,}/e', '"</" . self::BASE64_PARAGRAPH_TAG . "><" .self::BASE64_PARAGRAPH_TAG . ">"', $text);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
72
		//$text = $this->preg_replace_e('/([\040\t]+)?(\n){2,}/e', '"</" . self::BASE64_PARAGRAPH_TAG . "><" .self::BASE64_PARAGRAPH_TAG . ">"', $text);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
73
		$text = $this->preg_replace_e('/([\040\t]+)?(\n)+([\040\t]*)(\n)+/e', '$m[1]."</" . self::BASE64_PARAGRAPH_TAG . ">".\Fenrizbes\TypographBundle\EMT\EMTLib::iblock($m[2].$m[3])."<" .self::BASE64_PARAGRAPH_TAG . ">"', $text);
74
		//$text = $this->preg_replace_e('/([\040\t]+)?(\n)+([\040\t]*)(\n)+/e', '"</" . self::BASE64_PARAGRAPH_TAG . ">"."<" .self::BASE64_PARAGRAPH_TAG . ">"', $text);
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
75
		//может от открвающего до закрывающего ?!
76
		$text = preg_replace('/\<' . self::BASE64_PARAGRAPH_TAG . '\>('.EMTLib::INTERNAL_BLOCK_OPEN.'[a-zA-Z0-9\/=]+?'.EMTLib::INTERNAL_BLOCK_CLOSE.')?\<\/' . self::BASE64_PARAGRAPH_TAG . '\>/s', "", $text);
77
		return $text;
78
	}
79
		
80
	/**
81
	 * Расстановка защищенных тегов параграфа (<p>...</p>) и переноса строки
82
	 *
83
	 * @return  void
84
	 */	
85
	protected function build_paragraphs()
86
	{
87
		$r = mb_strpos($this->_text, '<' . self::BASE64_PARAGRAPH_TAG . '>' );
88
		$p = EMTLib::rstrpos($this->_text, '</' . self::BASE64_PARAGRAPH_TAG . '>' )	;
89
		if(($r!== false) && ($p !== false)) {			
90
			
91
			$beg = mb_substr($this->_text,0,$r);
92
			$end = mb_substr($this->_text,$p+mb_strlen('</' . self::BASE64_PARAGRAPH_TAG . '>'));			
93
			$this->_text = 
94
							(trim($beg) ? $this->do_paragraphs($beg). "\n":"") .'<' . self::BASE64_PARAGRAPH_TAG . '>'.
95
							mb_substr($this->_text,$r + mb_strlen('<' . self::BASE64_PARAGRAPH_TAG . '>'),$p -($r + mb_strlen('<' . self::BASE64_PARAGRAPH_TAG . '>')) ).'</' . self::BASE64_PARAGRAPH_TAG . '>'.
96
							(trim($end) ? "\n".$this->do_paragraphs($end) :"") ;
97
		} else {
98
			$this->_text = $this->do_paragraphs($this->_text);
0 ignored issues
show
Are you sure the assignment to $this->_text is correct as $this->do_paragraphs($this->_text) (which targets Fenrizbes\TypographBundl...etText::do_paragraphs()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
99
		}
100
	}
101
	
102
	/**
103
	 * Расстановка защищенных тегов параграфа (<p>...</p>) и переноса строки
104
	 *
105
	 * @return  void
106
	 */
107
	protected function build_brs()
108
	{
109
		$this->_text = $this->preg_replace_e('/(\<\/' . self::BASE64_PARAGRAPH_TAG . '\>)([\r\n \t]+)(\<' . self::BASE64_PARAGRAPH_TAG . '\>)/mse', '$m[1].\Fenrizbes\TypographBundle\EMT\EMTLib::iblock($m[2]).$m[3]', $this->_text);
110
		
111
		if (!preg_match('/\<' . self::BASE64_BREAKLINE_TAG . '\>/', $this->_text)) {
112
			$this->_text = str_replace("\r\n","\n",$this->_text);
113
			$this->_text = str_replace("\r","\n",$this->_text);
114
			//$this->_text = $this->preg_replace_e('/(\n|\r)/e', '"<" . self::BASE64_BREAKLINE_TAG . ">"', $this->_text);
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
115
			$this->_text = $this->preg_replace_e('/(\n)/e', '"<" . self::BASE64_BREAKLINE_TAG . ">\n"', $this->_text);
116
		}
117
	}
118
}