Posts Tagged ‘php’

h1

Doctrine 2 and Symfony 2 – ORA-01861: literal does not match format string

June 26, 2014

I am using Doctrine 2 and Symfony2 in a PHP application which queries an Oracle database.

Operations which filter on DateTime columns caused the following Exception to be thrown

 [Doctrine\DBAL\DBALException]
An exception occurred while executing 'SELECT ... with params ["1970-01-01 01:00:01", "2014-06-26 15:43:18"]:
ORA-01861: literal does not match format string

This error is Oracle telling you that the datetime parameter is in an unexpected format.

The fix is to put the following code into your app/config/config.yml file

services:
    oracle.listener:
        class: Doctrine\DBAL\Event\Listeners\OracleSessionInit
        tags:
            - { name: doctrine.event_listener, event: postConnect }

This appears to tell Doctrine to use the OracleSessionInit class when connecting.

ref: http://www.doctrine-project.org/jira/browse/DDC-2731

h1

Timing out PHP SOAP Calls

June 22, 2011

PHP has a bug when making SOAP calls over HTTPS. If the other end picks up but then does not send any data (as can happen if the SOAP server is behind a proxy or load balancer or the like) then its supposed to timeout after a specified amount of time. However, all current versions of PHP do not seem to allow this.

Thanks to Rob Ludwick for providing a workaround using CURL as the transport mechanism instead until PHP fix this. You can read about it on his blog here:
http://www.darqbyte.com/2009/10/21/timing-out-php-soap-calls

There is a PHP bug reported here for reference: http://bugs.php.net/bug.php?id=48524

h1

PHP Html Forms (QuickForm)

November 11, 2010

Good tutorial on using the QuickForm form builder and validator for PHP. This is used in Moodle.

http://www.midnighthax.com/quickform.php

h1

PHP XDebug not formatting var_dump

June 11, 2010

XDebug is a great tool for PHP developers which, amnogst other things, is supposed to make var_dumps() easier to read. On a new install of Ubuntu 10.4 though I couldn’t get it to work. I finally tracked the problem down to not having html_errors=On in /etc/php5/apache2/php.ini. Set it to on, restart apache and it works fine!