Bug #10136

Localisation class possibly not properly initialised

Added by Christian Lerrahn almost 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-10-07
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:I18n
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 13
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

The context this bug occurs in is one of a manually validated object. The code is

$validator = $this->validatorResolver->getBaseValidatorConjunction('F3\Package\Domain\Model\Asset');
if ($validator->isValid($currentAsset)) {...

This results in an exception
#1: Catchable Fatal Error: Argument 2 passed to F3\FLOW3\I18n\Parser\NumberParser::parseDecimalNumber() must be an instance of F3\FLOW3\I18n\Locale, null given,...

If I'm not mistaken the class is never properly initialised. The initialize() method is supposed to create the object which is NULL here but fails to do so.


Related issues

related to TYPO3.Flow - Bug #10205: Object initialization is misused in I18n Resolved 2010-10-11
related to TYPO3.Flow - Bug #10206: Cache handling is broken in I18n Resolved 2010-10-11

Associated revisions

Revision c41011de
Added by Karsten Dambekalns almost 5 years ago

[+BUGFIX] FLOW3 (I18n): Fix and activate I18n component

This change activates I18n initialization in the Bootstrap class and
fixes object initialization. The use of caches has been reorganized and
some more small issues have been found and fixed.

Change-Id: I0ff2806288e3dc8c986cc9e0fbcd07a9256301e6
Fixes: #10136
Fixes: #10205
Fixes: #10206

History

#1 Updated by Karsten Dambekalns almost 5 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Karsten Dambekalns

True, the I18n system is not yet activated during bootstrap. You seem to be using some validator that relies on I18n - didn't ever think about that being used although I18n is not active. :)

Could you try activating it in Bootstrap.php and see if everything works as expected then?

#2 Updated by Karsten Dambekalns almost 5 years ago

  • Target version deleted (1.0 alpha 12)

Karsten Dambekalns wrote:

Could you try activating it in Bootstrap.php and see if everything works as expected then?

Remove the comment in initializeLocale() - and if you do, make sure all active packages have a Resources folder (can be empty). It fails otherwise...

#3 Updated by Christian Lerrahn almost 5 years ago

I tried what you suggested and it only gets me there half-way, I suspect. I now see an exception

RecursiveDirectoryIterator::__construct(resource://Party/): failed to open dir: "\F3\FLOW3\Resource\Streams\StreamWrapperAdapter::dir_opendir" call failed

even though there is only one package installed which has a Resources folder.

The line
$directoryIterator = new \RecursiveDirectoryIterator($this->localeBasePath . $activePackage->getPackageKey() . '/');

also seems to suggest that this path should be different because "Party" is not the package name. But maybe I'm wrong about that...

#4 Updated by Karsten Dambekalns almost 5 years ago

Christian Lerrahn wrote:

I tried what you suggested and it only gets me there half-way, I suspect. I now see an exception

RecursiveDirectoryIterator::__construct(resource://Party/): failed to open dir: "\F3\FLOW3\Resource\Streams\StreamWrapperAdapter::dir_opendir" call failed

even though there is only one package installed which has a Resources folder.

No, the Party package also has no Resources folder, simply add an empty one.

The line
$directoryIterator = new \RecursiveDirectoryIterator($this->localeBasePath . $activePackage->getPackageKey() . '/');
also seems to suggest that this path should be different because "Party" is not the package name. But maybe I'm wrong about that...

Party is a package in the Framework, that's fine.

#5 Updated by Christian Lerrahn almost 5 years ago

Well, this does solve the problem at this point but the next exception I see still seems to be linked to localisation.

Tried to create instance of class F3\FLOW3\Cache\Frontend\VariableFrontend without passing constructor argument $identifier in Packages/Framework/FLOW3/Classes/I18n/Cldr/CldrRepository.php line 155.

This exception is triggered by the same validator. :( This is a simple Number validator in the model, only that I build the class validator manually because the input comes from a file. I'm a bit surprised that that would go wrong if everything is really supposed to work without localisation.

#6 Updated by Karsten Dambekalns almost 5 years ago

  • Status changed from Needs Feedback to Accepted
  • Target version set to 1.0 alpha 13

#7 Updated by Karsten Dambekalns almost 5 years ago

  • Status changed from Accepted to Under Review

#8 Updated by Karsten Dambekalns almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF