RE: [fw-general] Zend_Cache + Tags + Expiry = Exceeding max execution time?
Check out my blog posts: http://www.yewchube.com/2009/03/zend_cache_backend_file-auto-clean-causing-problems/ http://www.yewchube.com/2009/04/zend_cache_backend_file-and-tag-based-cleaning/ Basically the cleaning process takes too long if you have a large number of cache entries. Metadata is not indexed so the cleaning process needs to open and check every single metadata file. Turn the auto cleaning off and use a cron job instead so your users are not impacted, or switch to memcache which cleans itself (remember to turn auto cleaning off here too). Cheers, Steven -Original Message- From: Colin Guthrie [mailto:gm...@colin.guthr.ie] Sent: Wednesday, 9 June 2010 11:28 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Cache + Tags + Expiry = Exceeding max execution time? Hi, I've not done much in the way of extensive testing in this regard but I figured I'd ask some questions and see if any other folks are in this situation. I've been developing a fairly extensive data denormalisation system which is based on Zend_Cache + the File backend. It makes use of Tags to ensure that the relevant bits of denormalised data are expired properly (lifetime is infinite). I'm only rolling this out minimally just now, but plan to take this *much* further in due course. The problem is, that I've had several errors in my log telling me that the maximum script execution time has been exceeded. This always happens in Zend/Cache/Backend/File.php on line 655, 659 or 962. This part of the file generally relates to the clean() method (i.e. called when deleting by tag). So my question is, how scalable is the tagging support in Zend Cache File? Currently I only have about 89megs of data in about 22k files (so about 11k cached items, bearing in mind that half the files are metadata). I suspect that when I roll out this denormalisation scheme more extensively, I'll have closer to a million files. Has anyone done any scalability tests on this? For my purposes, I'm happy to actually store the metadata regarding tags in a database table and expire the items based on that (so create a HybridFile.php backend of sorts - I have already created something similar to allow me to support tags with Memcache backend). Is this an approach that would scale better? Has anyone done anything similar to this? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Would anyone want Zend_VersionControl_Subversion?
For fun, I began experimenting with putting together a PHP implementation of a Subversion client that uses the svn protocol and thought it might be a useful addition to ZF. Bill Karwin pointed out that a PECL extension already exists to provide this functionality, though the documentation is filled with warnings about it being experimental. I suggest that it is possible in some hosting environments that developers won't have the PECL extension installed and may not be able to install it. Some uses for such a module include: 1. Deployment - code can be installed or updated using PHP code 2. Repository browsing - for tools such as bug/issue trackers 3. Committing - for example if files can be changed in an admin area, the changes can be committed to the repository I think it should be possible to provide similar functionality for Git, Mercurial, and other version control systems. I have already started developing an adapter that uses the svn protocol, but others could be created that use SSH or LDAP/HTTP access, or the PECL extension. Would Zend_VersionControl_Subversion be useful or is it just a waste of time? Cheers, Steven
[fw-general] RE: [unsure] [fw-general] Zf.bat behaves weird
I believe zf.bat is a windows batch file, not meant to be run on linux From: Jigal sanders [mailto:jigalroe...@gmail.com] Sent: Monday, 22 February 2010 7:02 AM To: fw-general Subject: [unsure] [fw-general] Zf.bat behaves weird Hello everyone. I installend 1.10.1 but when I do on my linux machine: /var/www/nrka2/bin/zf.bat show version I get this error: var/www/nrka2/bin/zf.bat: line 1: @ECHO: command not found /var/www/nrka2/bin/zf.bat: line 2: REM: command not found /var/www/nrka2/bin/zf.bat: line 3: REM: command not found /var/www/nrka2/bin/zf.bat: line 4: REM: command not found /var/www/nrka2/bin/zf.bat: line 5: REM: command not found /var/www/nrka2/bin/zf.bat: line 6: REM: command not found /var/www/nrka2/bin/zf.bat: line 7: REM: command not found /var/www/nrka2/bin/zf.bat: line 8: REM: command not found /var/www/nrka2/bin/zf.bat: line 9: REM: command not found /var/www/nrka2/bin/zf.bat: line 10: REM: command not found /var/www/nrka2/bin/zf.bat: line 11: REM: command not found /var/www/nrka2/bin/zf.bat: line 12: REM: command not found /var/www/nrka2/bin/zf.bat: line 13: REM: command not found /var/www/nrka2/bin/zf.bat: line 14: REM: command not found /var/www/nrka2/bin/zf.bat: line 15: syntax error near unexpected token `(' /var/www/nrka2/bin/zf.bat: line 15: `REM Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)' What's wrong?
[fw-general] Public ZF repository with require_once calls excluded
Does anyone know of any public ZF repositories that have the require_once calls commented out or removed? I use these in every project to improve performance by using lazy loading. Would the ZF team object to me creating one? Would this violate the license? Cheers, Steven
[fw-general] Why does Zend_Json_Server check namespaces against a regex?
Hi all, I'm implemented a JSON-RPC server, but I've been snagged. The namespace I want to use starts with a number. This namespace does not pass the regular expressions that validate the namespaces in Zend_Json_Server_Smd_Service and Zend_Json_Server_Request, as a result the JSON-RPC server does not work. If I remove the regular expression checks the code all works fine. Given that namespaces starting with numbers are allowed in JSON-RPC, why are they being blocked in Zend_Json_Server? Please don't suggest that I use a different namespace, due to forces outside of my control this would be a major headache. Cheers, Steven
[fw-general] Why does Zend_Json_Server check namespaces against a regex?
- Sorry for the re-post...this came under a different thread in nabble Hi all, I'm implemented a JSON-RPC server, but I've been snagged. The namespace I want to use starts with a number. This namespace does not pass the regular expressions that validate the namespaces in Zend_Json_Server_Smd_Service and Zend_Json_Server_Request, as a result the JSON-RPC server does not work. If I remove the regular expression checks the code all works fine. Given that namespaces starting with numbers are allowed in JSON-RPC, why are they being blocked in Zend_Json_Server? Please don't suggest that I use a different namespace, due to forces outside of my control this would be a major headache. Cheers, Steven
[fw-general] 1.7.1 Zend_Controller_Request_Http Error
Hi guys, I am getting the following in ZF 1.7.1: Error Number: 2 Error Type: PHP WARNING Error String: strstr(): Empty delimiter. Error File: /path/to/my/site/library/Zend/Controller/Request/Http.php Error Line: 393 The line is: if (isset($_SERVER['HTTP_HOST']) strstr($requestUri, $_SERVER['HTTP_HOST'])) { I am running a PHP file from the command line, it has: $_SERVER['REQUEST_URI'] = '/transcode/'; $_SERVER['HTTP_HOST'] = ''; // Bootstrap code etc. etc. This worked in 1.7.0...should I change my code or should ZF be changed? Cheers, Steven
RE: [fw-general] Zend_Cache question
Hi Jack, From what I know the cache is cleaned automatically, you have no way to retrieve something that is cleaned to reset it later. This means you will have to handle this process yourself. I would suggest storing the result in a separate file so that if your request fails you can load from the file and store it back in cache. If the requests succeeds you can store the result in the file and in the cache. Cheers, Steven From: Jack Sleight [mailto:[EMAIL PROTECTED] Sent: Tuesday, 12 August 2008 2:41 AM To: Zend Framework General Subject: [fw-general] Zend_Cache question Hi, First of all, I don't really know how Zend_Cache works internally, so I'm making one (possibly incorrect) assumption, that expired items are not removed from the cache until they are requested via $cache-load(); Now, is the following possible, and if so how? * You have a cache set up where stored items expire after 24 hours * There is an item in the cache which was added 25 hours ago and originally came from a remote source * You make a request for the item, it has expired, so load() returns nothing * You make a request to the remote system for the latest data * If the request is successful the new data is added to the cache in the usual way * If the request is unsuccessful the old data that has now expired is reset to be valid for another 24 hours (or possibly less) I want to do this in order to ensure that there is never no data available. Is is possible? Thanks, -- Jack
RE: [fw-general] Zend Framework 1.5.3 is now available!
1.5.3 doesn't appear on the Zend CDN yet... -Original Message- From: Alexander Veremyev [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 July 2008 2:10 AM To: fw-general@lists.zend.com Subject: [fw-general] Zend Framework 1.5.3 is now available! Hi all, It is our pleasure to announce the release of Zend Framework 1.5.3! You can download this new mini release from the ZF download site: http://framework.zend.com/download A list of all issues resolved in this release can be found at: http://framework.zend.com/issues/secure/IssueNavigator.jspa?requestId=10 811 We couldn't have put this release together without the help of our generous Zend Framework community, so we here at Zend once again extend our thanks to everyone who contributed their time and effort to bring you the 1.5.3 release! With best regards, Alexander Veremyev.
RE: [fw-general] Zend Framework 1.6 Release Candidate 1 now available!
Hi Matthew, Extracted Dojo makes up 35.2MB of the total 57.9MB, leaving 22.6MB for the rest of the framework. 1.5.2 was 21.0MB, so I would say the Dojo addition is a large fraction. ZIP compressed the externals folder alone (which only contains Dojo) is 22.7MB, removing externals and recompressing leaves me with 6.37MB where 1.5.2 was 6.11MB. Will this stop me from using ZF? No, but it does concern me that future partnerships will add to the file size. Regards, Steven -Original Message- From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] Sent: Wednesday, 23 July 2008 10:16 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] Zend Framework 1.6 Release Candidate 1 now available! -- SiCo007 [EMAIL PROTECTED] wrote (on Wednesday, 23 July 2008, 04:58 AM -0700): Just a quick question why has the file size jumped from 6mb to 26?! Well, for one, there are a ton of new components, which means more code, more tests, and more documentation. As you also note, Dojo is shipping with ZF now, which also boosts the size some (though the Dojo repo is fraction of ZF's size). Can have a download (of the final release) without dojo (assuming that's the culprit) for those of us that don't use it? We have been discussing shipping a lean-and-mean distribution that does not include documentation, tests, dojo, or the localization files (the i18n/l10n files account for a large percentage of the distro). I'm not sure how soon we will be doing this, but it _has_ been on our radar for some time. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
RE: [fw-general] Zend_Session Unit Testing
You can get around it using output buffers in the test suite but it's a bit of a hassle and disrupts the output a bit, a mock object would be much better. I hope Matthew has a solution, can't wait for it! -Original Message- From: Karol Grecki [mailto:[EMAIL PROTECTED] Sent: Thursday, 19 June 2008 6:55 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Session Unit Testing Jason It happens because information about executed tests printed on screen is treated by Zend_Session as borwser output and it will throw an exception. It could probably be fixed by changing it to detect if it's run on command line and skip this check. Cheers Jason Webster wrote: Just a shot in the dark, but you may want to check (or preferably remove) all PHP closing tags at the end of your files. This is a highly recommended practice, and 90% of the time fixes these types of errors. Keith Pope wrote: Hi, How do you setup zend_session to run in PHPUnit Suite, I keep getting output before session start exceptions? Sorry if I have missed something obvious the docs are a bit unclear. Thx Keith Pope Web Developer -- allpay.net Limited, Fortis et Fides, Whitestone Business Park, Whitestone, Hereford, HR1 3SE. Registered in England No. 02933191. UK VAT Reg. No. 666 9148 88. Telephone: 0870 243 3434, Fax: 0870 243 6041. Website: www.allpay.net Email: [EMAIL PROTECTED] This email, and any files transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error please notify the allpay.net Information Security Manager at the number above. -- View this message in context: http://www.nabble.com/Zend_Form---Validation-of-field-with-same-name-as-the- form-gives-problems-tp17935684p18000358.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend Framework Stop Working after PHP upgrade to 5.2.6 - URGENT
If I'm not mistaken there may have also been some changes in 1.5 to the way URLs are interpreted...something about the way camel case URLs are treated...this could be causing your actions errors. -Original Message- From: ashish.sharma [mailto:[EMAIL PROTECTED] Sent: Tuesday, 10 June 2008 5:34 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] Zend Framework Stop Working after PHP upgrade to 5.2.6 - URGENT Thanks Jordan. Can you refer some URL from where I can checkout the changes done in ZF-1.5.2 as you have mentioned that Zend_Db_Table_Abstract had major changes in the 1.5 release. Also, could you please let me know the correct procedure to upgrade the system. This is what I am not getting. I agree that the SQL issue can be related to the changes in Zend_Db_Table_Abstract class BUT why it is also showing errors in ACTIONS .. any idea? Thanks Ashish Jordan Moore wrote: Also... I'd highly recommend against upgrading so many components at once. It's almost always a bad idea. On Mon, Jun 9, 2008 at 11:43 PM, ashish.sharma [EMAIL PROTECTED] wrote: Thanks Simon, Here I would like add one more thing which I have missed in my previous posts (and I apologize for that) we had also upgraded our ZF to ZF-1.03 to ZF-1.5.2 I think this is causing the problem but I don't know why? Do you have any idea? As a temporary fix, we have re-install ZF-1.03 on our server and the site is now working again. Do you have any idea as why it was not working on ZF 1.5.2? Why it is showing errors in running queries also in actions? Thank you very mush for your time. Ashish Simon Mundy wrote: Hi Ashish I don't think your SQL problems can be attributed to the Apache configuration - can you compare the final SQL query from the 'old' server with the new? Is the 'fetchCount' called from within a model that extends Zend_Db_Table? Have you also run the query from within the database on the same machine to ensure there's nothing incorrect about the new setup in PHP? One sure fire way would be to install PHPUnit on your newer server and run the unit tests to see if it's a ZF problem or perhaps more related to the way your code extends it. Thanks for your Steven. Could you please explain as what exactly needs to be checked in Apache configuration. As far as the .htaccess file is concerned, it is same as ealier (no changes made in that). The most weird part which I am not getting is why the SQL query is not working now? The function .. public function fetchCount($cols = '*', $where = null) { $rowset = $this-fetchCols(new Zend_Db_Expr(sprintf('COUNT(%s) AS total_records', $cols)), $where); return (integer) $rowset-current()-total_records; } . .. is returning all the columns from the table and NOT the count only. Steven Brown-7 wrote: Check that your Apache configuration and .htaccess files are the same/correct -Original Message- From: ashish.sharma [mailto:[EMAIL PROTECTED] Sent: Tuesday, 10 June 2008 3:25 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend Framework Stop Working after PHP upgrade to 5.2.6 - URGENT Hello ALL, Yesterday we had upgraded our server to PHP 5.2.6 and after that our applications based on ZF1.0 are NOT WORKING. The sections which were working earlier are not working now and showing errors and warning. For example the count function to get the count of records from a table in showing an error saying Specified column total_records is not in the row here is the function code ... public function fetchCount($cols = '*', $where = null) { $rowset = $this-fetchCols(new Zend_Db_Expr(sprintf('COUNT(%s) AS total_records', $cols)), $where); return (integer) $rowset-current()-total_records; } The above code was working fine on LIVE server (running on LINUX) and it is still working fine on LOCAL systems (running on windows using XAMPP) but NOT on LIVE server now (after the upgrade). Also it starts showing errors like ... Could not found the requested action. Action getstates does not exist and was not trapped in __call() But this same code was working absolutely fine earlier (on LIVE server) and it is still working fine on our LOCAL systems (running on windows using XAMPP) FYI: Along with the PHP version upgrade we have recompiled PHP and Apache AND installed PEAR on our server. Kindly treat this as VERY URGENT and post your suggestion / reply ASAP. Thanks to all of you. Ashish -- View this message in context: http://www.nabble.com/Zend-Framework-Stop-Working-after-PHP-upgrade-to-5.2.6 ---URGENT-tp17748031p17748031.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Zend-Framework-Stop-Working-after-PHP-upgrade-to-5.2.6 ---URGENT-tp17748031p17748361.html Sent from the Zend Framework
RE: [fw-general] Zend Framework Stop Working after PHP upgrade to 5.2.6 - URGENT
Check that your Apache configuration and .htaccess files are the same/correct -Original Message- From: ashish.sharma [mailto:[EMAIL PROTECTED] Sent: Tuesday, 10 June 2008 3:25 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend Framework Stop Working after PHP upgrade to 5.2.6 - URGENT Hello ALL, Yesterday we had upgraded our server to PHP 5.2.6 and after that our applications based on ZF1.0 are NOT WORKING. The sections which were working earlier are not working now and showing errors and warning. For example the count function to get the count of records from a table in showing an error saying Specified column total_records is not in the row here is the function code ... public function fetchCount($cols = '*', $where = null) { $rowset = $this-fetchCols(new Zend_Db_Expr(sprintf('COUNT(%s) AS total_records', $cols)), $where); return (integer) $rowset-current()-total_records; } The above code was working fine on LIVE server (running on LINUX) and it is still working fine on LOCAL systems (running on windows using XAMPP) but NOT on LIVE server now (after the upgrade). Also it starts showing errors like ... Could not found the requested action. Action getstates does not exist and was not trapped in __call() But this same code was working absolutely fine earlier (on LIVE server) and it is still working fine on our LOCAL systems (running on windows using XAMPP) FYI: Along with the PHP version upgrade we have recompiled PHP and Apache AND installed PEAR on our server. Kindly treat this as VERY URGENT and post your suggestion / reply ASAP. Thanks to all of you. Ashish -- View this message in context: http://www.nabble.com/Zend-Framework-Stop-Working-after-PHP-upgrade-to-5.2.6 ---URGENT-tp17748031p17748031.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Unique Login and Password, All Applications
Hi Jose, I think in order to achieve this you need to run all of your logins through a single domain, once a login has been confirmed you set a cookie on a per-domain basis. You could pass around a session identifier and set cookies as the user goes from one domain to the next. If a user hits a domain without the session identifier you could pass them through the login domain (with details on where to send them back to) which will automatically detect if they are logged in and return the session identifier. You could likely include this login box using an iframe, the iframe could perform the login (or detect that they are logged in) through your central domain and redirect the parent window, or set a javascript variable, or call a javascript function. You cant achieve this through XHR since you cant call other domains. Cheers, Steven From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of José de Menezes Soares Neto Sent: Thursday, 8 May 2008 5:45 AM To: Zend Framework General Subject: [fw-general] Unique Login and Password, All Applications Hi Friends! I would like to construct all my applications base on one single account administration, like GOOGLE and YAHOO... at these sites, you can login into a service and use other services as well with a single account... I would like very much to discuss this with you guys! Suggestions? Regards, José
RE: [fw-general] New ZF site home page broken under Firefox/Debian
Yes I had issues on Firefox 2.0.0.12/Windows and had to refresh -Original Message- From: Ralph Schindler [mailto:[EMAIL PROTECTED] Sent: Tuesday, 18 March 2008 1:15 PM To: Mark Maynereid Cc: fw-general@lists.zend.com Subject: Re: [fw-general] New ZF site home page broken under Firefox/Debian Try holding down shift when you reload. It looks like the old stylesheet is loading perhaps? Let me know, -ralph Mark Maynereid wrote: Hi, The new ZF site's home page looks broken under Firefox 2.0.0.12 on Debian's stable 'etch' release. I have attached a screenshot. It also fails to validate for both XHTML and CSS. There is a site problems form on the page which I submitted, but I also wondered if I should raise an issue for this? Under no component perhaps? Sorry to bring a downer on it. I'm sure the new site looks great on Windows going by all the comments. Hope I can get to enjoy it too. Many thanks for 1.5 btw. I've been living on the trunk waiting for this day :) Regards, Mark
RE: [fw-general] Zend_PDF and Barcode
I imagine it would be something like drawing the lines yourself and setting the line width etc...? -Original Message- From: billyildirim [mailto:[EMAIL PROTECTED] Sent: Friday, 14 March 2008 10:11 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend_PDF and Barcode Hi there, I am pretty sure it is possible to put Barcode in PDF file using Zend_Pdf but I couldn't find any information about that. Can someone show me any tutorial about it? Thanks B -- View this message in context: http://www.nabble.com/Zend_PDF-and-Barcode-tp16048071s16154p16048071.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend_PDF and Barcode
Ah ofcourse, yeah well get a TTF and draw the barcode...couldn't be easier! -Original Message- From: troels knak-nielsen [mailto:[EMAIL PROTECTED] Sent: Friday, 14 March 2008 11:58 PM To: Steven Brown Cc: billyildirim; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_PDF and Barcode Not sure how Zend_PDF works, but drawing barcodes, can be done using a special font. Each number is the rendered as a different sequence of bars. -- troels On Fri, Mar 14, 2008 at 2:44 PM, Steven Brown [EMAIL PROTECTED] wrote: I imagine it would be something like drawing the lines yourself and setting the line width etc...? -Original Message- From: billyildirim [mailto:[EMAIL PROTECTED] Sent: Friday, 14 March 2008 10:11 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend_PDF and Barcode Hi there, I am pretty sure it is possible to put Barcode in PDF file using Zend_Pdf but I couldn't find any information about that. Can someone show me any tutorial about it? Thanks B -- View this message in context: http://www.nabble.com/Zend_PDF-and-Barcode-tp16048071s16154p16048071.html Sent from the Zend Framework mailing list archive at Nabble.com. -- troels
[fw-general] Zend_Mail SMTP Threading?
Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven
RE: [fw-general] Zend_Mail SMTP Threading?
I have tried both, with the same result -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:07 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Hi Steve - are you using the regular 'mail' transport or the SMTP transport when using Zend_Mail? Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
RE: [fw-general] Zend_Mail SMTP Threading?
In my bootstrap: Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp('localhost')); In my controller: $mail = new Zend_Mail(); $mail-setBodyText('Test Message') -addTo($this-view-user-email) -setSubject('Test Subject') -send(); I have modified the subject and message here. -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:31 AM To: Steven Brown Cc: fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Can you send a snippet of your code used to send your mail? The Zend_Mail SMTP transport is transactional and will process each mail object by direct interaction with the target server, so I can't understand why it is executing parallel with your POP requests. Cheers I have tried both, with the same result -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:07 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Hi Steve - are you using the regular 'mail' transport or the SMTP transport when using Zend_Mail? Hi all, I've been writing some unit tests and have had some trouble with mail. I send mail using my application and then check these emails in my unit tests. All of this is handled by a local mail server (hMailServer). If I use CURL to request pages from my local server that send mail, the SMTP commands of the page all happen before the POP commands of my unit tests, so the mail is sent, then checked. If I load my bootstrap in my unit test the SMTP and POP commands are mixed up, so that not all SMTP commands are finished before POP commands are sent. This means the account can be checked before the mail has been sent, even though in the code the sending commands are before the checking commands. This happens whether I use PHP's mail() or Zend_Mail. It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. Any ideas on why this is happening? How can I force the SMTP commands to finish before code execution continues? Cheers, Steven -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
RE: [fw-general] Zend_Mail SMTP Threading?
Hi Justin, Yes I understand about mail queuing, however: 1. This is a local mail server with no queue (and the logs report 0.00 seconds to queue) 2. The system works without a problem when I use CURL 3. The mail server's logs show that the command to send the message are being received by the server after the commands to view the mail 4. Delaying the checking of the email by up to 10 seconds does not change any of this Cheers, Steven -Original Message- From: Justin Randell [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 March 2008 11:57 AM To: Steven Brown Cc: 'Bill Karwin'; fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Mail SMTP Threading? Steven Brown wrote: It appears as though the local server waits for the SMTP commands to finish before it returns a result to CURL, whereas directly accessing my bootstrap allows the SMTP commands to run in the background almost as a separate thread. i doubt there are any separate threads here. the basic issue is that smtp commands finishing != message delivered to intended recipients mailbox. usually, smtp commands finishing in php code just means the mail server has accepted the message into its queue. so: time a: smtp commands finish in php code time a + n: pop commands run time a + N: message gets to user mailbox if n is greater than N, then your tests will run ok. if not, then they wont. N is not dependent on your scripts or tests, but on an external process - the mail server. so, the simplest thing to do is to make n larger by putting a sleep call in before you run the pop checks. another less simple approach is to use mock objects to represents the mail process. make sense? Cheers, Steven cheers justin
RE: [fw-general] Zend_Cache and Page caching
Hi Simon, You could possibly tag it and use that tag to remove the cache after it has been saved, or you could create your own page caching with an option for whether or not to save it. The basic Zend_Cache usage relies on you to do the saving. Cheers, Steven -Original Message- From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Friday, 7 March 2008 8:31 AM To: Zend Framework Subject: [fw-general] Zend_Cache and Page caching Hi there - I have a quick Q about caching pages using the Zend_Cache 'Page' frontend. Is there any way of telling Zend_Cache not to store the page after the hit has been tested? I.e. what I'd like to be able to do is to allow page caching as per normal for 99% of my pages, but in some controller/actions have the ability to cancel the page 'save' through the cache instance so the page is never cached? I realise I can perform a regex in the caching options but that's effectively a static rule. I'd like to be able to more closely control this based on user state and so forth. Look forward to any help/hints Cheerio! -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
RE: [fw-general] Critical Error with Zend_Session
Matthew is it possible Zend_Session needs an option like Zend_Cache to store session files in layered directories so there are not too many files in a single directory at once? -Original Message- From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 March 2008 11:49 PM To: fw-general@lists.zend.com Subject: Re: [fw-general] Critical Error with Zend_Session -- WooKasZ [EMAIL PROTECTED] wrote (on Wednesday, 05 March 2008, 05:35 AM -0800): Hello ! I have a problem with Zend_Session class. Sometimes when I am refreshing page or clicking on a link this fatal error occurs: Code: Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Zend_Session::start() - session_start() [ function.session-start function.session-start ]: ps_files_cleanup_dir: opendir(_sessions/) failed: Result too large (34)' in H:\www\wz\Zend\Session.php:379 Stack trace: #0 H:\www\wz\Zend\Session\Namespace.php(116): Zend_Session::start(true) #1 H:\www\wz\init\session.php(16): Zend_Session_Namespace-__construct() #2 H:\www\wz\init\init.php(10): require_once('H:\www\wz\init\...') #3 H:\www\wz\index.php(21): require_once('H:\www\wz\init\...') #4 {main} thrown in H:\www\wz\Zend\Session.php on line 379 Here is the code in my app: require_once('Zend/Session.php'); garbageCollection( $config['session']['savepath'], $config['session']['lifetime'] ); ini_set( 'session.cache_expire', $config['session']['cache_exp']); ini_set( 'session.gc_maxlifetime', $config['session']['lifetime'] ); session_save_path( $config['session']['savepath'] ); $defSessNamespace = new Zend_Session_Namespace( ); garbageCollector is cleaning folder with sessions. I use it (and init_set) couse I didin't found it in docs. Based on the message exception from the exception thrown, it looks like your GC routine is having trouble getting a list of sessions to remove -- that perhaps there are too many for the OS to handle at once. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
RE: [fw-general] Zend_Form_Element_Select speed / caching questions
Hi Al, I think you may need to include the Select class before you load the object from cache. Cheers, Steven -Original Message- From: Alan Wagstaff [mailto:[EMAIL PROTECTED] Sent: Wednesday, 27 February 2008 9:12 AM To: Steven Brown Subject: Re: [fw-general] Zend_Form_Element_Select speed / caching questions Hi Steven, On 26/02/2008, Steven Brown [EMAIL PROTECTED] wrote: Hi Alan, Was the select class defined before you loaded the object from cache? Cheers, Steven The loading order was: 1. Bootstrap - create cache object from the factory and put in registry 2. Controller - init() fetch cache object 3. Action - Zend_Loader the Select class 4. Action - Create the Select element (wrapped in the Cache bits) Thanks, Al
RE: [fw-general] Zend_Session::start()
Are both applications on the same domain? Cheers, Steven -Original Message- From: Kexiao Liao [mailto:[EMAIL PROTECTED] Sent: Thursday, 28 February 2008 1:59 PM To: fw-general@lists.zend.com Subject: [fw-general] Zend_Session::start() I have two web applications, they need to open within one instance of firefox by open another new tab, these two web application use Zend_Session::start() to start their own sessions. It seems the two web application sessions may conflict with each other causing the web application can not work correctly. Is there anyway to solve this problem? Thanks in advance. Kevin -- View this message in context: http://www.nabble.com/Zend_Session%3A%3Astart%28%29-tp15729209s16154p1572920 9.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Zend_Form_Element_Select speed / caching questions
Hi Alan, Was the select class defined before you loaded the object from cache? Cheers, Steven -Original Message- From: Alan Wagstaff [mailto:[EMAIL PROTECTED] Sent: Wednesday, 27 February 2008 8:33 AM To: Zend Framework - General Subject: [fw-general] Zend_Form_Element_Select speed / caching questions Hi all, I'm using a Select element in one of my forms that displays a list of timezones for the user to choose from. The timezone list itself is stored in an array that currently contains 437 items. I then add the timezone array using the addMultiOptions() message. Unfortunately, this causes noticable slowness when loading the page. I added some timing code and the page load went from 0.8 seconds to 1.6 seconds. Removing the timezone Select element dropped the page load time to normal levels (ie, 0.02, 0.03, etc). I had a play about with Zend_Cache to see if I could cache just the Select element (the rest of the page is very dynamic else I'd just cache the whole page) but didn't have much sucess. Zend_Cache_Core didn't seem to serialize the Select object correctly so I ended up with an error in the View about an incomplete object. I also tried Zend_Cache_Class but whilst that just didn't display the Select element (no errors). So at this point, I'm out of ideas. Anyone got any ideas to help speed up my form without manually coding the HTML for the timezone Select element into my View? :) Thanks, Al.
RE: [fw-general] CakePHP vs. ZendFramework
Wow I bet people get beat up for wearing that shirt J $9.99 and it will cost me $40.00 to get it delivered here in Australia...damn L From: Andi Gutmans [mailto:[EMAIL PROTECTED] Sent: Friday, 22 February 2008 7:11 AM To: José de Menezes Soares Neto; Zend Framework General Subject: RE: [fw-general] CakePHP vs. ZendFramework Thats an obvious answer. We have much cooler merchandise: http://www.zend.com/en/store/php-extras/framework-shirt#Additional-Informati on OK sorry, just had to make that joke. I think Matthews thoughts are pretty spot on and anything Id say would be biased J Andi From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of José de Menezes Soares Neto Sent: Thursday, February 21, 2008 11:34 AM To: Zend Framework General Subject: [fw-general] CakePHP vs. ZendFramework Hi friends, Why use ZendFramework and not CakePHP? Regards, José
[fw-general] Zend_CheckDigit ready for community review
Hi all, This component will include Luhn (MOD10) and Verhoeff to begin with, and possibly some more. http://framework.zend.com/wiki/display/ZFPROP/Zend_CheckDigit+Proposal+-+Ste ven+Brown I imagine this could be implemented pretty quickly, so let me know if you have any questions/comments/suggestions. Cheers, Steven
RE: [fw-general] Addition of utility classes to ZF
Hi Darby, I know that the Australian BPAY system when I implemented it a few years ago required generation of order numbers with a check digit attached. There were several algorithms to choose from but ofcourse the Luhn is not a bad option. I am also currently working on a system where customer numbers and affiliate IDs are generated and check digits will be a nice simple addition to ensure people enter these correctly. Verhoeff is just an alternative to Luhn in these examples. Any accounts system could benefit from check digits for account numbers, invoice numbers, product numbers etc. My point generally with these algorithms and the card type detection is that while the Validate classes are certainly valuable, a Validate class is probably not technically the correct place for these utilities to exist. Perhaps a Zend_Util_Luhn or Zend_Math_Luhn or other grouping name might allow not only these but many other utilities to exist without needing a specific application, instead specific applications (such as Validate) can be built to use these classes. I know there is a discussion at the moment regarding ZF packaging that may be along a similar line to what I am talking about. Cheers, Steven -Original Message- From: Darby Felton [mailto:[EMAIL PROTECTED] Sent: Wednesday, 6 February 2008 1:12 AM To: Steven Brown Cc: 'Zend Framework General' Subject: Re: [fw-general] Addition of utility classes to ZF Hi Steven, Steven Brown wrote: Hi Darby, The Zend_Validate_Ccnum is only one application of the Luhn algorithm, I would have thought the Luhn class would be separate from the Validate class? I suppose it could be separated easily enough. In fact, the Ccnum validator does barely more than ensuring the Luhn algorithm is followed for the digits of the input (it ensures the number of digits is between 13 and 19, no big deal). Probably the Ccnum validator would simply make use of the new Luhn validator. There is an application to generate check digits for account numbers etc. The same applies to Verhoeff, validation is not the only purpose. For what application(s) are you wishing to use a separate Luhn validator, I'm curious? For account numbers? What kinds of accounts? In any case, you can file a JIRA issue for this and, if you're willing, make these contributions yourself (of course I am happy to help!): http://framework.zend.com/issues/secure/CreateIssue!default.jspa http://framework.zend.com/community/contribute/ By validation I simply mean that: * input is checked against some criteria * the validator returns a boolean, whether or not the input satisfy the criteria * the validator also provides the reason(s) for validation failure, should the input not satisfy the criteria How might your use case differ from this? On the note of the Zend_Validate_Ccnum class, what if we wanted to automatically detect what credit card was being used (based on numbers/length)? While Zend_Validate_Ccnum would be good for ensuring a card is a particular type (and that the check digit is correct) is this the place for code to figure out what the card type is? I don't know of a better place offhand, but I'm open to suggestions. I can imagine that the Ccnum validator could recognize what type of card was being used and provide this information separately. For example: $ccnumValidator = new Zend_Validate_Ccnum(); if (!$ccnumValidator-isValid($ccnum)) { // validation failed; see $ccnumValidator-getMessages() } else { // validation passed; get the card brand echo $ccnumValidator-getCardBrand(); // prints VISA or something } Sorry if this is obvious to everyone else but it seems to me that there is need for a utility class area to feed things like validation, but also be used elsewhere. I'm not sure exactly what you're suggesting. What utilities do you think we need to add and where? Thanks! Best regards, Darby Cheers, Steven -Original Message- From: Darby Felton [mailto:[EMAIL PROTECTED] Sent: Friday, 1 February 2008 11:24 PM To: Steven Brown Cc: 'Zend Framework General' Subject: Re: [fw-general] Addition of utility classes to ZF Hi Steven, We have an implementation of the Luhn algorithm within Zend_Validate_Ccnum, though I'm pretty sure we have not implemented the Verhoeff algorithm anywhere. (Please correct me if I'm wrong, anyone.) I think that such validation may fit nicely into the Zend_Validate namespace, but if you are interested in contributing this and other utilities to Zend Framework, please see: http://framework.zend.com/community/contribute for more information. Probably it would be good to describe the utilities and getting some more feedback before making any judgment about whether they would be worth including. :) There is also a proposal process for making ZF contributions: http://framework.zend.com/wiki/display/ZFPROP/Home Thank you for your interest in contributing to Zend Framework! :) Best regards
RE: [fw-general] Addition of utility classes to ZF
Hi Darby, The Zend_Validate_Ccnum is only one application of the Luhn algorithm, I would have thought the Luhn class would be separate from the Validate class? There is an application to generate check digits for account numbers etc. The same applies to Verhoeff, validation is not the only purpose. On the note of the Zend_Validate_Ccnum class, what if we wanted to automatically detect what credit card was being used (based on numbers/length)? While Zend_Validate_Ccnum would be good for ensuring a card is a particular type (and that the check digit is correct) is this the place for code to figure out what the card type is? Sorry if this is obvious to everyone else but it seems to me that there is need for a utility class area to feed things like validation, but also be used elsewhere. Cheers, Steven -Original Message- From: Darby Felton [mailto:[EMAIL PROTECTED] Sent: Friday, 1 February 2008 11:24 PM To: Steven Brown Cc: 'Zend Framework General' Subject: Re: [fw-general] Addition of utility classes to ZF Hi Steven, We have an implementation of the Luhn algorithm within Zend_Validate_Ccnum, though I'm pretty sure we have not implemented the Verhoeff algorithm anywhere. (Please correct me if I'm wrong, anyone.) I think that such validation may fit nicely into the Zend_Validate namespace, but if you are interested in contributing this and other utilities to Zend Framework, please see: http://framework.zend.com/community/contribute for more information. Probably it would be good to describe the utilities and getting some more feedback before making any judgment about whether they would be worth including. :) There is also a proposal process for making ZF contributions: http://framework.zend.com/wiki/display/ZFPROP/Home Thank you for your interest in contributing to Zend Framework! :) Best regards, Darby Steven Brown wrote: Hi all, I was just about to create some utility classes for Luhn (MOD10) and Verhoeff check digit generation and checking. Is this the kind of thing that might fit into ZF somewhere and if so where? There are a whole heap of utility classes I use outside of ZF that are sometimes incompatible or not in the coding standard of ZF, is there much point in converting these and contributing them to ZF? Cheers, Steven
[fw-general] Addition of utility classes to ZF
Hi all, I was just about to create some utility classes for Luhn (MOD10) and Verhoeff check digit generation and checking. Is this the kind of thing that might fit into ZF somewhere and if so where? There are a whole heap of utility classes I use outside of ZF that are sometimes incompatible or not in the coding standard of ZF, is there much point in converting these and contributing them to ZF? Cheers, Steven
RE: [fw-general] Issue resolving procedure
I totally agree with this, I have been prepared to get in and help but how do I know what I can do without interfering with others, and how do I join a team etc. It's not entirely clear within the issue tracker. -Original Message- From: Michał Minicki [mailto:[EMAIL PROTECTED] Sent: Tuesday, 15 January 2008 9:51 PM To: Zend Framework General Subject: [fw-general] Issue resolving procedure Importance: High Hello. I have a question or an idea for improvement when it comes to issue resolving procedures. There are a lot of open issues in the issue tracker and I bet there are a lot of ZF devs who, like me, don't know whether they can fix the user submitted issue or not. It's all open source, alright, but you, at Zend, certainly have a vision and some standards you try to keep to. So having that in mind, instead of fixing bugs I'm hesitating over issues all the time and skipping them if I have any doubts. And I'm pretty sure I'm not alone on this :) Is there some kind of a process in choosing which issues are going to be fixed or implemented? I mean, is there someone who scans the issues daily and marks them as won't be done or to be done? If not, maybe it would be a good idea to somehow mark the issues for all your devoted developers. Or maybe there already is some way to make sure that we can take this or that issue on ourselves? -- Michał Minicki aka Martel Valgoerad | [EMAIL PROTECTED] | http://aie.pl/martel.asc =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Idleness is not doing nothing. Idleness is being free to do anything. -- Floyd Dell
RE: [fw-general] Lucene limit for pagination
If you cached the result you could save having to perform the query over and over again -Original Message- From: Carl.Vondrick [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 January 2008 11:33 AM To: fw-general@lists.zend.com Subject: Re: [fw-general] Lucene limit for pagination Hi, You must return all the results, as Lucene must score each document to sort it correctly. Lucene is optimized so that data is only read on demand. When you do a -find(), Lucene returns just the object IDs and score. When you then ask for information about the document, it looks up the document in the index and returns that information. iffy guy wrote: Is there a way to limit the number of rows for pagination in lucene? IF the file has millions of rows and returns say about 10k rows for a search (all rows), the server's memory would bog down to load 10 k rows into memory, right? How are others handling this situation? -- View this message in context: http://www.nabble.com/Lucene-limit-for-pagination-tp14667540s16154p14680486. html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] Json date type encoding/ decoding
Why don't you just use the result of time() (seconds since jan 1st 1970) and do the date translation at the other end... -Original Message- From: Stephan Stapel [mailto:[EMAIL PROTECTED] Sent: Wednesday, 26 December 2007 5:22 AM To: fw-general@lists.zend.com Subject: [fw-general] Json date type encoding/ decoding Hi! I'm working on scripts to to synchonize a website against a backend system. I'm planning to use json to transfer data back and forth between the systems which works rather well because of the small footprint (in comparison to xml). However, today I ran into a problem around date representation. Doing a little google search, I discovered that there are misc attempts to represent date/ datetime types in json, e.g. @119862720@ and new Date(119862720) there seems to be no standard yet, however, the second variant looks quite common. Did anyone of you also have this problem and how did you solve it? Basically, it'd imho be cool to convert such a value into a Zend_Date type. What do you think? Would a patch of Zend_Json_Decoder::_decodeValue() have a chance to be included into the framework? Or would you rather wait until the date representation is standardized? cheers, Stephan
RE: [fw-general] Zend_Session::start() and remember me
On my local Windows machine output buffering is 4096 but I know Apache on Windows is a bit weird with output anyway in that flush() won't actually flush. I tested on a linux server and it also worked, output buffering was set to no value according to phpinfo(). -Original Message- From: Darby Felton [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 11:24 PM To: Steven Brown Cc: 'Laurent Melmoux'; 'Zend Framework General' Subject: Re: [fw-general] Zend_Session::start() and remember me Maybe you have output buffering enabled? Steven Brown wrote: Actually I found I could call Zend_Session::rememberMe() after Zend_Session::start() and it works. I call Zend_Session::start() in my bootstrap and Zend_Session::rememberMe() in my login action. I expected it to not work after reading the manual however it seems to work fine. -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 1:34 AM To: Darby Felton Cc: Zend Framework General Subject: Re: [fw-general] Zend_Session::start() and remember me Darby Felton a écrit : d1. what happens now is the client is sent a cookie named REMEMBERME=true, e. The next page visit that Zend_Session is started on will see the REMEMBERME cookie, then change the SESSION COOKIE to a persistent cookie (for as long as the remember me secionds value). The REMEMBERME cookie is then destroyed as its served its purpose. f. Now you have a session cookie that will end at a specific time in the future, not when the browser closes. I’m going to use this technique to solve my problem Yes, Ralph's explanation is fine and correct and does not conflict with the crux of my last message - that rememberMe() must be called before the session is started. Yes I totally agree with that. I think I don’t explain myself very well :). My original question was, how can I keep Zend_Session::start() at the beginning of my bootstrap and at the same time have my Auth Controller works with the remember me fiture. So now I have an answer, by using Ralph technique, I can set a cookie in the AuthController to notifies my bootstrap, to call Zend_Session::remeberMe()in my next page load. Actually, I got mixed up with the session remember me and the authentification remember me. It is 2 things even though the authentification remember me is tight couple with the session.( may be Zend_Session::setDuration() would be less confusing ? ) But I'm wondering why it haven’t been implemented this way? Well, I guess that Zend_Session ::rememberMe() is not specific to authentification. What do you think of a Zend_Auth::setRememberMe() to place in your Auth Controller and a Zend_Auth::rememberMe() in the bootstrap that well check for a specific cookie then proxy to Zend_Session ::rememberMe() ? Darby Felton a écrit : Hi Laurent, IIRC, Zend_Session::rememberMe() uses session_set_cookie_params(). Thus, it must be called before the session is started to work properly. This is documented here: http://framework.zend.com/manual/en/zend.session.global_session_management.h tml#zend.session.global_session_management.rememberme Sorry for the long URL. :) Best regards, Darby Laurent Melmoux wrote: Hi all, Until now I had call Zend_Session::start() at the beginning of bootstrap file, so far so good. But now, I would like to add a remember me option on my login form, so if the authentification succeed and the remember me have been checked I call Zend_Session::rememberMe()... But it won’t work because the session is already started! What do you consider as best practice to deal with this use case? Where Zend_Session::start() should be called ? Regards
RE: [fw-general] Zend_Session::start() and remember me
Yes it definitely works, I login (ticking remember me), close the browser, open the browser again and it remembers me. I thought I had to set remember me before starting the session however I found someone else had done the same as I have, and on testing it works. I wonder is the cookie set only when needed, or is the remember me cookie set on the next request, which may be caused by my redirect? -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 5:35 PM To: Steven Brown Cc: 'Darby Felton'; 'Zend Framework General' Subject: Re: [fw-general] Zend_Session::start() and remember me Are you sure it is working? Zend_Session::rememberMe() is calling Zend_Session::rememberUntil() which is calling the php function session_set_cookie_params () (http://php.net/session_set_cookie_params) . This function configures the cookie use by the session. As Darby said it should be called before session_start() to work. Finally here is how I solve this issue: *In my AuthController, after a successful authentification :* // Set a cookie to notify the bootstrap how long the session cookie should last $duration = $this-_form-rememberme ? 1209600 : 0; setcookie(Zend_Auth_RememberMe, $duration, time()+6000, '/'); *In my bootstrap:* // Session include 'Zend/Session.php'; if(isset($_COOKIE[Zend_Auth_RememberMe])){ Zend_Session::rememberUntil($_COOKIE[Zend_Auth_RememberMe]); unset($_COOKIE[Zend_Auth_RememberMe]); } Zend_Session::start(); Regards, -- Laurent Melmoux - [EMAIL PROTECTED] Annecy - France Steven Brown a écrit : Actually I found I could call Zend_Session::rememberMe() after Zend_Session::start() and it works. I call Zend_Session::start() in my bootstrap and Zend_Session::rememberMe() in my login action. I expected it to not work after reading the manual however it seems to work fine. -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 1:34 AM To: Darby Felton Cc: Zend Framework General Subject: Re: [fw-general] Zend_Session::start() and remember me Darby Felton a écrit : d1. what happens now is the client is sent a cookie named REMEMBERME=true, e. The next page visit that Zend_Session is started on will see the REMEMBERME cookie, then change the SESSION COOKIE to a persistent cookie (for as long as the remember me secionds value). The REMEMBERME cookie is then destroyed as its served its purpose. f. Now you have a session cookie that will end at a specific time in the future, not when the browser closes. Im going to use this technique to solve my problem Yes, Ralph's explanation is fine and correct and does not conflict with the crux of my last message - that rememberMe() must be called before the session is started. Yes I totally agree with that. I think I dont explain myself very well :). My original question was, how can I keep Zend_Session::start() at the beginning of my bootstrap and at the same time have my Auth Controller works with the remember me fiture. So now I have an answer, by using Ralph technique, I can set a cookie in the AuthController to notifies my bootstrap, to call Zend_Session::remeberMe()in my next page load. Actually, I got mixed up with the session remember me and the authentification remember me. It is 2 things even though the authentification remember me is tight couple with the session.( may be Zend_Session::setDuration() would be less confusing ? ) But I'm wondering why it havent been implemented this way? Well, I guess that Zend_Session ::rememberMe() is not specific to authentification. What do you think of a Zend_Auth::setRememberMe() to place in your Auth Controller and a Zend_Auth::rememberMe() in the bootstrap that well check for a specific cookie then proxy to Zend_Session ::rememberMe() ? Darby Felton a écrit : Hi Laurent, IIRC, Zend_Session::rememberMe() uses session_set_cookie_params(). Thus, it must be called before the session is started to work properly. This is documented here: http://framework.zend.com/manual/en/zend.session.global_session_management.h tml#zend.session.global_session_management.rememberme Sorry for the long URL. :) Best regards, Darby Laurent Melmoux wrote: Hi all, Until now I had call Zend_Session::start() at the beginning of bootstrap file, so far so good. But now, I would like to add a remember me option on my login form, so if the authentification succeed and the remember me have been checked I call Zend_Session::rememberMe()... But it wont work because the session is already started! What do you consider as best practice to deal with this use case? Where Zend_Session::start() should be called ? Regards
RE: [fw-general] Re: *** PROBABLY SPAM *** RE: [fw-general] Zend_Session::start() and remember me
After login the details are as follows: array(5) { [lifetime]= int(604800) [path]= string(1) / [domain]= string(0) [secure]= bool(false) [httponly]= bool(false) } After redirect they are as follows: array(5) { [lifetime]= int(0) [path]= string(1) / [domain]= string(0) [secure]= bool(false) [httponly]= bool(false) } Notice I had to turn off the redirect to get the first result. Note my remember me line is: Zend_Session::rememberMe(60 * 60 * 24 * 7); // Remember me for 7 days This is 604800. Cheers, Steven -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 8:24 PM To: Steven Brown Cc: 'Darby Felton'; 'Zend Framework General' Subject: [fw-general] Re: *** PROBABLY SPAM *** RE: [fw-general] Zend_Session::start() and remember me Do var_dump(session_get_cookie_params()) at the end of your bootstrap If you have : 'lifetime' = int 1209600 then it is working. If I call Zend_Session::rememberMe() in my authController I have 'lifetime' = int 0 which mean the cookie will die when the browser get closed. Steven Brown a écrit : Yes it definitely works, I login (ticking remember me), close the browser, open the browser again and it remembers me. I thought I had to set remember me before starting the session however I found someone else had done the same as I have, and on testing it works. I wonder is the cookie set only when needed, or is the remember me cookie set on the next request, which may be caused by my redirect? -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 5:35 PM To: Steven Brown Cc: 'Darby Felton'; 'Zend Framework General' Subject: Re: [fw-general] Zend_Session::start() and remember me Are you sure it is working? Zend_Session::rememberMe() is calling Zend_Session::rememberUntil() which is calling the php function session_set_cookie_params () (http://php.net/session_set_cookie_params) . This function configures the cookie use by the session. As Darby said it should be called before session_start() to work. Finally here is how I solve this issue: *In my AuthController, after a successful authentification :* // Set a cookie to notify the bootstrap how long the session cookie should last $duration = $this-_form-rememberme ? 1209600 : 0; setcookie(Zend_Auth_RememberMe, $duration, time()+6000, '/'); *In my bootstrap:* // Session include 'Zend/Session.php'; if(isset($_COOKIE[Zend_Auth_RememberMe])){ Zend_Session::rememberUntil($_COOKIE[Zend_Auth_RememberMe]); unset($_COOKIE[Zend_Auth_RememberMe]); } Zend_Session::start(); Regards, -- Laurent Melmoux - [EMAIL PROTECTED] Annecy - France
RE: [fw-general] Zend_Session::start() and remember me
Actually I found I could call Zend_Session::rememberMe() after Zend_Session::start() and it works. I call Zend_Session::start() in my bootstrap and Zend_Session::rememberMe() in my login action. I expected it to not work after reading the manual however it seems to work fine. -Original Message- From: Laurent Melmoux [mailto:[EMAIL PROTECTED] Sent: Friday, 7 December 2007 1:34 AM To: Darby Felton Cc: Zend Framework General Subject: Re: [fw-general] Zend_Session::start() and remember me Darby Felton a écrit : d1. what happens now is the client is sent a cookie named REMEMBERME=true, e. The next page visit that Zend_Session is started on will see the REMEMBERME cookie, then change the SESSION COOKIE to a persistent cookie (for as long as the remember me secionds value). The REMEMBERME cookie is then destroyed as its served its purpose. f. Now you have a session cookie that will end at a specific time in the future, not when the browser closes. Im going to use this technique to solve my problem Yes, Ralph's explanation is fine and correct and does not conflict with the crux of my last message - that rememberMe() must be called before the session is started. Yes I totally agree with that. I think I dont explain myself very well :). My original question was, how can I keep Zend_Session::start() at the beginning of my bootstrap and at the same time have my Auth Controller works with the remember me fiture. So now I have an answer, by using Ralph technique, I can set a cookie in the AuthController to notifies my bootstrap, to call Zend_Session::remeberMe()in my next page load. Actually, I got mixed up with the session remember me and the authentification remember me. It is 2 things even though the authentification remember me is tight couple with the session.( may be Zend_Session::setDuration() would be less confusing ? ) But I'm wondering why it havent been implemented this way? Well, I guess that Zend_Session ::rememberMe() is not specific to authentification. What do you think of a Zend_Auth::setRememberMe() to place in your Auth Controller and a Zend_Auth::rememberMe() in the bootstrap that well check for a specific cookie then proxy to Zend_Session ::rememberMe() ? Darby Felton a écrit : Hi Laurent, IIRC, Zend_Session::rememberMe() uses session_set_cookie_params(). Thus, it must be called before the session is started to work properly. This is documented here: http://framework.zend.com/manual/en/zend.session.global_session_management.h tml#zend.session.global_session_management.rememberme Sorry for the long URL. :) Best regards, Darby Laurent Melmoux wrote: Hi all, Until now I had call Zend_Session::start() at the beginning of bootstrap file, so far so good. But now, I would like to add a remember me option on my login form, so if the authentification succeed and the remember me have been checked I call Zend_Session::rememberMe()... But it wont work because the session is already started! What do you consider as best practice to deal with this use case? Where Zend_Session::start() should be called ? Regards -- Laurent Melmoux - [EMAIL PROTECTED] Annecy - France Tél : 09 50 74 38 01 Portable : 06 71 09 52 26
RE: [fw-general] Ajax way
Peter, This may not be the most correct way, but this is the solution I use: Zend_Loader::loadClass('Zend_Json'); $this-_response-setHeader('content-type', 'application/json', true); $this-_response-setBody(/*-secure-\n . Zend_Json::encode($response) . \n*/); $response really can be anything, a string, an array, an object. Cheers, Steven -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: Monday, 26 November 2007 7:17 AM To: Zend Framework General Subject: [fw-general] Ajax way Hi, I want to return json from an action, but I have hard times finding out how to do it the best way with ZF. For the moment I do: function updateorderAction() { $i = 1; $o_divisiontable = new Division(); foreach($_POST['divisioncontainer'] AS $i_divisionid) { $o_division = $o_divisiontable-fetchRow(division_id = $i_divisionid); $o_division-priority = $i; $o_division-save(); $i++; } $a_return = array(result, 1); echo json_encode($a_return); die; } But that isn't the way, is it? /Peter
RE: [fw-general] Zend_Cache Images How To ?
Hi Juan, The best application of Zend_Cache to what you are doing might be something like the following: $im = imagecreatefrompng(test.png); Storing $im in cache probably won't help unless you are repeatedly resizing the same images, if they are user uploaded images there is no benefit from caching. You could use Zend_Cache_Frontend_File to refresh the cache when the file changes (if you are resizing the same images). // do your resizing here You could have a function/method that performs the resize based on input data. You could use Zend_Cache_Frontend_Function or Zend_Cache_Frontend_Class for this, however once again it will only really help if you are repeatedly resizing the same images. imagepng($im); This pumps the result to the page or to a file, you might use Zend_Cache and some output buffering to capture the output and store it in cache, but once again this only really works if you are repeatedly resizing the same images. The end result is if you're resizing user uploaded images, they will almost never be the same, so caching can't help you. If you're constantly resizing the same images I would recommend you store them in PNG files (or whatever format you want) using a database ID or other identifier so they can be loaded by the browser without having to involve PHP at all. Zend_Cache doesn't really help you here as the load saving comes when your input data is the same as that matching something that has already been cached and it can load the cached version and bypass the processing. I hope this answers your question. Cheers, Steven -Original Message- From: Juan Felipe Alavarez Saldarriaga [mailto:[EMAIL PROTECTED] Sent: Wednesday, 7 November 2007 1:13 AM To: fw-general Subject: [fw-general] Zend_Cache Images How To ? Hey! :) I'm making something like this, a class to resize images using GD, the resize process is working fine, but the problem that I have is that the new images when are resized takes a lot of time to do it, so I was thinking on use the Zend_Cache for that, is possible ? I mean like cache a imagecreatefrompng() resource or maybe convert the image to base64 and then cache it ? Thx for any suggestion.
[fw-general] Suggested Zend_Cache changes
Hi all, I would like to put up a few Zend_Cache changes for discussion: 1. Zend_Cache_Frontend_Class should not require cachedEntity in the options, instead you would be able to pass either a class name or object to a call method just like Zend_Cache_Frontend_Function. I understand the current setup is a bit cooler in that you can simply call the method directly on the cache object, however I feel this is not flexible in allowing me to use the same cache object for methods of multiple classes or objects. 2. Zend_Cache_Frontend_File should not require a unique ID, it should be automatically generated from the path and filename in the same way some of the other frontends are able to automatically generate IDs. 3. In Zend/Cache/Backend there is a file called Test.php, is this supposed to be there? 4. It would be good to be able to allow cache atrophy. There are two different forms of atrophy that could be available based on data changes: a) A minimum and maximum cache expiry are set (say 5 mins, 30 mins), at first the expiry is at the minimum (5 mins), if the data has not changed at the end of the expiry period, the expiry period then increases by the atrophy rate (say 20%) so it is then longer (6 mins). This continues until the maximum expiry period. If the data has changed at an expiry point, the expiry period is reset to the minimum (5 mins) or possibly decreases and the process starts again. This attempts to spend less time refreshing cache that does not change often. b) A minimum and maximum cache expiry are set (say 5 mins, 30 mins), at first the expiry is at the maximum (30mins), if the data has changed at the end of the expiry period, the expiry period then decreases by the atrophy rate (say 20%) so it is then shorter (24 mins). This continues until the minimum expiry period. If the data has not changed at an expiry point, the expiry period is reset to the maxmimum (30 mins) or possibly increases and the process starts again. This attempts to keep changing data fresher. There is also another approach based on traffic: c) Minimum and maximum expiries are set as above, along with traffic levels and an atrophy level. As an item becomes more and more popular the cache expiry gets shorter and shorter to ensure the data is as up-to-date as possible. d) Same as c except the cache expiry is set longer and longer as the item gets more popular. This means the load is being reduced by caching more and more when itemsare popular, however they become more and more out-of-date. Any feedback on these concepts would be much appreciated. Cheers, Steven
RE: [fw-general] post uri
Or store it in the session on the previous page, but it won't work if someone has multiple pages open...why wouldn't you want to send it in the form? From: Tobias Gies [mailto:[EMAIL PROTECTED] Sent: Thursday, 27 September 2007 5:16 PM To: Zend Framework General Subject: Re: [fw-general] post uri you could try to read $_SERVER['REFERER'], but that one is only accessible if the user's browser sends it to the server. 2007/9/27, Waigani [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] : Hi All, Is there a way to find out where a post has come from, without sending the info in the form? In particular, can you get the module controller and action. Cheers, -- View this message in context: http://www.nabble.com/post-uri-tf4526349s16154.html#a12914633 Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] how to retain value in form using zend
I would recommend not storing the form data in the session, you might find people will be using the same form (or multiple forms) in multiple windows, this results in overlapping data. Check out this tutorial: http://akrabat.com/zend-framework-tutorial/ It has a really good example application for forms. Cheers, Steven -Original Message- From: Ivan Ruiz Gallego [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 September 2007 5:03 PM To: rdpweb; fw-general@lists.zend.com Subject: Re: [fw-general] how to retain value in form using zend Hi Rohit83, I usually use Zend_Session to keep form data between requests. I serialize the post array an keep it in an own session namespace. Additionally, I pass the form data array to the view in the controller action, so that the view does not need to know about the existence of sessions. Take a look at the sample code below. If everyone has a better idea, I would be happy to know! Best regards, Ivan. /* Display form */ public function displayformAction() { $this-initView(); // Check session for form data $formSession = new Zend_Session_Namespace('form'); if (isset($formSession-formData)) { $formData = unserialize($formSession-formData); $this-view-formData = $formData; } /* Render form */ } /* Check user input */ public function checkformAction() { // Get POST data $request = $this-getRequest(); $post = $request-getPost(); /* Validation logic */ /* If errors, go back to view */ // Pass error message... $this-view-formData = $post; // Redirect /* If input ok */ $formSession = new Zend_Session_Namespace('form'); $formSession-formData = serialize($post); // Go to previewAction, e.g. } Hi All I have developed a form using zend framework.When i click on submit button and id if due to validation some error message is displayed , at that time the values entered in text box will not be retained. Is their any way to retain these values using zend functionality Regard, Rohit83 -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
RE: [fw-general] how to retain value in form using zend
Thats a good question. The simple answer is to have the data in hidden fields in the page. I guess you could store the data in a namespace with a unique ID, that ID would be sent back in with the POST or GET to retrieve the data for further editing. Cheers, Steven From: Ivan Ruiz Gallego [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 September 2007 11:03 PM To: Steven Brown Cc: 'rdpweb'; fw-general@lists.zend.com Subject: Re: [fw-general] how to retain value in form using zend Hi Steven, Using sessions to store form data may lead to data overlapping. That's a good point, I didn't take into account. The main point using the session was to store form data in case that we have a preview action. In this case form data is no longer in the post array. What would be in your opinion the best way to store data in this case? Thanks. Best regards, Ivan. Steven Brown schrieb: I would recommend not storing the form data in the session, you might find people will be using the same form (or multiple forms) in multiple windows, this results in overlapping data. Check out this tutorial: http://akrabat.com/zend-framework-tutorial/ It has a really good example application for forms. Cheers, Steven -Original Message- From: Ivan Ruiz Gallego [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5 September 2007 5:03 PM To: rdpweb; fw-general@lists.zend.com Subject: Re: [fw-general] how to retain value in form using zend Hi Rohit83, I usually use Zend_Session to keep form data between requests. I serialize the post array an keep it in an own session namespace. Additionally, I pass the form data array to the view in the controller action, so that the view does not need to know about the existence of sessions. Take a look at the sample code below. If everyone has a better idea, I would be happy to know! Best regards, Ivan. /* Display form */ public function displayformAction() { $this-initView(); // Check session for form data $formSession = new Zend_Session_Namespace('form'); if (isset($formSession-formData)) { $formData = unserialize($formSession-formData); $this-view-formData = $formData; } /* Render form */ } /* Check user input */ public function checkformAction() { // Get POST data $request = $this-getRequest(); $post = $request-getPost(); /* Validation logic */ /* If errors, go back to view */ // Pass error message... $this-view-formData = $post; // Redirect /* If input ok */ $formSession = new Zend_Session_Namespace('form'); $formSession-formData = serialize($post); // Go to previewAction, e.g. } Hi All I have developed a form using zend framework.When i click on submit button and id if due to validation some error message is displayed , at that time the values entered in text box will not be retained. Is their any way to retain these values using zend functionality Regard, Rohit83 -- Loglan GmbH Ivan Ruiz Gallego Binzmühlestrasse 210 8050 Zürich Switzerland Office +41 44 310 19 20 Mobile +41 76 321 23 68 Net www.loglan.net
RE: [fw-general] How to generate a good cache identifier based on URL?
Here's what worked for me: $cacheName = $_SERVER['REQUEST_URI']; $cacheName = preg_replace('/[^a-zA-Z0-9]/', '__', $cacheName); if(!($output = $cache-load($cacheName))) { You need to strip out all the other junk because the cache identifier is used in the file name. I used __ because the URI would likely have _ but not __, and just stripping the junk out could cause two different URIs to be the same. Also I was trying to use the Function cache frontend for accessing object methods and had to build my own as the default one does not handle methods, only functions (as far as I could tell). -Original Message- From: Peter Van Dijck [mailto:[EMAIL PROTECTED] Sent: Friday, 31 August 2007 6:18 PM To: fw-general@lists.zend.com Subject: [fw-general] How to generate a good cache identifier based on URL? Hi all, I am using a caching identifier based on the URL. But I'm getting strange effects: when accessing a URL I see the cached version of *another* page. This is the code I'm using for the cache identifier. $cache_identifier = ereg_replace(/, _, $_SERVER['REQUEST_URI']); $cache_identifier = ereg_replace(., _, $_SERVER['REQUEST_URI']); $cache_identifier = preg_replace(/([^a-zA-Z0-9_-])/, '', $cache_identifier); I added that last line because I was getting errors saying that the cache identifier could only have a-z and _- characters. Any thoughts on how to improve this would be very welcome :) Thanks! Peter -- blog: http://poorbuthappy.com/ease/ work: http://petervandijck.com free travel guides: http://poorbuthappy.com US: (+1) 201 467-5511 Belgium: (+32) 03/325 88 70 Skype id: peterkevandijck
RE: [fw-general] How to generate a good cache identifier based on URL?
Good one! -Original Message- From: Federico Galassi [mailto:[EMAIL PROTECTED] On Behalf Of Federico Galassi Sent: Friday, 31 August 2007 9:50 PM To: Peter Van Dijck Cc: fw-general@lists.zend.com Subject: Re: [fw-general] How to generate a good cache identifier based on URL? On 31/ago/07, at 10:17:51, Peter Van Dijck wrote: Any thoughts on how to improve this would be very welcome :) $cache_identifier = md5($_SERVER['REQUEST_URI']); Federico