Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every contact is getting a Birthday and anniversary set to the time of sync to the device #9

Closed
liverpoolfc-fan opened this issue May 22, 2023 · 1 comment · Fixed by #12

Comments

@liverpoolfc-fan
Copy link
Contributor

Server (please complete the following information):

OS: Rocky Linux 9
PHP Version: 8.1.14
Z-Push Version: develop-2.6.2-164-g6458636d (cloned from github - 22/05/2023)
Backend: Zimbra

Smartphone (please complete the following information):

Device: Samsung Galaxy S21
OS: Android
Mail App: Samsung Email

Additional context

When contacts sync to the device, z-push is creating a Birthday event for every one in the Android calendar on today's date. I have 628 contacts syncing from the server and I have 628 all-day yearly events that were created

The problem appears to stem from the fix in streamer.php for a change in the behaviour of the function gmstrftime

The latest fix shows

    // Handle empty string passed for PHP 8.x
	if ('' === $ts) {
		$ts = null;
	}

prevents the function from failing when passed an empty string.

However, the passing of null to the gmstrftime results in it using the current date/time as the timestamp to be formatted.

The Contact Syncobject has anniversary and birthday fields which by default are empty strings.

So, when the exporter code requests that those fields be formatted, if they are not set in the server they will be assigned the datetime of the sync request instead of being returned as empty strings as was the pre-PHP8, and in this case the desired, behaviour.

It looks like the second to last commit against streamer.php was actually returning the empty string which I believe is the required outcome. Why was that commit superceeded?

I believe the correct fix is the previous version

    // Handle empty string passed for PHP 8.x
	if ('' === $ts) {
		return $ts;
	}

Vincent

@matidau
Copy link
Collaborator

matidau commented May 30, 2023

Thanks Vincent

Happy for a PR to be opened on this.

Looking at the the author of these commits https://github.com/sonersivri he is involved with Zextras, so these changes might have been related to their Zimbra version or fork.

Cheers,
Mat

@matidau matidau linked a pull request May 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants