Giter VIP home page Giter VIP logo

Comments (11)

xxsimoxx avatar xxsimoxx commented on June 12, 2024

I did some more tests and get weird results also with WP (WSOD).
What about this little change?

$value = preg_replace( '/[^0-9:.-]/', '', $value ); // Strips slashes.
$value = preg_replace( '/[^0-9:.-]/', '', $value ?? '' ); // Strips slashes.

Or we have to dig a little more?

from classicpress-v2.

mattyrob avatar mattyrob commented on June 12, 2024

If you empty the database or re-install to a fresh set of tables do you still see this issue?

In your database what is the gmt_offset option value? ( SELECT * FROM cp_optionsWHEREoption_name = 'gmt_offset';) if you have a Timezone selected and if you have an offset selected?

from classicpress-v2.

xxsimoxx avatar xxsimoxx commented on June 12, 2024

gmt_offset is correct in the option table and in the page too (I'm choosing "Rome" and not the offset).

image

Same after a fresh install.

from classicpress-v2.

mattyrob avatar mattyrob commented on June 12, 2024

Why you say gmt_offset is correct in the option table - is that a number? When I set for "Rome" the got_offset value in the table is empty. Any plugins or Timezone code in the Theme?

from classicpress-v2.

xxsimoxx avatar xxsimoxx commented on June 12, 2024

With Rome I have gmt_offset = 2.
Tested with ClassicPress TwentySixteen and ClassicPress TwentySeventeen themes.

from classicpress-v2.

mattyrob avatar mattyrob commented on June 12, 2024

Well, here we seem to have a difference.

With Timezone set as Fiji, in my database I have:
Screenshot 2023-05-10 at 18 02 29

With Timezone set as Rome, I have:
Screenshot 2023-05-10 at 18 03 37

And with Timezone set as UTF_8, I have:
Screenshot 2023-05-10 at 18 03 57

So, it seems for some reason when you set the Timezone as a place that the got_offset value is not being cleared out. Are you using caching locally at all?

from classicpress-v2.

xxsimoxx avatar xxsimoxx commented on June 12, 2024

I was using wp-cli to get gmt_offset, my fault.
The value in the database is as in your, but it's filtered by wp_timezone_override_offset() defined in src/wp-includes/functions.php and hooked in src/wp-includes/default-filters.php.
Hope this helps.

from classicpress-v2.

xxsimoxx avatar xxsimoxx commented on June 12, 2024

Looking here:

			$value  = null;
			if ( isset( $_POST[ $option ] ) ) {
				$value = $_POST[ $option ];
				if ( ! is_array( $value ) ) {
					$value = trim( $value );
				}
				$value = wp_unslash( $value );
			}
			update_option( $option, $value );

gmt_offset is not in $_POST, so why updating gmt_offset to null?
In general, why updating an option that is not required to update?

from classicpress-v2.

xxsimoxx avatar xxsimoxx commented on June 12, 2024

Found ticket for this:
https://core.trac.wordpress.org/ticket/57728

from classicpress-v2.

mattyrob avatar mattyrob commented on June 12, 2024

Good job finding the upstream ticket. They have a patch, we can monitor now to see when it is merged.

from classicpress-v2.

mattyrob avatar mattyrob commented on June 12, 2024

Fixed in #88

from classicpress-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.