18591 Posts in 4875 Topics by 2285 members
General Questions
SilverStripe Forums » General Questions » File Upload on PHP 5.3.2
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 260 Views |
-
File Upload on PHP 5.3.2

30 November 2011 at 11:10am
Hi all,
I've come across a problem trying to upload files using the Files and Images page. It only seems to happen on this server which runs php 5.3.2.
Looking at the code in the snippet below it does appear to switch based on being above 5.1.3.
Is this a bug? I'm running git 2.4 branch.
[User Error] Uncaught ReflectionException: Class FileNameFilter does not have a constructor, so you cannot pass any constructor arguments
POST /admin/assets/UploadFormLine 90 in /var/www/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 }
TraceReflectionClass->newInstanceArgs(Array)
Line 90 of Object.php
Object::create(FileNameFilter)
Line 211 of Folder.php
Folder->addUploadToFolder(Array)
Line 258 of AssetAdmin.php
AssetAdmin->doUpload(Array,Form,SS_HTTPRequest)
Line 329 of Form.php
Form->httpSubmission(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 161 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(/admin/assets/UploadForm)
Line 128 of main.php -
Re: File Upload on PHP 5.3.2

15 March 2012 at 1:07pm
Hopefully you've already solved this but for anyone else that ends up here. It's a PHP bug - fixed in PHP 5.3.4
http://nz.php.net/ChangeLog-5.php#5.3.4
- Fixed bug #52854 (ReflectionClass::newInstanceArgs does not work for classes without constructors). (Johannes)
| 260 Views | ||
|
Page:
1
|
Go to Top |


