1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
From 03a36641bd9b13b1084ffa9dc330d7ebd2700ed1 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 10 Oct 2019 16:25:20 +0200
Subject: [PATCH 1/2] Fix TypeError with 7.4
TypeError: Argument 1 passed to Gettext\Translations::Gettext\{closure}() must be an instance of Gettext\Translation, array given
From UPGRADINGS
. Calling get_object_vars() on an ArrayObject instance will now always return
the properties of the ArrayObject itself (or a subclass). Previously it
returned the values of the wrapped array/object unless the STD_PROP_LIST
flag was specified.
---
src/Translations.php | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/Translations.php b/src/Translations.php
index 083b4ad..05d6a3e 100644
--- a/src/Translations.php
+++ b/src/Translations.php
@@ -435,11 +435,13 @@ public function find($context, $original = '')
*/
public function countTranslated()
{
- $callback = function (Translation $v) {
- return ($v->hasTranslation()) ? $v->getTranslation() : null;
- };
-
- return count(array_filter(get_object_vars($this), $callback));
+ $c = 0;
+ foreach($this as $v) {
+ if ($v->hasTranslation()) {
+ $c++;
+ }
+ }
+ return $c;
}
/**
From bfc9a85db55107ed58ce8e9ca84be077e03eec41 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 10 Oct 2019 16:28:19 +0200
Subject: [PATCH 2/2] Fix Invalid characters passed for attempted conversion
(7.4)
---
src/Extractors/PhpCode.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Extractors/PhpCode.php b/src/Extractors/PhpCode.php
index ef31449..34243b9 100644
--- a/src/Extractors/PhpCode.php
+++ b/src/Extractors/PhpCode.php
@@ -122,11 +122,11 @@ function ($match) {
case '\\':
return '\\';
case 'x':
- return chr(hexdec(substr($match[0], 1)));
+ return chr(hexdec(substr($match[1], 1)));
case 'u':
- return self::unicodeChar(hexdec(substr($match[0], 1)));
+ return self::unicodeChar(hexdec(substr($match[1], 1)));
default:
- return chr(octdec($match[0]));
+ return chr(octdec($match[1]));
}
},
$value
|