Re: [PHP] Re: Think I found a PHP bug
This is fixed in PHP 5.4 by completely dropping support for the TZ environment variable. PHP will always use UTC unless you explicitly set it to something. It won't matter which timezone the system is running in. This is the only reliable way to always have consistent behaviour across all environments. -Rasmus On 12/06/2011 04:46 PM, Patricia Dewald wrote: > > In OpenSuSE 12.1 i can reproduce this issue. > > My workaround is to check the correct timezone. > > On Tue, 15 Nov 2011 23:34:18 +0100, Geoff Shang > wrote: > >> Hi, >> >> A couple of weeks ago, I discovered what I'm pretty sure is a PHP bug. >> In addition, I looked in the PHP changelog and I haven't seen any >> mention of a fix for it. >> >> I'm writing here because I was wondering if anyone else can confirm it >> and what to do about it. >> >> The bug is that if a server's timezone is set to Europe/London and you >> don't set an explicit timezone in your script, if it's winter time in >> the UK, PHP thinks the timezone is UTC instead of Europe/London. >> >> Example: >> >> First, lets confirm that the system time is in fact set to Europe/London. >> >> $ cmp --verbose /etc/localtime /usr/share/zoneinfo/Europe/London >> $ echo $? >> 0 >> >> Now lets see what PHP thinks it is. >> >> $ php -r 'echo date_default_timezone_get();' >> UTC >> >> What about if we set it in the environment? >> >> $ export TZ=Europe/London >> $ php -r 'echo date_default_timezone_get();' >> Europe/London >> >> OK, so we appear to have an issue. But is this just semantics? Well >> no. consider the following (with TZ once again unset): >> >> $ php -r 'echo date ("r", strtotime ("1 July 2011 12:00 pm"' >> Fri, 01 Jul 2011 12:00:00 + >> >> But of course, Europe/London isn't on + in July. >> >> $ export TZ=Europe/London >> $ php -r 'echo date ("r", strtotime ("1 July 2011 12:00 pm"));' >> Fri, 01 Jul 2011 12:00:00 +0100 >> >> The problem comes in when we view times created in one and printed in >> the other: >> >> $ unset TZ >> $ php -r 'echo strtotime ("1 July 2011 12:00 pm");' >> 1309521600 >> $ export TZ=Europe/London >> $ php -r 'echo date ("r", 1309521600);' >> Fri, 01 Jul 2011 13:00:00 +0100 >> >> And the opposite: >> >> $ export TZ=Europe/London >> $ php -r 'echo strtotime ("1 July 2011 12:00 pm");' >> 1309518000 >> $ unset TZ >> $ php -r 'echo date ("r", 1309518000);' >> Fri, 01 Jul 2011 11:00:00 + >> >> This last one is what led me to discover this bug. We use automation >> software to run our Internet radio station. The playout system is >> written in C and the web front-end is written in PHP, with the data >> they work on the only point of commonality between them. The station >> was set up during the European summer. When the clocks changed, the >> playout system coped but the PHP front-end was showing everything an >> hour out. >> >> Now of course, I personally can force the front-end to use >> Europe/London and it will work for me. And I guess ultimately it >> would make sense to program the system to allow the user to specify a >> timezone rather than relying on the server default. But right now it >> doesn't, and any solution would need to take the playout system into >> account. >> >> At any rate, none of this is the point. If you're using the system >> default timezone, you expect it to (a) be correct and (b) be consistant. >> >> Note that this bug may affect other timezones which are on UTC durin >> the winter or summer, but I've not tested any other timezones as this >> would mean changing the system timezone and I'm not real keen on doing >> that on any of my systems. >> >> This bug was found on a Debian Squeeze system running the following >> version of PHP: >> >> PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 >> 08:24:40) >> Copyright (c) 1997-2009 The PHP Group >> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies >> >> I realise this is 5.3.3 and that 5.3.8 is now out. It's possible that >> this has been fixed but I could not find any traces of such a fix in >> the changelogs. >> >> I'd be interested to know if anyone else can confirm this bug and, if >> confirmed, what I should do about it. >> >> Thanks, >> Geoff. >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOS CLI?
On Thu, Dec 8, 2011 at 7:16 AM, Richard Quadling wrote: > On 2 December 2011 21:00, Matt Neimeyer wrote: >> Is there (or is there a way to compile) a DOS CLI version of a fairly >> recent version of PHP? I have not been able to find one using the >> powers of Google. > > You are pretty much stuck with no network services, limited memory and > restricted extensions. > > Can you describe your project and to why it MUST run on such an ancient OS? We have a utility disk that we use for a variety of things where I work and some of them are DOS based. We use the purely DOS ones rarely enough these days that people have trouble remembering how to use them. I wanted to see if it would be possible to write a menu type front end that would detect what OS it is running under and present the tools and options that are suitable for that OS. My thought was to use PHP because it is cross platform (to some degree) and then in theory the disk could be run under anything that can run PHP and anything that would run under the current OS can then be presented to the end user. If there is a better solution than PHP I'm open to it, but I already know PHP so I figured that would make it easier. Basically I need to be able to present a menu to the end user so they can select the tool they want to run. We currently have tool disks for DOS, Windows and OSX. If I could combine them into one big disk/usb key I would be a hero around these parts. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for PHP/JS/MySQL gurus in the Northern VA area
> -Original Message- > From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of > Daniel Brown > Sent: Thursday, December 08, 2011 1:27 PM > To: Rob Gould > Cc: php-general@lists.php.net > Subject: Re: [PHP] Looking for PHP/JS/MySQL gurus in the Northern VA area > > On Wed, Dec 7, 2011 at 23:11, Rob Gould wrote: > > Can anyone tell me if there are folks on this list in the Northern VA area? I > need to find a freelancer who knows PHP, Javascript, and mySQL. My client > likes face-to-face meetings on occasion, so I really need someone local. > > None of the older regulars here are from the area (I'm probably closest, up > in Scranton), but one of the newer folks may be. [>] I'm closer. :0) I'm in Philly and my graphic designer/advertising guy is in DC and could meet the client. Marc Hall HallMarc Websites www.HallMarcWebsites.com 610-446-3346 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for PHP/JS/MySQL gurus in the Northern VA area
On Wed, Dec 7, 2011 at 23:11, Rob Gould wrote: > Can anyone tell me if there are folks on this list in the Northern VA area? > I need to find a freelancer who knows PHP, Javascript, and mySQL. My client > likes face-to-face meetings on occasion, so I really need someone local. None of the older regulars here are from the area (I'm probably closest, up in Scranton), but one of the newer folks may be. Plus, since this will be archived throughout literally hundreds (thousands?) of places on the Internet, you may wind up getting a ping-back from elsewhere. In the meantime, have you tried CraigsList to at least get a few leads? -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP problems
Sent from a handheld device On 08-Dec-2011, at 11:14 PM, "Dominik Halvoník" wrote: > Hello, > > I would like to ask you for help. This days I am trying to build one of my > applications. But I have problem which stopped me. I have folder whit php > files like connect.php, delete.php etc. These files contains classes named > the same as files. So in file connect.php is class Connect. These files are > placed in folder named mysql and this folder is inside folder named db. In > folder db is a php file named mysql.php, in this file I include classes > from folder mysql, after include I declare class MySQL and in it I have > method __construct(). In this method I create dynamic objects from included > classes. And this is the problem that I can not solve, I have more then one > of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle] > etc.) and I need to include them to file called db.php that is in the main > folder of my app. In db.php is an class called db, how can I add classes > MySQL, Oracle etc. to class db? I try to use abstract class whit __set and > __get methods but I also need to include class db to main class > application. I am really sorry for my English, so please be indulgent. So I > need to connect classes like this: > This is where common design patters comes handy. Your problem can be solved by factory pattern. Create a static method connect on db class. Then call it like $db = DB::connect($db_type) Here the db type variable contains MySQL or oracle. In connect static method you implement the logic on how to connect that specific database. In the connect method you can also take db credentials like username and password. Google "php design pattern" to know more. > application->db->mysql->connect, but I can not use extends because in php > you can have only one parent class. The reason why I am trying to do > something like this is because I want to call methods like this: > $test = new application(); > $test->db->connect(); > > If it is mysql or othet database I set in config.php file. Can you help my > please? > > Sincerely, > > Dominik Halvonik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP problems
On 8 Dec 2011, at 17:14, Dominik Halvoník wrote: > I would like to ask you for help. This days I am trying to build one of my > applications. But I have problem which stopped me. I have folder whit php > files like connect.php, delete.php etc. These files contains classes named > the same as files. So in file connect.php is class Connect. These files are > placed in folder named mysql and this folder is inside folder named db. In > folder db is a php file named mysql.php, in this file I include classes > from folder mysql, after include I declare class MySQL and in it I have > method __construct(). In this method I create dynamic objects from included > classes. And this is the problem that I can not solve, I have more then one > of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle] > etc.) and I need to include them to file called db.php that is in the main > folder of my app. In db.php is an class called db, how can I add classes > MySQL, Oracle etc. to class db? I try to use abstract class whit __set and > __get methods but I also need to include class db to main class > application. I am really sorry for my English, so please be indulgent. So I > need to connect classes like this: > > application->db->mysql->connect, but I can not use extends because in php > you can have only one parent class. The reason why I am trying to do > something like this is because I want to call methods like this: > $test = new application(); > $test->db->connect(); > > If it is mysql or othet database I set in config.php file. Can you help my > please? You don't say what the db class (in db.php) itself does other than wrapping the database-specific classes, so I've assumed it doesn't do anything. If it does do more then simply have the mysql, oracle, etc classes extend db. I've also assumed that the application doesn't need to support multiple database types simultaneously. class application { public $db = null; function __construct($db = 'mysql') { require __DIR__.'/db/'.$db.'.php'; $this->db = new MySQL(); } } $test = new application('mysql'); $test->db->connect(); -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OOP problems
Hello, I would like to ask you for help. This days I am trying to build one of my applications. But I have problem which stopped me. I have folder whit php files like connect.php, delete.php etc. These files contains classes named the same as files. So in file connect.php is class Connect. These files are placed in folder named mysql and this folder is inside folder named db. In folder db is a php file named mysql.php, in this file I include classes from folder mysql, after include I declare class MySQL and in it I have method __construct(). In this method I create dynamic objects from included classes. And this is the problem that I can not solve, I have more then one of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle] etc.) and I need to include them to file called db.php that is in the main folder of my app. In db.php is an class called db, how can I add classes MySQL, Oracle etc. to class db? I try to use abstract class whit __set and __get methods but I also need to include class db to main class application. I am really sorry for my English, so please be indulgent. So I need to connect classes like this: application->db->mysql->connect, but I can not use extends because in php you can have only one parent class. The reason why I am trying to do something like this is because I want to call methods like this: $test = new application(); $test->db->connect(); If it is mysql or othet database I set in config.php file. Can you help my please? Sincerely, Dominik Halvonik
Re: [PHP] inotify
Not to my knowledge. On 11-12-08 10:52 AM, Floyd Resler wrote: Is there any way to get who moved a file, deleted a file, etc. from inotify? I search and couldn't find a way but thought someone on the list might know. Thanks! Floyd -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] inotify
Is there any way to get who moved a file, deleted a file, etc. from inotify? I search and couldn't find a way but thought someone on the list might know. Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOS CLI?
On 2 December 2011 21:00, Matt Neimeyer wrote: > Is there (or is there a way to compile) a DOS CLI version of a fairly > recent version of PHP? I have not been able to find one using the > powers of Google. > > Not a Windows Command Prompt CLI but an actual CLI version of PHP that > can be made to run in a real DOS environment? > > I'm sure I could find another scripting language for DOS but to > prototype this project I'd like to not have to learn a new language as > well. :) > > Thanks in advance for ANY suggestions. > > Matt According to http://en.wikipedia.org/wiki/MSDOS#Versions, the last retail version of DOS would be V6.22, though V7.1 was the last one to be used as a Windows loader. But I have no idea what compiler could be used. MSDOS has no built in network support, so advanced memory management, etc. Not without having to load additional drivers and the TCP/IP drivers for MS DOS are not tiny. Sure, you really can (and I have) cram then into upper memory, but it is on a motherboard by motherboard basis - one size does not fit all. All of these things would severely cripple PHP's usage in a true MSDOS environment. Add to that, the vast majority of libraries will be talking to the windows api in some form and that doesn't exist. You are pretty much stuck with no network services, limited memory and restricted extensions. Can you describe your project and to why it MUST run on such an ancient OS? OOI, Using something like DosBox [1] can help with some development - a DOS emulator for Windows. I use it to run REALLY old games. Richard. [1] http://www.dosbox.com/ -- Richard Quadling Twitter : EE : Zend : PHPDoc : Fantasy Shopper @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea : fan.sh/6/370 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php