libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Undefined variables in inc/wplf-form-actions.php #69

Closed k1sul1 closed 7 years ago

k1sul1 commented 7 years ago

Today while crawling through the logs, I found these:

https://github.com/anttiviljami/wp-libre-form/blob/master/inc/wplf-form-actions.php#L77 https://github.com/anttiviljami/wp-libre-form/blob/master/inc/wplf-form-actions.php#L84

AFAIK there's no $attachment defined anywhere and that results in a notice.

I also spotted this stack trace that probably has something to do with this:

[27-Jun-2017 09:12:36 UTC] PHP Notice:  Object of class WP_Error could not be c$
nverted to int in /data/wordpress/htdocs/wordpress/wp-includes/post.php on line
5030
[27-Jun-2017 09:12:36 UTC] PHP Stack trace:
[27-Jun-2017 09:12:36 UTC] PHP   1. {main}() /data/wordpress/htdocs/wordpress/w$
-admin/admin-ajax.php:0
[27-Jun-2017 09:12:36 UTC] PHP   2. do_action($tag = 'wp_ajax_nopriv_wplf_submi$
', $arg = *uninitialized*) /data/wordpress/htdocs/wordpress/wp-admin/admin-ajax$
php:101
[27-Jun-2017 09:12:36 UTC] PHP   3. WP_Hook->do_action($args = array (0 => ''))
/data/wordpress/htdocs/wordpress/wp-includes/plugin.php:453
[27-Jun-2017 09:12:36 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args =
array (0 => '')) /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php:
323
[27-Jun-2017 09:12:36 UTC] PHP   5. wplf_ajax_submit_handler('') /data/wordpress
/htdocs/wordpress/wp-includes/class-wp-hook.php:298
[27-Jun-2017 09:12:36 UTC] PHP   6. wp_get_attachment_url($post_id = class WP_Er
ror { public $errors = array ('upload_error' => array (...)); public $error_data
 = array () }) /data/wordpress/htdocs/wp-content/plugins/wp-libre-form/inc/wplf-
ajax.php:68
anttiviljami commented 7 years ago

Looks like a typo

k1sul1 commented 7 years ago

Yep, most definitely.

Fixed that and added a check for is_wp_error.