Overview
Comment:Always use string in replace modifier
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: eedd8379c672685609add9219c4864a8e1f1407ac9a3914259a9446f54dd976d
User & Date: bohwaz on 2023-03-24 16:41:29
Other Links: branch diff | manifest | tags
Context
2023-03-24
16:46
Move default receipt header/footer/CSS to the default "receipt" module check-in: d824e60c07 user: bohwaz tags: dev
16:41
Always use string in replace modifier check-in: eedd8379c6 user: bohwaz tags: dev
2023-03-15
11:24
Implement validate_only for {{:save}} check-in: 66b22c9173 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/UserTemplate/Modifiers.php from [0b378cb5fe] to [48ec3983c3].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	static public function replace($str, $find, $replace = null): string
	{
		if (is_array($find) && null === $replace) {
			return strtr($str, $find);
		}

		return str_replace($find, $replace, $str);
	}

	static public function regexp_replace($str, $pattern, $replace)
	{
		return preg_replace((string) $pattern, (string) $replace, (string) $str);
	}








|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	static public function replace($str, $find, $replace = null): string
	{
		if (is_array($find) && null === $replace) {
			return strtr($str, $find);
		}

		return str_replace((string)$find, (string)$replace, (string)$str);
	}

	static public function regexp_replace($str, $pattern, $replace)
	{
		return preg_replace((string) $pattern, (string) $replace, (string) $str);
	}