Exception raised in Zend_Locale_Format inside Zend_Validate_Date

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception raised in Zend_Locale_Format inside Zend_Validate_Date

Andrew Ballard
I am getting an exception during form validation on the production
site that does not happen on the development server:


failed to receive data from locale en

#0 C:\ZendFramework\library\1.9\Zend\Date.php(4573):
Zend_Locale_Format::getDateFormat('en')
#1 C:\ZendFramework\library\1.9\Zend\Validate\Date.php(156):
Zend_Date::isDate('2/12/2010', 'auto', 'en_US')
#2 C:\ZendFramework\library\1.9\Zend\Form\Element.php(1320):
Zend_Validate_Date->isValid('2/12/2010', NULL)
#3 \\wvusa109.wvu-ad.wvu.edu\web$\Intranet\lib\mysite\application\controllers\ReportController.php(487):
Zend_Form_Element->isValid('2/12/2010')
#4 C:\ZendFramework\library\1.9\Zend\Controller\Action.php(513):
ReportController->mailQueueSummaryAction()
#5 C:\ZendFramework\library\1.9\Zend\Controller\Dispatcher\Standard.php(289):
Zend_Controller_Action->dispatch('mailQueueSummar...')
#6 C:\ZendFramework\library\1.9\Zend\Controller\Front.php(946):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http))
#7 W:\Intranet\root\mysite\index.php(176): Zend_Controller_Front->dispatch()
#8 {main}



Both systems are running ZF 1.9.2. And should be pretty much
identical, but obviously something must be different between the two
systems. Can anyone give me an idea of what else to check to find out
why the production server is not working?


Here is the section of code that is having difficulty:

        $locale = new Zend_Locale('en_US');


        $form = new Zend_Form(array(
            'accept-charset' => 'utf-8',
            'id'     => 'date_search',
            'method' => 'get',
        ));

        $form->addPrefixPath('My_Form_Element_', 'My/Form/Element/',
Zend_Form::ELEMENT);

        $range_begin_date = $form->createElement('date', 'rangeBeginDate');
        $range_begin_date
            ->setLabel('From')
            ->setRequired(true);

        $range_begin_date->getValidator('date')->setLocale($locale);

        $range_end_date = $form->createElement('date', 'rangeEndDate');
        $range_end_date
            ->setLabel('To')
            ->setRequired(true);

        $range_end_date->getValidator('date')->setLocale($locale);


        $form
            ->addElement($range_begin_date)
            ->addElement($range_end_date)
            ->addElement('submit', 'Search');


        $today = date('n/j/Y');


        if (!$range_begin_date->isValid($request->getQuery($range_begin_date->getName(),
$today))) {  //   [<-------Line 487:]
            $range_begin_date->setValue($today);
        }
        if (!$range_end_date->isValid($request->getQuery($range_end_date->getName(),
$today))) {
            $range_end_date->setValue($today);
        }


My_Form_Element_Date is just a class that extends
Zend_Form_Element_Text and attaches a custom view handler that
generates the Javascript necessary for a calendar control.

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Exception raised in Zend_Locale_Format inside Zend_Validate_Date

Thomas Weidner
Seems like there are files missing or if there is no read-access on them.
In detail the file "en.xml" within Zend/Locale/Data can not be read.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "Andrew Ballard" <[hidden email]>
To: <[hidden email]>
Sent: Friday, February 12, 2010 5:49 PM
Subject: [fw-i18n] Exception raised in Zend_Locale_Format inside
Zend_Validate_Date


>I am getting an exception during form validation on the production
> site that does not happen on the development server:
>
>
> failed to receive data from locale en
>
> #0 C:\ZendFramework\library\1.9\Zend\Date.php(4573):
> Zend_Locale_Format::getDateFormat('en')
> #1 C:\ZendFramework\library\1.9\Zend\Validate\Date.php(156):
> Zend_Date::isDate('2/12/2010', 'auto', 'en_US')
> #2 C:\ZendFramework\library\1.9\Zend\Form\Element.php(1320):
> Zend_Validate_Date->isValid('2/12/2010', NULL)
> #3
> \\wvusa109.wvu-ad.wvu.edu\web$\Intranet\lib\mysite\application\controllers\ReportController.php(487):
> Zend_Form_Element->isValid('2/12/2010')
> #4 C:\ZendFramework\library\1.9\Zend\Controller\Action.php(513):
> ReportController->mailQueueSummaryAction()
> #5
> C:\ZendFramework\library\1.9\Zend\Controller\Dispatcher\Standard.php(289):
> Zend_Controller_Action->dispatch('mailQueueSummar...')
> #6 C:\ZendFramework\library\1.9\Zend\Controller\Front.php(946):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http))
> #7 W:\Intranet\root\mysite\index.php(176):
> Zend_Controller_Front->dispatch()
> #8 {main}
>
>
>
> Both systems are running ZF 1.9.2. And should be pretty much
> identical, but obviously something must be different between the two
> systems. Can anyone give me an idea of what else to check to find out
> why the production server is not working?
>
>
> Here is the section of code that is having difficulty:
>
>        $locale = new Zend_Locale('en_US');
>
>
>        $form = new Zend_Form(array(
>            'accept-charset' => 'utf-8',
>            'id'     => 'date_search',
>            'method' => 'get',
>        ));
>
>        $form->addPrefixPath('My_Form_Element_', 'My/Form/Element/',
> Zend_Form::ELEMENT);
>
>        $range_begin_date = $form->createElement('date', 'rangeBeginDate');
>        $range_begin_date
>            ->setLabel('From')
>            ->setRequired(true);
>
>        $range_begin_date->getValidator('date')->setLocale($locale);
>
>        $range_end_date = $form->createElement('date', 'rangeEndDate');
>        $range_end_date
>            ->setLabel('To')
>            ->setRequired(true);
>
>        $range_end_date->getValidator('date')->setLocale($locale);
>
>
>        $form
>            ->addElement($range_begin_date)
>            ->addElement($range_end_date)
>            ->addElement('submit', 'Search');
>
>
>        $today = date('n/j/Y');
>
>
>        if
> (!$range_begin_date->isValid($request->getQuery($range_begin_date->getName(),
> $today))) {  //   [<-------Line 487:]
>            $range_begin_date->setValue($today);
>        }
>        if
> (!$range_end_date->isValid($request->getQuery($range_end_date->getName(),
> $today))) {
>            $range_end_date->setValue($today);
>        }
>
>
> My_Form_Element_Date is just a class that extends
> Zend_Form_Element_Text and attaches a custom view handler that
> generates the Javascript necessary for a calendar control.
>
> Andrew

