Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime error in gitlist #175

Closed
genanr opened this issue Sep 20, 2012 · 14 comments
Closed

DateTime error in gitlist #175

genanr opened this issue Sep 20, 2012 · 14 comments

Comments

@genanr
Copy link

genanr commented Sep 20, 2012

I am getting the following when trying to view commits in gitlist.

Oops! DateTime::__construct() expects parameter 2 to be DateTimeZone, null given

@gfoster
Copy link

gfoster commented Sep 20, 2012

Have you set your timezone in your /etc/php.ini file?

-- Gary F.

On Sep 20, 2012, at 12:09 PM, genanr notifications@github.com wrote:

I am getting the following when trying to view commits in gitlist.

Oops! DateTime::__construct() expects parameter 2 to be DateTimeZone, null given


Reply to this email directly or view it on GitHub.

@pschirch
Copy link

Duplicate of #174

@genanr
Copy link
Author

genanr commented Sep 21, 2012

I did set the timezone in /etc/php5/cli/php.ini and my php version is 5.3.5-1ubuntu7.11. I had tried setting the timezone before I posted on here.

@pschirch
Copy link

Again, that issue has nothing to do with the timezone configuration in your php.ini. It is an PHP bug 52063 that is fixed in PHP 5.3.6.

@klaussilveira so it is necessary to set PHP version requirement for Gitlist from 5.3.3 to 5.3.6

@carwin
Copy link

carwin commented Oct 6, 2012

@pschirch is 99% correct, however my CentOS box was running PHP 5.3.3 so I upgraded to the latest 5.3, 5.3.17 -- the error persisted until I set the timezone in php.ini.

I mean really, that should be set anyway - but if you're tossing up a VM to play with, don't forget.

@DannyvdSluijs
Copy link
Collaborator

@pschirch I can confirm swell, having the same issue's

@christhomas
Copy link

I understand the idea of saying "you need to have all the latest versions in order to play with new toys" and I do it myself to a degree, however, I always temper my attitude to old versions of software with reality and that is that sometimes people can have 5.3.x but not 5.3.3 or whatever and if you're code only works on the highest, ultimate last version and without that version it will not run correctly, I feel the correct course is to come down from the high horse and contemplate another solution.

otherwise you are artificially limiting the usefulness of your software for some technical goal which most people cannot reach. All for the sake of simply choosing another solution which can expose your software to another double digit increase in potential users.

it's like ruby, sometimes packages are made with such high requirements, that I can't use them without hacking my server to bits and I won't do that for a piece of software, however installing some special consideration I will do, but making my server potentially unstable JUST for gitlist is just not going to happen.

so please come down from the high horse and fix this another way, one which lets people with earlier versions of 5.3.x use the software, there isn't really an excuse to say no, apart from technical purity just for the sake of it.

@sstok
Copy link
Contributor

sstok commented Nov 5, 2012

Anything lower then PHP 5.3.3 will simply not work. Silex which is used for Gitlist requires at least PHP 5.3.3 simply because any version lower then this will fail due to some serious bugs in those versions of php.
That is not something that can be fixed easily.

But the DateTime::__construct() expects parameter 2 to be DateTimeZone, null given bug can be easily fixed by checking what is passed to it and in case of null changing it to new \DateTimeZone(date_default_timezone_get())

@klaussilveira
Copy link
Owner

This has been fixed in latest master, both GitList and Gitter. Can someone having problems check it out?

@christhomas
Copy link

me! I downloaded the zip file, unpacked it, I'm missing the vendor directory, the last time I downloaded the zip, I had the vendor directory, is that on purpose?

@christhomas
Copy link

ok, maybe I've misunderstood you, but this issue isn't fixed if you download and install the master, the vendor directory is missing, I went and copied the vendor directory from the old version.

but even then I still have a problem....so lets try downloading gitter master and unpack it.......

yes, it works! the steps I followed were

  1. copy your old public_html to a public_html2 or something
  2. download master.zip, unzip it and replace your old version
  3. copy the vendor directory from the old public_html you renamed out of the way
  4. update all the permissions for any repositories, cache dir etc in the new installation
  5. copy your config.ini from the old version
  6. navigate to the vendor directory for gitter
  7. download gitter from github, the latest master, unpack it and replace the gitter from the old version

bingo, it works!

awesome! thanks klauss, I dont know if my comment inspired you to fix it rather than leave people behind, but I'm happy that it's fixed and working! awesome job!

@klaussilveira
Copy link
Owner

Have you downloaded the zip from the official website or GitHub? If you're downloading from GitHub, you won't get the correct "package" and you'll have to install the dependencies by yourself, through Composer. Follow the "developer" instructions to correctly setup GitList from a GitHub zip/tarball or a direct clone.

@christhomas
Copy link

ah, I didnt realise that, you are right I downloaded the first from the website, but then downloaded the update from github, I thought they were the same because it was the same master.zip file.

it's not broken now, it's working because I installed the vendor and gitter parts indepedantly

@ematthews
Copy link

If you are running a RHEL repo with the buggy PHP version, try this dirty hack to at least view the commit histories. Add _$timezone = new \DateTimeZone("UTC");_ right after the class definition to hard-code to UTC (or whatever other timezone you are happy with). It may not be pretty, but at least will get you by until your local repo gets updated to a later version of PHP.

/var/www/html/gitlist/vendor/klaussilveira/gitter/lib/Gitter/Util/DateTime.php:

public function __construct($time = 'now', DateTimeZone $timezone = null)
{
    $timezone = new \DateTimeZone("UTC");
    parent::__construct($time, $timezone);

    if ($this->isUnixTimestamp($time)) {
        if (!$timezone)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants