pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

php 7.4 issue - incorrect pods_data(..) call resulting in fatal error on wp-json api call [FIX proposed] #5590

Closed AlessandroFerrariFood closed 3 years ago

AlessandroFerrariFood commented 4 years ago

Describe the bug pods/classes/Pods.php line 316 function pods_data(..) invoked with $this->api (stdObject) but function signature want a string (pods name) resulting in a fatal error on php 7.4.2

To Reproduce Steps to reproduce the behavior:

  1. Goto: https:///wp-json/wp/v2/posts?_embed&slug=
  2. See fatal error

Expected behavior Getting proper JSON

Pods Version

2.7.16.2

WordPress Environment

` ### wp-core ### version: 5.3.2 site_language: en_US user_language: en_US timezone: Europe/Rome permalink: /%year%/%monthnum%/%day%/%postname%/ https_status: true user_registration: false default_comment_status: open multisite: true user_count: 12765 site_count: 4 network_count: 1 dotorg_communication: true ### wp-dropins (4) ### advanced-cache.php: true db.php: true object-cache.php: true sunrise.php: true ### wp-active-theme ### name: IFN (ifn-theme) version: 1.0.0 author: Alessandro Ferrari author_website: http://underscores.me/ parent_theme: none theme_features: automatic-feed-links, title-tag, custom-logo, post-thumbnails, menus, html5, custom-background, editor-styles, editor-style, custom-header, infinite-scroll, jetpack-responsive-videos, widgets theme_path: /storage/var/www/base.foodweb.it/htdocs/wp-content/themes/ifn-theme ### wp-themes-inactive (8) ### FoodService: version: 1.0.0, author: Alessandro Ferrari foodweb-theme-dev: version: 1.0.0, author: Alessandro Ferrari FoodWeb: version: 1.0.0, author: Alessandro Ferrari Twenty Fifteen: version: 2.5, author: the WordPress team Twenty Fourteen: version: 2.7, author: the WordPress team Twenty Nineteen: version: 1.4, author: the WordPress team Twenty Sixteen: version: 2.0, author: the WordPress team Twenty Twenty: version: 1.1, author: the WordPress team ### wp-mu-plugins (1) ### MO Cache: version: 1.0.0, author: Evgenii Nasyrov ### wp-plugins-active (23) ### Advanced Ads: version: 1.17.2, author: Thomas Maier, Advanced Ads GmbH Advanced Ads Pro: version: 2.6.2, author: Advanced Ads GmbH Advanced Ads – Ad Tracking: version: 1.20, author: Advanced Ads GmbH Ajax Search Pro: version: 4.10.3, author: Ernest Marcinko Block Lab: version: 1.5.3, author: Block Lab Cookie Notice: version: 1.2.50, author: dFactory Disable Comments: version: 1.10.2, author: Samir Shah Google Analytics for WordPress by MonsterInsights: version: 7.10.4, author: MonsterInsights Gravity Forms: version: 2.3.2, author: rocketgenius Gravity Forms MailChimp Add-On: version: 4.2, author: rocketgenius Imsanity: version: 2.5.0, author: Exactly WWW Nginx Helper: version: 2.2.1, author: rtCamp Pods - Custom Content Types and Fields: version: 2.7.16.2, author: Pods Framework Team Title Remover: version: 1.2.1, author: WPGurus Ultimate Posts Widget: version: 2.1.0, author: Clever Widgets Unfiltered MU: version: 1.3.1, author: Automattic Visualizer: Tables and Charts Manager for WordPress: version: 3.3.4, author: Themeisle W3 Total Cache: version: 0.13.0, author: BoldGrid Widget CSS Classes: version: 1.5.4, author: C.M. Kendrick Wordfence Security: version: 7.4.5, author: Wordfence WP REST API: version: 2.0-beta15, author: WP REST API Team WP REST API Yoast SEO: version: 1.2.0, author: Charlie Francis Yoast SEO: version: 13.0, author: Team Yoast ### wp-plugins-inactive (35) ### Advanced Custom Fields PRO: version: 5.8.7, author: Elliot Condon Akismet Anti-Spam: version: 4.1.3, author: Automattic Autoptimize: version: 2.6.1, author: Frank Goossens (futtta) Better Search Replace: version: 1.3.3, author: Delicious Brains Bulk Delete: version: 6.0.2, author: Sudar Bulk Move: version: 1.3.0, author: Sudar Categories to Tags Converter Importer: version: 0.5, author: wordpressdotorg Classic Editor: version: 1.5, author: WordPress Contributors Duplicate Menu: version: 0.2.2, author: Jonathan Christopher FacetWP: version: 2.7.2, author: FacetWP, LLC Fantastic ElasticSearch: version: 4.1.0, author: Paris Holley Force Regenerate Thumbnails: version: 2.0.6, author: Pedro Elsner GEO my WP: version: 3.4, author: Eyal Fitoussi Google Analytics Top Content Widget: version: 1.7.3, author: Jtsternberg Gravity Forms PayPal Standard Add-On: version: 2.8, author: rocketgenius Leaflet Map: version: 2.16.2, author: bozdoz MC4WP: Mailchimp for WordPress: version: 4.7.4, author: ibericode Multisite User Management: version: 1.1, author: Brent Shepherd P3 (Plugin Performance Profiler): version: 1.5.3.9, author: GoDaddy.com Photo Gallery: version: 1.5.45, author: Photo Gallery Team Pods Gravity Forms Add-On: version: 1.4.1, author: Pods Framework Team Query Monitor: version: 3.5.2, author: John Blackbourn Regenerate Thumbnails: version: 3.1.2, author: Alex Mills (Viper007Bond) Selection Sharer: version: 0.4, author: J.C. van Gent Smush: version: 3.4.2, author: WPMU DEV Transient Cleaner: version: 1.5.7, author: David Artiss User Switching: version: 1.5.3, author: John Blackbourn & contributors Widget Data - Setting Import/Export Plugin: version: 1.5.3, author: Voce Communications - Kevin Langley, Sean McCafferty, Mark Parolisi WordPress Importer: version: 0.6.4, author: wordpressdotorg WordPress MU Domain Mapping: version: 0.5.5.1, author: Donncha O Caoimh WP-SCSS: version: 1.2.5, author: Connect Think WP Bulk Delete: version: 1.1.3, author: Xylus Themes WP Editor: version: 1.2.6.3, author: Benjamin Rojas WP eMember: version: v9.0.9, author: Tips and Tricks HQ WP Migrate DB Pro: version: 1.9.8, author: Delicious Brains ### wp-media ### image_editor: BFI_Image_Editor_GD_1_3 imagick_module_version: 1687 imagemagick_version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org gd_version: 2.2.5 ghostscript_version: 9.26 ### wp-server ### server_architecture: Linux 4.15.0-1058-aws x86_64 httpd_software: nginx/1.10.0 php_version: 7.4.2 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 30 memory_limit: 256M max_input_time: 60 upload_max_size: 20M php_post_max_size: 80M curl_version: 7.58.0 OpenSSL/1.1.1d suhosin: false imagick_availability: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 10.4.12-MariaDB-1:10.4.12+maria~bionic-log client_version: mysqlnd 7.4.2 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /storage/var/www/base.foodweb.it/htdocs/wp-content WP_PLUGIN_DIR: /storage/var/www/base.foodweb.it/htdocs/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### pods ### pods-server-software: nginx/1.10.0 pods-user-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0 pods-session-save-path: /var/lib/php/sessions pods-session-save-path-exists: Yes pods-session-save-path-writable: Yes pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: Yes pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: Yes pods-object-cache-memcached: Yes pods-object-cache-redis: No pods-memory-current-usage: 17.217M pods-memory-current-usage-real: 2.000M pods-network-wide: Yes pods-install-location: /storage/var/www/base.foodweb.it/htdocs/wp-content/plugins/pods/ pods-developer: No pods-tableless-mode: No pods-light-mode: No pods-strict: No pods-allow-deprecated: Yes pods-api-cache: Yes pods-shortcode-allow-evaluate-tags: No `

