Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

ReflectionClass errors when using SS 2.4.7 on PHP5.4.2


Go to End
Reply


16 Posts   4260 Views

Avatar
vwd

Community Member, 160 Posts

1 October 2012 at 8:04pm

RE: the array to string conversion errors, this [url=https://github.com/silverstripe/sapphire/commit/840343f]patch[/url] might be useful. Not too nice having to patch bits and pieces to get things working but might be necessary especially when it's not viable to upgrade to SS3.0 and in a shared host situation where the PHP version is dictated to you.

VWD.

Avatar
vwd

Community Member, 160 Posts

1 October 2012 at 8:08pm

What's really strange about the errors I get on our dev server (running PHP 5.4.4) is that the errors (Notice] Array to string conversion) only show up when testing with Opera browsers (Mobile/Desktop). All other browsers (Safari, IE, Chrome, Firefox) seem to be OK.

I wonder what the Opera browsers are doing to invoke these errors?

VWD.

Avatar
Andre

Community Member, 126 Posts

10 November 2012 at 3:45am

Hi there,

I updated my Linux Box to Ubuntu 12.10 yesterday, which is running on PHP 5.4.6.

Now I'm running into the same Problems.

I tried a fresh Installation of SS 2.4.7 and 2.4.8 and both are running into the "string conversion error" within the installscript and showing up the "Uncaught ReflectionException" when trying to enter the Backend.

Anyone any new Idea, what needs to be fixed and how it can be fixed?

Avatar
Van

Administrator, 25 Posts

13 November 2012 at 11:59am

Are you sure your Reflection package is installed?

This link might be useful: https://groups.google.com/forum/?fromgroups=#!topic/bloggerdev/ykYZEJBz0lI

Hope that helps.

Avatar
Andre

Community Member, 126 Posts

29 November 2012 at 5:22am

Hi there,

I'm sure, that I have my Reflection Package installed.

Asking phpinfo on a Ubuntu 12.04 (with PHP 5.3.10) and 12.10 (with PHP 5.4.6) both times is showing me "Reflection enabled".

Again, here is the exact error that ist shown:

[User Error] Uncaught ReflectionException: Access to non-public constructor of class Transliterator
GET /~andre/ss248/dev/build?returnURL=%2F%7Eandre%2Fss248%2F

Line 90 in /home/andre/public_html/ss248/sapphire/core/Object.php

Source

81     * @param mixed $arguments,... arguments to pass to the constructor
82     * @return Object
83     */
84    public static function create() {
85       $args = func_get_args();
86       $class = self::getCustomClass(array_shift($args));
87       
88       if(version_compare(PHP_VERSION, '5.1.3', '>=')) {
89          $reflector = new ReflectionClass($class);
90          return $reflector->newInstanceArgs($args);
91       } else {
92          // we're using a PHP install that doesn't support ReflectionClass->newInstanceArgs()
93          
94          $args = $args + array_fill(0, 9, null);
95          return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
96       }
Trace

ReflectionClass->newInstanceArgs(Array)
Line 90 of Object.php
Object::create(Transliterator)
Line 1520 of SiteTree.php
SiteTree->generateURLSegment(About Us)
Line 1352 of SiteTree.php
SiteTree->onBeforeWrite()
Line 936 of DataObject.php
DataObject->write()
Line 1309 of SiteTree.php
SiteTree->requireDefaultRecords()
Line 235 of DatabaseAdmin.php
DatabaseAdmin->doBuild(1)
Line 99 of DatabaseAdmin.php
DatabaseAdmin->build(SS_HTTPRequest)
Line 193 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 134 of DevelopmentAdmin.php
DevelopmentAdmin->build(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 125 of Director.php
Director::direct(/dev/build)
Line 127 of main.php

Avatar
Andre

Community Member, 126 Posts

29 November 2012 at 5:42am

Don't know why that helped with my ReflectionException Problem, but here is one solution:

I deinstalled php5-apc and installed php5-xcache.

Now the reflection error is gone.

Avatar
Andre

Community Member, 126 Posts

29 November 2012 at 5:56am

I'm sorry, for everyone with the same error, hoping for a solution.

Nothing changed after apc to xcache switch. I was testing on the wrong installation.

So still the ReflectionExeption exists.

Avatar
simon_w

Forum Moderator, 474 Posts

29 November 2012 at 8:27am

This problem occurs because PHP 5.4 with the Intl extension from PECL includes a Transliterator class that conflicts with the one include with SilverStripe. There's a patch you can apply [url=https://github.com/silverstripe/sapphire/pull/977.diff]here[/url], or you can remove the intl extension if you're not using it.

Go to Top