Skip to content

Commit 6f2f6bf

Browse files
author
Anssi Hautamäki
committed
Empty string bug fix
Check that string is not empty before checking its first character. Pushes an error otherwise if WP is on debug mode.
1 parent 12e3f4f commit 6f2f6bf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

classes/class-cpt-wplf-submission.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ function metabox_submission() {
263263

264264
// Show a link if the field corresponds to a URL
265265
// assume values starting with '/' are root relative URLs and should be handled as links
266-
$value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL );
266+
$value_is_url = false;
267+
if ( strlen($value) > 0 ) {
268+
$value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL );
269+
}
267270
if ( $value_is_url ) {
268271
$link_text = __( 'Open Link', 'wp-libre-form' );
269272
$possible_link = '<a target="_blank" href="' . $value . '" style="float:right">' . $link_text . '</a>';

0 commit comments

Comments
 (0)