Pods Package Export (helpful!)

Copy and Paste the JSON Export from **Pods Admin, Migrate: Packages, Export** in WordPress admin here

Possible Workaround pods/classes/Pods.php line 316 replace $this->data = pods_data( $this->api, $id, false ); with $this->data = pods_data( $pod, $id, false );

AlessandroFerrariFood commented 4 years ago

Pods Package Export (helpful!)

{"meta":{"version":"2.7.16.2","build":1581006896},"pods":{"172":{"id":172,"name":"post","label":"Post","description":"","type":"post_type","storage":"meta","object":"post","alias":"","fields":{"panorama_image":{"id":173,"name":"panorama_image","label":"Panorama image","description":"","help":"","class":"","type":"boolean","weight":0,"pick_object":"","pick_val":"","sister_id":"","required":"0","pick_post_status":["publish"],"boolean_format_type":"checkbox","boolean_yes_label":"Sì","boolean_no_label":"No","admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0"},"tempo_di_lettura":{"id":174,"name":"tempo_di_lettura","label":"Tempo di lettura","description":"minuti","help":"","class":"","type":"number","weight":1,"pick_object":"","pick_val":"","sister_id":"","required":"0","number_format_type":"number","number_format":"i18n","number_decimals":"0","number_step":"1","number_min":"0","number_max":"100","number_max_length":"12","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","number_repeatable":"0","number_format_soft":"0","number_placeholder":""},"custom_css_classes":{"id":175,"name":"custom_css_classes","label":"Custom Css Classes","description":"","help":"","class":"","type":"text","weight":2,"pick_object":"","pick_val":"","sister_id":"","required":"0","text_allow_shortcode":"0","text_allow_html":"0","text_allowed_html_tags":"strong em a ul ol li b i","text_max_length":"255","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","text_repeatable":"0","text_placeholder":""}},"show_in_menu":1,"rest_enable":"1","rest_base":"post","read_all":"1","write_all":"0"},"176":{"id":176,"name":"post_tag","label":"Post Tag","description":"","type":"taxonomy","storage":"meta","object":"post_tag","alias":"","fields":{"title_image":{"id":177,"name":"title_image","label":"Title image","description":"Se presente verrà mostrato nella pagina al posto del titolo. Usare formato vettoriale SVG","help":"","class":"","type":"file","weight":0,"pick_object":"custom-simple","pick_val":"","sister_id":"","required":"0","file_format_type":"single","file_uploader":"attachment","file_attachment_tab":"upload","file_edit_title":"1","file_linked":"0","file_limit":"0","file_restrict_filesize":"10MB","file_type":"other","file_allowed_extensions":"svg, jpg, jpeg, png, gif","file_add_button":"Aggiungi file","file_modal_title":"Allega un file","file_modal_add_button":"Aggiungi file","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","file_show_edit_link":0,"file_field_template":"rows"},"custom_css_classes":{"id":178,"name":"custom_css_classes","label":"Custom Css Classes","description":"","help":"","class":"","type":"text","weight":1,"pick_object":"","pick_val":"","sister_id":"","required":"0","text_allow_shortcode":"0","text_allow_html":"0","text_allowed_html_tags":"strong em a ul ol li b i","text_max_length":"255","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","text_repeatable":"0","text_placeholder":""},"page_sidebar":{"id":179,"name":"page_sidebar","label":"Page sidebar","description":"ATTENZIONE: serve il codice esatto o NONE (maiuscolo) per non mettere la sidebar","help":"","class":"","type":"text","weight":2,"pick_object":"","pick_val":"","sister_id":"","required":"0","text_allow_shortcode":"0","text_allow_html":"0","text_allowed_html_tags":"strong em a ul ol li b i","text_max_length":"255","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","text_repeatable":"0","text_placeholder":""},"skip_ads":{"id":180,"name":"skip_ads","label":"Skip ads","description":"Non mostrare pubblicità nella pagina riepilogativa di questo tag","help":"","class":"","type":"boolean","weight":3,"pick_object":"","pick_val":"","sister_id":"","required":"0","pick_post_status":["publish"],"boolean_format_type":"checkbox","boolean_yes_label":"Sì","boolean_no_label":"No","admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0"},"linked_event":{"id":181,"name":"linked_event","label":"Evento collegato","description":"","help":"","class":"","type":"pick","weight":4,"pick_object":"post_type","pick_val":"event","sister_id":"58338","required":"0","pick_format_type":"single","pick_format_single":"autocomplete","pick_format_multi":"checkbox","pick_taggable":"0","pick_limit":"0","pick_allow_html":"0","pick_user_role":[],"pick_post_status":["publish","future","draft","pending","private"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","pick_allow_add_new":1,"pick_show_icon":1,"pick_show_edit_link":1,"pick_show_view_link":1,"pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""}},"show_in_menu":"1","rest_enable":"0","rest_base":"post_tag","read_all":"0","write_all":"0","built_in_post_types_event":"0","built_in_post_types_sfogliabile":"1","built_in_post_types_nsl_generic":"0","built_in_post_types_launch":"0","built_in_post_types_store_check":"0","built_in_post_types_dem":"0"}}}

JoryHogeveen commented 4 years ago

@sc0ttkclark this seems to be a phpdoc issue, not sure why this would be a fatal error though since the function signature itself doesn't require a fixed var type.

sc0ttkclark commented 3 years ago

This has been resolved in 2.8