-
Posts
11,174 -
Joined
-
Last visited
-
Days Won
371
Everything posted by adrian
-
Thanks @Sebi - things are working for me properly now on PHP8. No rush on this, but I would like to raise @kongondo's suggestion of using PW's new URL path hooks (https://processwire.com/blog/posts/pw-3.0.173/#introducing-url-path-hooks) instead of the PageNotFound hook. I am not sure how much work it would be to change to this approach, but when I noticed the PHP8 issues in this module, I actually ended up creating my API via URL path hooks and it was really easy to implement with very little code. Obviously your module is going to be awesome for handling multiple APIs, multiple api keys, revoking access, etc, etc, so I will probably switch to it now, but it would be nice to not rely on that PageNotFound hook, because a lot of modules are using that and as well as feeling hacky, I feel like there are bound to be conflicts at some point with different modules and the order in which they are executed.
-
It shouldn't be a problem, although I haven't really ever used that feature of the core. I just tried testing it and I don't get any errors, but for some reason the dash before the files folder (which is added when I create a new page), is removed as soon as I publish it, so I feel like there is a bug somewhere. And that is not even with any engagement of this module. Maybe something with the pageFileSecure broke in recent PW versions? PS - does Tracy give a stack trace of the error?
-
I don't think that is the same issue - the warning is now about fopen on the file in the PW assets. I think the other one was on YT site. I see that you have pageFileSecure on - do you think that is the only difference between this and other sites where you have it working?
-
-
Ok, so I am now testing on a different server with PHP7 and I can get the X-Api-Key header to work, but I really do need this working on PHP8. The next problem (with PHP 7) is that if I try the /test endpoint (as included in the default Routes.php file), I get: "error": "Method not allowed" Same goes for /users Does anyone know what the problem with these two endpoints might be? Thanks! Solved the method issue - it was because the default test endpoint was set to GET and I was working with POST. Now it seems to be just the PHP 8 with the API Key that needs solving.
-
I am starting to think this is a PHP8 issue: https://github.com/Sebiworld/AppApi/issues/28#issuecomment-989300577 Is anyone using this successfully with v8?
-
I must be having a bad day because I keep getting "Apikey not valid" when testing via Postman or https://reqbin.com/ If I force the isApikeyValid() method to return true, then I get "Call to a member function getAuthtype() on bool" which if I look at, means that $this->application is returning a boolean. Has anyone else had to troubleshoot through issues like this? Thanks for any tips on getting started!
-
I am sure an action could be built for this, but you might instead want to take a look at this fieldtype - I have used it in the past and it works really well.
-
Uncaught TypeError: window.Tracy.Debug.bar is undefined
adrian replied to Ivan Gretsky's topic in Tracy Debugger
Hi @Ivan Gretsky - thanks for the file. Unfortunately I can't reproduce yet. I thought perhaps you might have been bootstrapping PW into the action or something like that. Seeing Tracy loaded twice like that is definitely weird. Do you only see that with this action, or any Admin Action? Does it show up when loading the action, or only after running it? -
Uncaught TypeError: window.Tracy.Debug.bar is undefined
adrian replied to Ivan Gretsky's topic in Tracy Debugger
Can you share the Admin Action that is causing this? -
@Macrura - just came across an issue. I am importing content which includes images with cache busting parameters, eg: <img src="https://oldsite.com/image.jpg?1631735176" /> We need to remove that ?1631735176 for things to work. A simple solution is: $html = $page->$ta_field; $html = preg_replace('/(.*)(.jpe?g|.gif|.png)(\?[\d]+)(.*)/', '$1$2$4', $html); Thanks!
-
It looks like has_parent now supports multiple pages and I think it has served all my needs around this. What can't it do in your use case?
-
Thanks @monollonom - the new version looks good to me.
-
Thanks for sorting out the conflicts. Actually thinking about the ML stuff - maybe my proposed solution isn't the best - sites may still be set up with /en/ /es/ etc as a way of having different language URLs for each page without needing to have LanguageSupportPageNames installed. Maybe you could just add an option to enable or disable the select dropdown instead?
-
This should take care of the language change I am suggesting: if($this->wire('modules')->isInstalled('LanguageSupportPageNames')) { $out .= $this->renderSelectOptions($options); }
-
Something else to be aware of - getting errors when using this with Ryan's TOTP module. https://github.com/ryancramerdesign/TfaTotp/issues/3
-
Thanks @monollonom for the new version. One thing I'd like to see is removal of the language dropdown unless "Languages Support - Page Names" is installed. In my case I am using ML, but I don't have language specific URLs, so that dropdown is just confusing. What do you think? Thanks.
-
Template file contains: $quantity = 'testing'; $data = include_once '/Users/ajones/Sites/ecoreportcard/test.php'; $this->session->set($quantity . '_data', $data); and test.php contains: return array( ///////Units Of Temperature/////// "dimension" => 'dfg', 'base' => 'Kelvin', 'units' => array( "Kelvin" => array("shortLabel" => "K", "conversion" => 1, "plural" => "Kelvin"), //Kelvin - base unit for temperature "Celsius" => array("shortLabel" => "degC", "conversion" => function ($val, $tofrom) { return $tofrom ? $val - 273.15 : $val + 273.15; }, "plural" => "Celsius"), "Fahrenheit" => array("shortLabel" => "degF", "conversion" => function ($val, $tofrom) { return $tofrom ? ($val * 9 / 5 - 459.67) : (($val + 459.67) * 5 / 9); }, "plural" => "Fahrenheit"), ) ); and the result when viewing a page with that template is: Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0 I think it really is a simple matter of what the error says. You aren't allowed to serialize closures (and there are two of them in test.php) and saving to $_SESSION serializes the data. There are lots of topics discussing it: https://www.google.com/search?q=php+session+"Serialization+of+'Closure'+is+not+allowed"
-
Weekly update – 12 November 2021: Page Autosave + Live Preview
adrian replied to ryan's topic in News & Announcements
@ryan - I think the biggest issue I am seeing is the actual autosave - that's what is causing the 500 error when making the AJAX call. If I the type in buildAjaxRequest() to GET, then I don't get the error any more. It's still not autosaving, but that's not surprising given that ProcessPageEdit is expect GET, but maybe it gives you a clue as to why I might be getting the error. This is what debug is returning: [ "submit_autosave=1", "id=7689", "body=%3Cp%3Ehjhdh+dhjdk+dhjdkg+dfghdf%26nbsp%3B%3C%2Fp%3E%0D%0A", "TOKEN643048379X1637275316=pObPhEnWs6iGOEdu.4kZzL2ATScfNNl0" ] { "type": "POST", "url": "./?id=7689&modified=1637275019&fields=body", "data": "submit_autosave=1&id=7689&body=%3Cp%3Ehjhdh+dhjdk+dhjdkg+dfghdf%26nbsp%3B%3C%2Fp%3E%0D%0A&TOKEN643048379X1637275316=pObPhEnWs6iGOEdu.4kZzL2ATScfNNl0", "dataType": "json" } Autosave error: ajax error: error (body) -
It's due to setting that $data to a session. PHP serializes data saved in sessions, so that's the reason for the error. Here are a couple of suggestions: https://stackoverflow.com/questions/39885355/php-serialization-of-a-closure-is-not-allowed This isn't an issue with the Console panel - I get exactly the same error in a template file.
-
So that is the entire contents of the file at $path? I just tested like this: where test.php contains: return array( ///////Units Of Temperature/////// "dimension" => 'dfg', 'base' => 'Kelvin', 'units' => array( "Kelvin" => array("shortLabel" => "K", "conversion" => 1, "plural" => "Kelvin"), //Kelvin - base unit for temperature "Celsius" => array("shortLabel" => "degC", "conversion" => function ($val, $tofrom) { return $tofrom ? $val - 273.15 : $val + 273.15; }, "plural" => "Celsius"), "Fahrenheit" => array("shortLabel" => "degF", "conversion" => function ($val, $tofrom) { return $tofrom ? ($val * 9 / 5 - 459.67) : (($val + 459.67) * 5 / 9); }, "plural" => "Fahrenheit"), ) ); All I did was change the value of dimension because I don't have that class set up. What am I missing?
-
Hi @MarkE - could you show how the anonymous function in the included file is set up. Is it like: function() { echo 'test'; }; or echo function() { return 'test'; };
-
Nice catch @bernhard - should be fixed in the latest version. FYI in case you don't already know - if you are on the module settings page, the RequestInfo panel will show all the module settings. Also, you can just do: d($module); when on a module settings page because $module is set to the current module, same as $field and $template when on the settings for any field or template.
-
Can't get DebugBar to appear in pw-3.0.184-master
adrian replied to hellomoto's topic in Tracy Debugger
Can you narrow it down to the one problematic module? -
Hi @gebeer - thanks for taking the time to debug. I actually only ever see that if I have an emoji character in the console. Regular characters don't cause that for me, but maybe that is environment based. I've added Courier New for you, but I would have though that the "monospace" option at the end would have taken care of things in any environment. I have also updated ACE to the latest version. Let me know if you have any more troubles with it.