Reply | Threaded
Open this post in threaded view
|

Re: Exception raised in Zend_Locale_Format inside Zend_Validate_Date

Andrew Ballard
Thomas Weidner wrote
Seems like there are files missing or if there is no read-access on them.
In detail the file "en.xml" within Zend/Locale/Data can not be read.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
Since we occasionally do revision (as opposed to major/minor version) upgrades by simply overwriting the new version on the old, I had thought there might have been a stray file somewhere that needed to be deleted, and I thought the xml data files would be good candidates.

The framework on each of these systems is stored on a local drive that I don't have access to view, so I wrote a script that would iteratively read and copy the entire framework from each local drive to a network location that I could access. Comparing the two versions in WinMerge, there is not a single difference across the entire framework between what is being used on each system. I just looked at en.xml specifically, and it is in the files that were copied which means PHP should have no problems reading that file.

Andrew

Reply | Threaded
Open this post in threaded view
|

Re: Exception raised in Zend_Locale_Format inside Zend_Validate_Date

Andrew Ballard
In reply to this post by Andrew Ballard
On Fri, Feb 12, 2010 at 11:49 AM, Andrew Ballard <[hidden email]> wrote:

> I am getting an exception during form validation on the production
> site that does not happen on the development server:
>
>
> failed to receive data from locale en
>
> #0 C:\ZendFramework\library\1.9\Zend\Date.php(4573):
> Zend_Locale_Format::getDateFormat('en')
> #1 C:\ZendFramework\library\1.9\Zend\Validate\Date.php(156):
> Zend_Date::isDate('2/12/2010', 'auto', 'en_US')
> #2 C:\ZendFramework\library\1.9\Zend\Form\Element.php(1320):
> Zend_Validate_Date->isValid('2/12/2010', NULL)
> #3 \\wvusa109.wvu-ad.wvu.edu\web$\Intranet\lib\mysite\application\controllers\ReportController.php(487):
> Zend_Form_Element->isValid('2/12/2010')
> #4 C:\ZendFramework\library\1.9\Zend\Controller\Action.php(513):
> ReportController->mailQueueSummaryAction()
> #5 C:\ZendFramework\library\1.9\Zend\Controller\Dispatcher\Standard.php(289):
> Zend_Controller_Action->dispatch('mailQueueSummar...')
> #6 C:\ZendFramework\library\1.9\Zend\Controller\Front.php(946):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http))
> #7 W:\Intranet\root\mysite\index.php(176): Zend_Controller_Front->dispatch()
> #8 {main}
>
>
>
> Both systems are running ZF 1.9.2. And should be pretty much
> identical, but obviously something must be different between the two
> systems. Can anyone give me an idea of what else to check to find out
> why the production server is not working?
>
>
> Here is the section of code that is having difficulty:
>
>        $locale = new Zend_Locale('en_US');
>
>
>        $form = new Zend_Form(array(
>            'accept-charset' => 'utf-8',
>            'id'     => 'date_search',
>            'method' => 'get',
>        ));
>
>        $form->addPrefixPath('My_Form_Element_', 'My/Form/Element/',
> Zend_Form::ELEMENT);
>
>        $range_begin_date = $form->createElement('date', 'rangeBeginDate');
>        $range_begin_date
>            ->setLabel('From')
>            ->setRequired(true);
>
>        $range_begin_date->getValidator('date')->setLocale($locale);
>
>        $range_end_date = $form->createElement('date', 'rangeEndDate');
>        $range_end_date
>            ->setLabel('To')
>            ->setRequired(true);
>
>        $range_end_date->getValidator('date')->setLocale($locale);
>
>
>        $form
>            ->addElement($range_begin_date)
>            ->addElement($range_end_date)
>            ->addElement('submit', 'Search');
>
>
>        $today = date('n/j/Y');
>
>
>        if (!$range_begin_date->isValid($request->getQuery($range_begin_date->getName(),
> $today))) {  //   [<-------Line 487:]
>            $range_begin_date->setValue($today);
>        }
>        if (!$range_end_date->isValid($request->getQuery($range_end_date->getName(),
> $today))) {
>            $range_end_date->setValue($today);
>        }
>
>
> My_Form_Element_Date is just a class that extends
> Zend_Form_Element_Text and attaches a custom view handler that
> generates the Javascript necessary for a calendar control.
>
> Andrew
>

To follow up, I don't have a definitive answer but the problem appears
to be related to the cached locale files. When I disabled the
Zend_Locale cache, the problem went away. I cleaned the cache and
re-enabled it, and it seems to work OK now.

Andrew