Closed (fixed)
Project:
Date
Version:
6.x-2.6
Component:
PHP4 Module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Aug 2010 at 09:15 UTC
Updated:
7 Jan 2011 at 12:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bettibio commentedComment #2
arlinsandbulte commentedTry the 2010-Aug-14 -dev version of Date once it becomes available.
A change made here (http://drupal.org/node/802046) was rolled back due to some critical errors (although it was not a wsod, as you report, so your issue might be different).
Comment #3
karens commentedA wsod can be from any error, so it is possibly this error. If you can get to your logs you can check, but as Arlin says, try the latest code to see if that takes care of things.
Comment #4
karens commentedI just rolled a new 2.x-2.6 release. Please try that one.
Comment #5
bettibio commentedI have try but the site goto wsod again. In error log i found this "PHP Fatal error: Class 'DateTime' not found in /sites/all/modules/date/date_api.module on line 656".
Comment #6
Anonymous (not verified) commentedAfter an update to date version 2.6 I had a WSOD.
The message (I got this after enabling error reporting in index.php):
Fatal error: Class 'DateTime' not found in /sites/all/modules/date/date_api.module on line 656
Hope this informs
Edit: return to the dev-module version of 2009/09/16 resolved this issue form my 2 sites
Comment #7
arlinsandbulte commentedI updated from Date 2.4 to 2.6 without issue.
Drupal 6.19
PHP 5.2.11
What data type are your fields? I was using "Date"
Comment #8
bettibio commentedI have mistake in previous reply. I've also updated from 2.4 to 2.6
Drupal 6.19
PHP 5.1.6
but I still have wsod, if I load old version the site run.
Comment #9
arlinsandbulte commented@bettibio:
What is the Date Field type that your are using?
When you created the date field, you had a choice of Date, Datetime, or Datestamp.
Comment #10
bettibio commentedI use Date, see attachment
Comment #11
karens commentedAre you using PHP4 or PHP5? I am guessing PHP4. If so, I know what the problem is and it will only affect people using PHP4. We added a check for a valid date object and PHP4 has no idea of date objects. Running on PHP 4 is highly discouraged, there are numerous problems with PHP4. But so far we have not said we won't support it, so I need to check.
Comment #12
arlinsandbulte commentedAha! Yep, I can confirm that the update to Date 2.6 results in a wsod with the same error noted in #6 *when using a PHP version less than 5.2 & with the PHP4 module enabled*.
Starting with a PHP 5.1.6 / Apache 2.0.58 server:
Installing Drupal 6.19 & Date 2.4 (& enabling the PHP4 submodule of date), all seems OK. I added a date field to story & created a new story node.
Then, after update to Date 2.6 wsod and same error message is displayed.
So, looks like Karen is exactly right and this will only affect those using the PHP4 module.
Personally, I am in favor of dropping support for PHP4. It has been a source of many problems and could simplify support greatly. Those who still need to use PHP4 would just be limited to use Date 2.4 or earlier.
BUT, others like bettibio might disagree, and I can respect that.
(just a thought: maybe we could add a Date 3.x branch that drops PHP4. That way, the 2.x branch could continue to support PHP4 with limited bug-fix only support... just thinking out loud.)
Comment #13
bettibio commentedI am newbie but I know how to read
Comment #14
arlinsandbulte commentedCross-post...
And to clarify the PHP4 thing a little (it is sort of misleading):
Actually, the issue is not PHP4, but rather anything before PHP5.2.
If you are using a version of PHP earlier than 5.2, the PHP4 module should be enabled to provide some wrapper date functions missing in those versions.
So, as I confirmed above, the root cause of your wsod issue *IS* your version of PHP.
The easiest fix for this issue right now would be to update your version of PHP to 5.2 (at least from the date module maintainer's viewpoint :-). I am using PHP 5.2.11.
Or, perhaps, a solution can be found to satisfy both older & newer versions of PHP (you'll have to wait for a patch & commit & release)
Comment #15
bettibio commentedthanks to the availability, waiting for solution I have already made a request to my hosting provider.
Comment #16
karens commentedI'm going to flag this as a PHP version issue.
Comment #17
Durrok commentedAnother confirmation, running PHP 5.1.6 with the PHP 4 module enabled. WSODs on any of my calendar views.
Comment #18
recoil commentedDitto on PHP 5.1.6. 6.x-2.4 works but 2.6 gives me a WSOD.
Comment #19
Peel commentedSubscribing.
Same issue with running under PHP 5.1.6 and PHP 4 enabled.
Rolling back to version 6.x-2.4 for now until a solution becomes available.
In the meantime, is it possible to add a note to the project description that builds over 2.4 require 5.2 or higher?
Comment #20
arlinsandbulte commentedRenaming for clarification.
Note, if you are running PHP5.2+ Date 6.2.6 should work properly (without the date_php4 module, which should be disabled).
Comment #21
Durrok commentedI'm kinda curious as to why the major version wasn't bumped up when the jquery ui library became mandatory. 6.x-2.4 could have been "legacy support" for us unfortunate souls stuck on older versions of php and 6.x-3.0(& 3.1) could have continued on. Certainly would have given me pause before updating. You don't expect major changes like this from a patch version.
Comment #22
jayelless commentedI have had this same problem with a pair of "date_make_date" and "date_format_date" functions.
The function "date_create" in date_php4.inc (called from "date_make_date") creates a date object of class "StdClass", while the function "date_format_date" in date_api.module requires a date object to have a class of "DateTime".
If you cannot upgrade to PHP 5.2 (which I can't), the problem can be resolved by commenting out the test on lines 655 to 657 of date_api.module. While this is not good practice, it does allow continued operation, and should not have any additional side effects as the DateTime class does not exist prior to PHP 5.2 (I guess it could be defined if PHP 5.0 or 5.1 are being used).
Comment #23
awasson commentedI can't thank you enough for your post. Fantastically simple solution!
Cheers,
Andrew
Comment #24
Durrok commentedThanks jlscott, that worked great. A more permanent solution would be to have it check the php version as well, something like:
Comment #25
davepotts commentedJust chiming in with more thanks jlscott...
Our server admin isn't quite ready to upgrade to PHP 5.2 for whatever reason, so this will work!
Comment #26
arlinsandbulte commentedHere is a quick patch I made implementing #24.
This is probably not the technically correct way of fixing this error, but let's see if it works.
Comment #27
justindavis commentedWe are experiencing the same problem. We're running a stock RHEL 5.x system, with php 5.1.6.
As far as I've been able to determine, the WSOD is triggered only on our sites that are defining content types with Date CCK fields. The problem disappears after reverting to Date 2.4.
Comment #28
gazwal commentedsubscribing .... exactly the same problem as justindavis on my current projet with php 5.1.6
after enabling the module with php4 comp , loadind admin/settings/date-time gives a WSOD
Comment #29
manop commentedThank you jlscott. You really save my day.
Comment #30
llribas commentedSubscribing
Comment #31
allella commented#26 works around the problem for PHP 5.1.6 on RHEL and Date PHP4 module enabled.
Comment #32
lee20 commentedSubscribing. #26 worked for me as well.
Comment #33
marvil07 commentedI can confirm the problem on 5.1 at centos.
I'm not really sure about the proposed patch, since the usual way to deal with functions/classes not defined on a previous version is to define them on the legacy code, I mean on data_php4.
Marking as need work since I think that should be the way to fix it. Please correct me if I'm wrong.
At the php.net doc page there are some snippets trying to provide simple DateTime class for php < 5.2, I paste here one of them to avoid forgetting to check it.
Comment #34
guignonvI added the code from #33 to date_api.module (right after the "define" section at the beginning) and it appears to work correctly for me (I got my calendar back). Sorry I just have time to report it's working (no patch). :-S
Got:
Drupal 6.19
PHP 5.1.6
Apache/2.0.52 (CentOS)
Comment #35
marvil07 commentedThanks for trying it.
Moving again to php4 module component, since that's the place where we need to fix it, since recent versions already have the DateTime class
Comment #36
marvil07 commentedThis still needs work, but I attaching this to remember e where to start again.
Comment #37
mschaal commentedI had a problem with datetime in PHP 4.3.10-16, so I had to return to release 6.x-2.4 of the module as suggested and everything worked fine again. Thx a lot to bettibio.
Comment #38
Fogg commentedsubscribing
#33 works for me as well! Thanks!
Comment #39
rjl commentedWorking in same environment as #34, and I just added the code from #33 and can also report it to be working. No more WSOD on calender. No more WSOD on node pages (with cck date fields) and node lists (ie taxonomy pages). Thank you all very much.
Comment #40
rjl commentedI posted #39, and indeed I had no more WSOD, but all my dates were being formatted as 12/31/1969 - but the underlying data was correct. I did a little hunting around and it seemed that the data was being sent to the date_format_date function in the date_api.module. That function does the following check:
With the date_php4 module the DateTime class is not used, but rather just a standard object class. The class definition provided here in #33 does not work in this scenario. The date_php4 module appears to create the object with the necessary elements to produce the date. I changed the check in the code above to also check for the date_php4 module and I get no WSOD and my dates are now being formatted properly.
I was also able to remove the class def provided by #33 from the code. Not sure where else the DateTime object may be instantiated, need to research that more, but right now, everything seems to be working properly with just the additional if statement.
Comment #41
Fogg commentedConfirm #40!
I had the same issue, all dates where 1/1/1970. With the fix from #40 all is good again.
should be supply a patch for this?
Comment #42
polmaresma commentedSame scenario than #34 and worked for me!
Thank's for all.
Comment #43
paganwinter commentedsubscribe...
Comment #44
tomgf commentedsubscribe
Comment #45
kekkissubscribe
Comment #46
nehelek commented#40 worked perfect for me!
thanks
Comment #47
gianfrasoft commentedI couldn't create a node of a specific type (including date fileds).
The #34 was the solution.
Thanks.
Comment #48
shaneonabike commented+1 Pasting #34 worked ugg bad hack
Comment #49
jdelgama commented#34 works in my obsolete provider!
Server: Drupal 6.19 + PHP 5.1.6 + MySQL 5.0.77
Comment #50
isaac.niebeling commentedConfirmed that combining #33 and #40 worked for me (commenting out #33 after implementing #40 still left me with a WSOD).
Comment #51
coolreddy commentedSubscribing.
Comment #52
carn1x commentedsubscribing
Comment #53
guignonv#40 worked for me. Thanks.
Drupal 6.20 (fresh install)
MySQL 5.0.83
PHP 5.1.3RC4-dev (on restrictive website host (free.fr))
Comment #54
karens commentedFixed differently. We just need to use the available wrapper function date_make_date() which properly adapts to either PHP4 or PHP5.