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 265 forks source link

Magic tags in Custom upload directory doesn't work with new releases #7069

Open navthink13 opened 1 year ago

navthink13 commented 1 year ago

Description

Using Magic tags in custom upload directory is no more working since recent release ( at least with 2.9.13 but probably before ) I use Pods in order customers to upload files for their shop-order, after its creation, in front end "documents/{@_customer_user}/{@ID}" worked like a charm few months ago, but file is now recorded in db with this url: "documents///filename.ext" I tried "documents/{@ID} => same issue

I have this warning in debug file


PHP Notice: Undefined property: stdClass::$item_id in /data/var/ibiote.com/httpdocs/wordpress/navthink/wp-content/plugins/pods/classes/fields/file.php on line 1189 [02-May-2023 20:03:12 UTC] PHP Notice: Undefined property: stdClass::$item_id in /data/var/ibiote.com/httpdocs/wordpress/navthink/wp-content/plugins/pods/classes/fields/file.php on line 1200 [02-May-2023 20:03:12 UTC] PHP Notice: Undefined property: stdClass::$item_id in /data/var/ibiote.com/httpdocs/wordpress/navthink/wp-content/plugins/pods/classes/fields/file.php on line 1244 [02-May-2023 20:03:12 UTC] PHP Notice: Undefined property: stdClass::$item_id in /data/var/ibiote.com/httpdocs/wordpress/navthink/wp-content/plugins/pods/classes/fields/file.php on line 1281


Version

2.9.13

Testing Instructions

No response

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

No response

Pods Package

No response

navthink13 commented 1 year ago

I have a doubt about "recent release" I just tried 2.9.11 => same issue then 2.8.14 => no issue

Dade88 commented 1 year ago

I can confirm this is also happening to me too. Running Pods 2.9.13 on PHP 7.4.33 with the following disabled functions.

disable_functions = show_source,shell_exec,system,passthru,popen,proc_open,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare

Magic quotes {@date.Y} works, but {@pods.field} doesn't return any value for the folders structure.

My logs show something similar: 2023/05/13 00:33:47 [error] 51079#51079: *246518 FastCGI sent in stderr: "PHP message: PHP Warning: finfo_file(123.pdf): failed to open stream: No such file or directory in /var/www/web.com/public/wp-content/plugins/pods/classes/fields/file.php on line 1169" while reading response header from upstream, client: 178.60.67.77, server: wpfitt.tilellit.pro, request: "POST /wp-admin/admin-ajax.php?pods_ajax=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php/web.sock:", host: "web.pro", referrer:

{@title} and other magic quotes listed in the documentation are not working either.

Could this be related with Magic Quotes deprecation on PHP 7.4 and suppression for PHP 8.0?

Is there any workaround while this get fixed?

mpiasta-ca commented 1 year ago

Ah great, I just posted the same bug: https://github.com/pods-framework/pods/issues/7074

The temporary bug fix I applied locally:

Added this code on line 1053 of pods\classes\fields\file.php:

if (!isset($params->item_id) && isset($params->post_id)) { $params->item_id = (int) $params->post_id; }

Dade88 commented 1 year ago

Ah great, I just posted the same bug: #7074

The temporary bug fix I applied locally:

Added this code on line 1053 of pods\classes\fields\file.php:

if (!isset($params->item_id) && isset($params->post_id)) { $params->item_id = (int) $params->post_id; }

This actually solved the issue on my developement site too.