{"action":"opened","issue":{"url":"https://api.github.com/repos/bordoni/fakerpress/issues/106","repository_url":"https://api.github.com/repos/bordoni/fakerpress","labels_url":"https://api.github.com/repos/bordoni/fakerpress/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/bordoni/fakerpress/issues/106/comments","events_url":"https://api.github.com/repos/bordoni/fakerpress/issues/106/events","html_url":"https://github.com/bordoni/fakerpress/issues/106","id":194928516,"number":106,"title":"Missing argument validation in Module\\Meta::generate()","user":{"login":"dnaber-de","id":1133205,"avatar_url":"https://avatars.githubusercontent.com/u/1133205?v=3","gravatar_id":"","url":"https://api.github.com/users/dnaber-de","html_url":"https://github.com/dnaber-de","followers_url":"https://api.github.com/users/dnaber-de/followers","following_url":"https://api.github.com/users/dnaber-de/following{/other_user}","gists_url":"https://api.github.com/users/dnaber-de/gists{/gist_id}","starred_url":"https://api.github.com/users/dnaber-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnaber-de/subscriptions","organizations_url":"https://api.github.com/users/dnaber-de/orgs","repos_url":"https://api.github.com/users/dnaber-de/repos","events_url":"https://api.github.com/users/dnaber-de/events{/privacy}","received_events_url":"https://api.github.com/users/dnaber-de/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T09:40:22Z","updated_at":"2016-12-12T09:40:22Z","closed_at":null,"body":"… leads to a fatal error:\r\n\r\n```\r\n[Mon Dec 12 10:18:25.123914 2016] [:error] [pid 26975] [client 127.0.0.1:46584] PHP Fatal error:  Uncaught Error: Cannot unset string offsets in /…/fakerpress/modules/meta.php:69\r\nStack trace:\r\n#0 /…/fakerpress/modules/post.php(178): FakerPress\\\\Module\\\\Meta->generate('1', '1', '100')\r\n#1 /var/www/projects/inpsyde/woocommerce/public/wp-content/plugins/fakerpress/inc/class-fp-ajax.php(67): FakerPress\\\\Module\\\\Post->parse_request(10, Array)\r\n#2 /…/wp-includes/class-wp-hook.php(298): FakerPress\\\\Ajax::module_generate('')\r\n#3 /…/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)\r\n#4 /…/wp-includes/plugin.php(453): WP_Hook->do_action(Array)\r\n#5 /…/wp-admin/admin-ajax.php(91): do_action('wp_ajax_fakerpr...')\r\n#6 {main}\\n  thrown in /…/fakerpress/modules/meta.php on line 69\r\n```\r\n\r\n```\r\npublic function generate() {\r\n\t// Allow a bunch of params\r\n\t$arguments = func_get_args();\r\n\r\n\t// Remove $key and $name\r\n\t$type = array_shift( $arguments );\r\n\t$name = array_shift( $arguments );\r\n\t$args = array_shift( $arguments );\r\n\r\n\t$this->data['meta_key'] = null;\r\n\t$this->data['meta_value'] = null;\r\n\r\n\tif ( empty( $type ) ) {\r\n\t\treturn $this;\r\n\t}\r\n\r\n\tif ( empty( $name ) ) {\r\n\t\treturn $this;\r\n\t}\r\n\r\n\t$this->data['meta_key'] = $name;\r\n\r\n\tunset( $args['name'], $args['type'] );\r\n\t/* … */\r\n}\r\n```\r\nThere's no validation of the type of `$args`.\r\n\r\nMy setup:\r\nWordPress 4.7 Multisite, Fakerpress network activated, Twentysixteen, WooCommerce activated on a site.\r\n\r\nThe error occurs with the following settings on the AJAX request when clicking »Generate«:\r\n\r\n![fakerpress](https://cloud.githubusercontent.com/assets/1133205/21094444/58157dba-c057-11e6-9054-9eecf2445c88.png)\r\n\r\n"}}
{"actor":{"display_login":"dnaber-de"}}