analogwp / analogwp-templates

Style Kits for Elementor adds a number of intuitive styling controls in the Elementor editor that allow you to apply styles globally or per page.
https://analogwp.com
27 stars 7 forks source link

Import template not worked in play server #407

Closed gvgvgvijayan closed 4 years ago

gvgvgvijayan commented 4 years ago

Tested in the environment WP 5.5RC3, EL 3 beta5, analogwp-templates in the branch release/1.7.0 and it's working properly.

The issue may be EL3 fixes are in branch release/1.7.0 and in play server currently points to block library branch Issue 393 with EL3 beta5 installed which throws the error as the branch 393 don't have the EL3 fixes.

To resolve this create a new branch which is the merge of both release/1.7.0 and issue 393, rsync merged branch into the play server

gvgvgvijayan commented 4 years ago

Found which one cause the "internal server error 500" while importing the template "Skinny - Layout" in the private method sanitize_settings there is check whether the settings object have dynamic settings or not (https://github.com/elementor/elementor/blob/release/3.0.0-rc/includes/base/controls-stack.php#L2038) and "skinny - Layout" have that dynamic settings so when the dynamic settings present the loop instead of go to the next iteration it move to next line execution and the variable $value_to_check is assigned with dynamic settings value here in our case there are two settings they are [elementor-tag id=\"cd6930b\" name=\"site-url\" settings=\"%7B%7D\"] and [elementor-tag id=\"2bab227\" name=\"current-date-time\" settings=\"%7B%22date_format%22%3A%22custom%22%2C%22custom_format%22%3A%22Y%22%2C%22before%22%3A%22Copyright%20%22%2C%22after%22%3A%22%20-%20Skinny%22%7D\"] this string passed to the method tag_text_to_tag_data() (https://github.com/elementor/elementor/blob/release/3.0.0-rc/includes/base/controls-stack.php#L2043)

The method tag_text_to_tag_data() (https://github.com/elementor/elementor/blob/release/3.0.0-rc/core/dynamic-tags/manager.php#L135) executing a regex check which return null as the regex not matching for the string "[elementor-tag id=\"cd6930b\" name=\"site-url\" settings=\"%7B%7D\"]" as we noted clearly the regex may expect string like this "[elementor-tag id="cd6930b" name="site-url" settings="%7B%7D"]" but quotes of the attribute values doublequotes are escaped means it return array instead of null.

The method tag_text_to_tag_data() return null but in the private method in conditional check (https://github.com/elementor/elementor/blob/release/3.0.0-rc/includes/base/controls-stack.php#L2045) the undefined index $tag_text_data['name'] is called so this is the one throws 500 internal server error.

Error:

Exception has occurred. Notice: Trying to access array offset on value of type null