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

Editing a page fails with DateTime format problem. #59

Open
jimwhite opened this issue Sep 21, 2011 · 3 comments
Open

Editing a page fails with DateTime format problem. #59

jimwhite opened this issue Sep 21, 2011 · 3 comments

Comments

@jimwhite
Copy link

I've installed midgardmvc on Snow Leopard with the latest macports (PHP 5.3.8) and when I click "Edit" on a page the server quits with the exception:

Exception: DateTime::__construct(): Failed to parse time string (1999-05-18 14:40:01+86400) at position 22 (4): Unexpected character

I coded up what I thought would be a workaround in midgardmvc_helper_forms_field_datetime, but it does not appear to be involved.

                if (preg_match('/\+\d{5}$/', $value)) {
                    // Offset is in seconds.  Weird.  Convert it to RFC3339.
                    $offset = substr($value, -5);
                    $value = sprintf('%s%02d:%02d:%02d', substr($value, 0, -5), $offset/3600, ($offset/60) % 60, $offset % 60);
                }
                $value = DateTime::createFromFormat(DateTime::RFC3339, $value);            }
@jimwhite
Copy link
Author

I get this with xdebug.show_exception_trace=On:


localhost:8001 - - 21/Sep/2011:01:49:14 -0700 "GET /mgd:create/state/mgd%3Amidgardmvc_core_node/urn%3Auuid%3A2ca9af38e3c211e080bfaf162a6753a753a7/ HTTP/1.1" 200 246

Exception: DateTime::__construct(): Failed to parse time string (1999-05-18 14:40:01+86400) at position 22 (4): Unexpected character in /opt/local/lib/php/AiP/Handler/Daemonic.php on line 101

Call Stack:
    0.0002     632208   1. {main}() /Users/jim/Projects/PHP/midgard/midgardmvc_core/httpd/midgardmvc-root-appserv.php:0
    0.1409    2953664   2. AiP\Handler\Daemonic->serve() /Users/jim/Projects/PHP/midgard/midgardmvc_core/httpd/midgardmvc-root-appserv.php:9
    0.1409    2953664   3. AiP\Transport\Socket->loop() /opt/local/lib/php/AiP/Handler/Daemonic.php:64
   19.0143    5583688   4. call_user_func() /opt/local/lib/php/AiP/Transport/Socket.php:31
   19.0143    5583720   5. AiP\Handler\Daemonic->onRequest() /opt/local/lib/php/AiP/Transport/Socket.php:31
   19.0273    5703712   6. gc_collect_cycles() /opt/local/lib/php/AiP/Handler/Daemonic.php:101
[Exception] Exception: DateTime::__construct(): Failed to parse time string (1999-05-18 14:40:01+86400) at position 22 (4): Unexpected character

Program exited normally.

@jimwhite
Copy link
Author

And the error occurs not when I click "Edit" actually, but when I click in the text to set the edit point.

@jimwhite
Copy link
Author

Created a Gist with php.ini and phpinfo() about my setup.

https://gist.github.com/1234210

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

No branches or pull requests

1 participant