Skip to content

Commit cf0abe5

Browse files
Additional updates for processwire/processwire-issues#1467
1 parent 3bd2772 commit cf0abe5

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Diff for: wire/core/WireTextTools.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ protected function ___wordAlternates($word, array $options) {
905905
* - `has` (bool): Specify true to only return true or false if it has tags (default=false).
906906
* - `tagOpen` (string): The required opening tag character(s), default is '{'
907907
* - `tagClose` (string): The required closing tag character(s), default is '}'
908-
* @return array|bool
908+
* @return array|bool Always returns array unless you specify the `has` option as true.
909909
* @since 3.0.126
910910
*
911911
*/
@@ -918,6 +918,7 @@ public function findPlaceholders($str, array $options = array()) {
918918
);
919919

920920
$options = array_merge($defaults, $options);
921+
$str = (string) $str;
921922
$tags = array();
922923
$pos1 = strpos($str, $options['tagOpen']);
923924

Diff for: wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module

+2-3
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ class FieldtypeComments extends FieldtypeMulti {
300300
// assign code and subcode
301301
if(!$comment->code || !$comment->subcode) {
302302
$rand = new WireRandom();
303-
if(!strlen($comment->code)) {
303+
if(!strlen("$comment->code")) {
304304
// code: visible to admin only
305305
$code = $rand->alphanumeric(128);
306306
$comment->code = $code;
307307
}
308-
if(!strlen($comment->subcode)) {
308+
if(!strlen("$comment->subcode")) {
309309
// subcode: may be visible to commenter
310310
$subcode = $rand->alphanumeric(40);
311311
$comment->subcode = $subcode;
@@ -2555,4 +2555,3 @@ class FieldtypeComments extends FieldtypeMulti {
25552555
}
25562556

25572557
}
2558-

Diff for: wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
263263

264264
$fields = $this->wire()->fields;
265265
$items = $this->attr('value');
266-
$item = count($items) ? $items->first() : null;
266+
$item = wireCount($items) ? $items->first() : null;
267267

268268
$templateId = $this->field ? (int) $this->field->get('template_id') : 0;
269269
$template = $templateId ? $this->wire()->templates->get($templateId) : null;

Diff for: wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ class InputfieldPageTable extends Inputfield {
518518
$value = (string) $object;
519519
}
520520

521-
$value = $this->wire()->sanitizer->entities(strip_tags($value));
521+
$value = $this->wire()->sanitizer->entities(strip_tags("$value"));
522522
$value = nl2br($value);
523523

524524
return $value;

Diff for: wire/modules/Textformatter/TextformatterEntities.module

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class TextformatterEntities extends Textformatter {
2626
public function format(&$str) {
2727
if($this->charset === '') $this->charset = $this->wire()->config->dbCharset;
2828
if(stripos($this->charset, 'utf8') === 0) {
29-
$str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
29+
$str = htmlspecialchars("$str", ENT_QUOTES, 'UTF-8');
3030
} else {
31-
$str = htmlspecialchars($str, ENT_QUOTES);
31+
$str = htmlspecialchars("$str", ENT_QUOTES);
3232
}
3333
}
3434
}

0 commit comments

Comments
 (0)