[fw-general] Re: Zend Framework 1 is now on GitHub
Hi Matthew, 'Twas brillig, and Matthew Weier O'Phinney at 03/05/13 16:11 did gyre and gimble: On Fri, May 3, 2013 at 4:00 AM, Colin Guthrie gm...@colin.guthr.ie wrote: Hi, I've only just had need to clone this looking for a change made a while ago that I think is causing me trouble and which I need to revert. After cloning I was quite upset to find that the history is not preserved? I've done several svn-git conversions over the years and preserving the history was a major part of that process. Am I missing something obvious here - is there some alternative to the github zf1 clone? Has anyone else questioned this? Is there effort to create a new clone from the svn to replace it? Having full history in git would be very convenient. We have full history in git from sometime between 1.5 and 1.6 onwards. Hmm, strange, my clone only seemed to go as old as Fri Jun 15 20:08:56 2012 + which says: Creating 1.12 release branch Am I using the wrong clone (git://github.com/zendframework/zf1) or are you referring to something else? The reason we don't have ALL history is because we changed the SVN repository layout in between those versions, and git-svn simply cannot traverse it. We went from this: - http://framework.zend.com/svn/framework/trunk to this: - http://framework.zend.com/svn/framework/standard/trunk I've tried many times to build a git-svn clone with full history, and have never found a way to do it, short of replaying commit by commit, which, based on some experiments, would have taken more than a week even for an automated process -- and I have my doubts that it would be successful. In theory, it should be a matter of doing a two git svn fetch's rather than one: git svn fetch -r 1:12345 to get all the history up until the svn mv, and then edit the metadata and path arguments in the .git folder and then do a: git svn fetch -r 12347:HEAD Note that git-svn rev numbers are inclusive hence I missed r12346 above which I'm indicating as the commit that did the svn mv. This should work. I've done it on other projects where a oops commit wanted to be skipped (e.g. an accidental svn rm/mv when a restoration commit immediately after - in this case we skip both commits to avoid massive contextual changes) and the only difference here is doing the metadata editing in between calls. As for tags, we could not have all tags in git due to the way that we built tags in ZF1. Tags in ZF1 were not a direct copy of a given version -- they had a number of changes, including inclusion of the extras repository, pinning to a specific version of Dojo, and an actual build from Dojo. As a result, copying them into the git repository was again a nightmare -- as each one took between 20 and 35MB of space; as an example, just recreating 1.12.0 - 1.12.3 took me close to 2 hours, and much of it was manual. Doing this for each of the tags would inflate the repository to a point that cloning it would take ridiculously long, and would take weeks of time for an individual to accomplish. So, we had to make tradeoffs. Yeah, that's a pain. It might still be nice to have some kind of tag that represented the state of ZF itself at that time - even if it didn't include the Dojo+extras stuff. Not necessarily for general usage, just for comparison - e.g. tracking down that nasty bug and bisecting etc. That said, it's not *that* big a deal, just useful. I understand the problems here. FWIW, I've been working on a project where the svn was forked of a parent project which was slowly dying. We're now going in to recreate the history in git which involves doing a git-svn import from the original project up until the point at which we made a fork (which was basically an import from tarballs on the new SVN to keep things clean), then switching the git-svn repository, changing the metadata, doing a synthesised commit to ensure the repository states are the same and then faking the git-svn metadata to make it continue with an git-svn import on a new repo. All very tricky, but there if I've learned one thing, it's that you can trick git-svn into doing a *lot* of stuff it wasn't meant to do :D Feel free to ping me off-list if you think this could be of benefit. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Re: Zend Framework 1 is now on GitHub
Hi, I've only just had need to clone this looking for a change made a while ago that I think is causing me trouble and which I need to revert. After cloning I was quite upset to find that the history is not preserved? I've done several svn-git conversions over the years and preserving the history was a major part of that process. Am I missing something obvious here - is there some alternative to the github zf1 clone? Has anyone else questioned this? Is there effort to create a new clone from the svn to replace it? Having full history in git would be very convenient. Col 'Twas brillig, and Matthew Weier O'Phinney at 05/04/13 17:57 did gyre and gimble: We have completed the transition from subversion to GitHub for Zend Framework 1. At this time: - The old http://framework.zend.com/svn/framework/standard and http://framework.zend.com/svn/framework/extras SVN URIs still work, but are marked READ-ONLY, and will not receive further updates. - https://github.com/zendframework/zf1 has been created, and the various README files have been updated to reflect the change in location and development processes. - https://github.com/zendframework/zf1-extras has been created - Issues reported since 1.12.0 was released and not yet resolved have been ported to https://github.com/zendframework/zf1/issues - JIRA has been marked read-only, and banners indicating the new locations for the ZF1 and ZF2 issue trackers have been placed. For more information on the migration, please see http://bit.ly/zf1-goes-git -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Re: Fixing Zend_Db_Statement::_stripQuoted() seg-faults on large SQL strings in ZF 1.x
a number of contributors have put into the matter, primarily by Bart McLeod, we feel comfortable moving forward with this fix for ZF 1.12 as it gives developers some flexibility in avoiding the problem, and the fix is fairly well tested against BC issues. I will let Bart get into the complexities of the fix, but I would like everyone to test what is currently in _trunk_ if you have large SQL that is being passed through Zend_Db. Thanks! Ralph Schindler -- Bart McLeod *Space Web* Middenlaan 47 6869 VN Heveadorp The Netherlands *t* +31(0)26 3392952 *m* 06 51 51 89 71 *@* i...@spaceweb.nl mailto:i...@spaceweb.nl www.spaceweb.nl http://www.spaceweb.nl zce PHP 4 logo zce PHP 5 logo zce PHP 5.3 logo zce Zend Framework logo /Bart McLeod is a Zend Certified Engineer./ Click to verify! http://www.zend.com/zce.php?c=ZEND004591r=218204904 -- Bart McLeod *Space Web* Middenlaan 47 6869 VN Heveadorp The Netherlands *t* +31(0)26 3392952 *m* 06 51 51 89 71 *@* i...@spaceweb.nl mailto:i...@spaceweb.nl www.spaceweb.nl http://www.spaceweb.nl zce PHP 4 logo zce PHP 5 logo zce PHP 5.3 logo zce Zend Framework logo /Bart McLeod is a Zend Certified Engineer./ Click to verify! http://www.zend.com/zce.php?c=ZEND004591r=218204904 -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Bugs with patches languishing in the tracker... won't someone think of the bitrot?
Hi, Over the years I've written several patches for ZF (I've signed the forms as much as I think copyright assignment is sucky), but I is *really* frustrating when the patches are not even acknowledged by upstream at all[1][2] It's worse when a one line change gets ignored for more than two years![2] It's a real shame that peoples' effort goes unappreciated and unacknowledged by the upstream folks. I've got several constructs and utilities I use in my system that I would consider making suitable for upstream and available to all, but motivation is hard to find with the experience thus far :( Yours feeling unloved, Colin 1. http://framework.zend.com/issues/browse/ZF-10970 2. http://framework.zend.com/issues/browse/ZF-6065 (although there are other examples too I could probably dig up!) -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Question about copyright date changes in latest ZF release.
Hi, I noticed (due to massive file churn in our VCS after importing the latest ZF release) that many files have had their copyright date changed to 2011. While this is all well and good, is it actually valid to do so without actually making any other change to the file? I mean, if copyright can be extended simply by changing the copyright date in it's header does that not mean that e.g. copyright on an artistic work could last forever if the owners just change the date every year? (this may not apply to code per se - more a general question) I have a script that I run at year end on our code that diligently checks to see if a file has been edited in the last year and only amends the copyright date in the header based on this check (which uses our VCS history). This seems to me to be correct in the sense that the year in the preamble will only be modified to reflect when the file was last changed, but obviously it's more complex than a blanket change. This is really an open question about how to deal with copyright headers. Opinions welcome :) Cheers Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Re: Zend_Cache cleaning specified tag
'Twas brillig, and Vincio at 04/03/11 16:09 did gyre and gimble: Thank you for the answer. How can I clean cache? You have to use a backend that support tags if you want to clean based on tags. Using the file backend is *horrible* when doing any kind of sizable caching (it takes a very long time to run as it has to open every single cache file's metadata to check for the tags). In my setup, I use Memcache (which also does not support tags) but built a database backed system to track the tags used for a given id. I can then clean my tags based on that additional metadata. It's not idea, but as the cleaning process is not automated (it's trigged when things change - not very often) and as the ultimate goal is to have everything loaded from cache, these additional metadata tables in the db don't get a massive amount of hits on them for general usage - which was my goal. If this is something that is of interest generally, I can clean up my code and submit them upstream (but as most of my patches go unloved on the issue tracker, one is three years old now!) I'm not sure if it's really worth the effort :s Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Re: How to add RewriteRule to ZF default .htaccess ?
'Twas brillig, and Laurens van Vliet at 16/11/10 11:11 did gyre and gimble: Hi, I was wondering if it is possible to add some basic RewriteRules to the ZF .htaccess? Is it possible to match certain urls while there is not a corresponding Controller/Action/View or Routes configured for these paths? Something like: SetEnv APPLICATION_ENV development RewriteEngine On RewriteRule ^foo http://%{HTTP_HOST}/bar [R=301,NC] RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] where 'foo' is not existing in the ZF application and 'bar' is. So '.../foo' which is not really existing in my application should be redirected to '../bar' which has an existing BarController with actions and views. Is this not working for you? So you seem to be asking a question and presenting a solution but not actually stating if you have a problem with it! The code looks OK at first glance (albeit it only matches /foo, not /foo/wibble/oink), although I would put an L in the flags to stop it processing any further rules and issue the 301 redirect immediately. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Re: How to add RewriteRule to ZF default .htaccess ?
'Twas brillig, and Laurens van Vliet at 16/11/10 11:57 did gyre and gimble: Problem with this code is that it is not working. When I try to open in my browser my application with /foo at the end of the url, say for example: http://www.example.com/foo then I get this error message: Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (foo)' Is it possible to use the RewriteRule without any FooController or Routes for /foo? Yes this is possible, you've just got the syntax wrong. ^foo will match URLs *beginning* with foo, not ending with foo. Try, foo$ to match all URLs ending with foo, or perhaps, ^/foo$ to match a URL of http://example.com/foo And make sure you put the L flag into the rewrite ([R=301,NC,L]) so that it does not then process the rest of the rules. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Re: Firefox - double request
'Twas brillig, and debussy007 at 12/10/10 19:05 did gyre and gimble: Hi, I have a very strange error with my ZF application. Firefox create two requests when a specific action is being called. Nor Chrome nor Opera do this. I tested it just by logging the actions called. What a very odd error ... I also noticed that I have this behaviour when I am fetching cache files, but anyway this is server side, shouldn't make any difference but seems it does ... Anyone can help me debug this error ? I am clueless on this one We had a similar problem at work. It was somehow related to ZFDebug toolbar that we used. Removing that caused the double request to disappear. Strangely not all of us could reproduce this and it turned out that turning *off* memory caching[1] in Firefox+ZFDebug toolbar was the combination that caused the problem. Turning memory caching back on or removing the ZFDebug bar cause FF to only make one request. Very odd issue. Col 1. browser.cache.memory.enable -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Re: Best way to pass an array between two actions
'Twas brillig, and debussy007 at 21/09/10 18:58 did gyre and gimble: I need to pass an array between two actions. Below is the code I tried : in action 1 : return $this-_redirector-gotoSimple('time-slots', NULL , NULL, array('bookings' = $bookings)); in action 2 (timeSlotsAction) : $bookings = $this-_getParam('bookings'); Unfortunately this won't work. I am doing something wrong. So I thought I should serialize the array but I am afraid that the serialized output will be to big for a GET param. Thank you for any help !! Take a look at the way the flash messenger helper works. It's a one shot, pass a message to the next request system. I've used this as a basis to create a flashform helper which can pass form values from one request to another. I use this in the same way as one would normally use flash messenger - i.e. flash messenger can be used to pass a failed or succeeded message to the user, but if I fail I may want to keep the (invalid) form values to give back to the user to retry. I do this to implement a PRG system (Post, Redirect, Get) in order to not break the browser's back button: [GET] Use Zend_Form to give the user some input fields [POST] User changes values and submits form if ($valid) { $flashMsg = Succeed; } else { $flashMsg = Failed; $flashForm = $form-getRawValues(); } redirect(); [GET] Repopulate form if $flashForm has values. Show form again + $flashMsg. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mageia Contributor [http://www.mageia.org/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/]
[fw-general] Re: Integration with phpbb (or other forum software)
'Twas brillig, and Johannes Schill at 31/08/10 14:02 did gyre and gimble: I know this has been up before, but there were no good solution back then: Is there a good way to integrate phpbb (or similar software) with zend framework? What im looking for is to use phpbb's forum features and i want phpbb to use my zend framework authentication / user handling. Matthew gives pretty good advice here. I've integrated my ZF application with a couple different CMS's in the past (Drupal, Joomla) and there are always some fun issues to deal with (typically I've found that session handling are the most problematic). Thankfully both Drupal and Joomla support authentication plugins and thus it is relatively painless to integrate the auth layer with our ZF app. For the skinning mode, we do pretty much what Matthew suggests, but I managed to just create a Zend_Controller_Request object and dispatch it - but ensuring all our templates etc. are stripped down and don't product htmlhead output. We can then work out things like page title and even capture some stuff that should be injected into head etc. via the CMS provided methods. This means that the request is always initially handled by the CMS, and not directly via our app. This is fine for me but may not be in your case. This isn't always easy (the CMSs may use defines or variables that conflict with your own etc. but this can be mitigated with good programming practices - no globals, no functions (just static methods of classes to allow for a pseudo namespace - pre php 5.3!), no defines, just class constants etc.). Got it working pretty reliably now with this approach. Not tried it with PHP BB. 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] Re: Passing user/password to Zend_Soap_Server to load the wsdl
'Twas brillig, and robert mena at 29/08/10 13:17 did gyre and gimble: Hi, I have a restricted webservice (which means it uses the .htaccess to require a user/password). The server was built using Zend_Soap_Server with the autodiscovery option so I create it with new Zend_Soap_Server(url?wsdl). The problem is that the directory is protected so I get 401 error. Is there a way to specify the url with a user/password? Try: http://username:passw...@mydomain.com/whatever.wsdl 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] Re: Zend_Cache + Tags + Expiry = Exceeding max execution time?
'Twas brillig, and Colin Guthrie at 09/06/10 14:27 did gyre and gimble: 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. Just for reference, I've switched for now to an Sqlite cache backend and it solves the problem. I sadly could not use the Zend_Cache_Backend_Sqlite backend as I do not have the legacy sqlite2 support on my server and I can't be bothered to compile up all the necessary dependencies for a legacy library. So I wrote a new cache backend based on Zend_Db instead. It wont make much sense to use anything other than Pdo_Sqlite as a the adapter and that's all I tested it with, but I've posted the patch to: http://framework.zend.com/issues/browse/ZF-10013 for anyone that needs it. I will likely create a hybrid file+db backend at some point that will allow for unverified reads to come straight from the file rather than touch and query the database for extra performance in some scenarios. 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] Including controller implementations in ZF?
Hi, I'm thinking of writing a nice (self-contained) controller for my deployment that reads information from Memcache and present stats etc. Basically quite similar to the results here: http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/ but wrapped up in a Zend_Controller_Action. I'm also considering doing one for APC too (the above linked memcache script is a port of a APC one anyway). Now, I can ship these controllers in one of two ways: 1. Completely separate from ZF. 2. Bundled up inside the Zend_Cache_Backend... namespace With the second option, the user would be expected to extend the controller class in their own application. I believe some people are generally against this approach, which is why I ask here what is best. I think the bundled option is actually better in this case as it will make it generally easier and clearer to debug and display cache backend details/contents/stats and generally make the Zend_Cache_Backend_Memcache/Apc classes more useful and transparent. WDYT? 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] Re: Zend_Cache + Tags + Expiry = Exceeding max execution time?
'Twas brillig, and Steven Brown at 09/06/10 22:42 did gyre and gimble: 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). Thanks for the info. I'll give them a read over. I'll certainly turn off auto-cleaning, but even with the manual process I have to run for clearing all entries with a certain tag will still be problematic once the number of cached items grows too large. Most of the time, I actually don't want any automatic cleaning anyway (it's a denormalisation scheme, so the caches live forever provided they are valid - the tag system is used to ensure the right entries are removed when they become invalid). This makes a very efficient view system, but clearly the job of purging the invalid entries can be very time consuming and IO intensive :( I wonder if SQLite backed metadata storage would be feasible. The SQLite database itself would only need to be write locked when updating it which wouldn't be the common case 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] Re: Zend_Cache + Tags + Expiry = Exceeding max execution time?
'Twas brillig, and Steven Brown at 09/06/10 22:42 did gyre and gimble: 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/ Just wanted to say an extra thanks for your blog links. Makes for very interesting reading! 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] 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] Re: Zend_Form + error weirdness
'Twas brillig, and David Muir at 03/03/10 06:02 did gyre and gimble: Welcome to the wacky world of Zend_Form. :-) I believe what you're looking for is getErrorMessages() Ahh yes, I should have spotted that one :s It seems a bit bad practice to use the internal array for both associative and numerical indexes but hey ho. I don't need now as I said originally, but it's nice to know if I find this approach useful at some point in the future. Thanks for the reply! 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] Zend_Form + error weirdness
Hi, I'm a bit confused here. Say I have a form: $form = new Zend_Form(); then I set an error on it. $form-addError(It's broken); But when I try and retrieve that error it doesn't work. $form-getErrors(); // returns array(); but: $form-isErrors(); // true. Looking at the code, I see that the getErrors() loops through the elements and uses the element name to show the errors. Various other view helpers etc, also do similar things. The question I have is why is there an addError() method on the form object if the errors you add with it can never be used? I can see the value for subforms or elements as these inherently have names against which to attach the error. I think what I was ultimately going to do (pass a series of specific notes to be rendered after a PRG - in addition to a generic message via FlashMessage), I'll end up doing differently, but this is still a bit of a confusing part of the API for me so any clarifications would be appreciated. Col PS using 1.10.1 -- 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] Re: Warning for your error controllers: new 1.10.0 exception: Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE
'Twas brillig, and Nicolas Grevet at 01/02/10 16:52 did gyre and gimble: This is already covered here: http://framework.zend.com/manual/1.10/en/migration.110.html Ahh yeah. I probably should have read that first really :p Thanks. 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] Warning for your error controllers: new 1.10.0 exception: Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE
Hi, Just a small word of warning for those users using the error controller to take appropriate action. Previously (1.9.7) either EXCEPTION_NO_CONTROLLER or EXCEPTION_NO_ACTION was thrown when no route existed, but I'm now seeing the EXCEPTION_NO_ROUTE. For me this bit me on upgrade due to my use of an error controller to fall back to legacy (pre-ZF) code (e.g. my only app entry point is via my ZF bootstrap and dispatch loop). I have an error controller that catches this case and ultimately falls back to a legacy includer affair (it's not necessarily beatiful but it gives a clean code path for new stuff even if old stuff is a bit convoluted!) So just thought I'd send out a gotcha style email to let folks upgrading know this change in behaviour. Cheers and KUTGW! 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] Re: Changelog of 1.10.0
'Twas brillig, and Matthew Weier O'Phinney at 28/01/10 21:06 did gyre and gimble: -- Diego Potapczuk potapc...@gmail.com wrote (on Thursday, 28 January 2010, 03:25 PM -0300): It would be really helpful if the changelog were classified by components or alike. I'll see what I can do; we're limited to a large degree by what JIRA returns us (as the list is pulled from a filter defined in JIRA). From my perspective I tend to try and enforce a policy at work of prefixing the module name onto the commit message. This doesn't work 100% but it is useful when viewing the shortlog of changes to get a brief overview. Might be worth asking committers to do someting similar? 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] Re: Same predispatch in every controller. Where's a better place to put it?
'Twas brillig, and Hector Virgen at 25/01/10 00:02 did gyre and gimble: You can also do this without a base action controller. Action helpers have their own preDispatch and postDispatch hooks Are controller plugins not more appropriate here than an action helper? http://www.framework.zend.com/manual/en/zend.controller.plugins.html 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] Zend_Form_Element_File Description decorator is different from all the others. Any Reason?
Anyone know of a reason why Zend_Form_Element_File() doesn't use the standard Description decorator like all other form elements (p class=description...)? Just curious as to if I should fix+report it? 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] Re: Zend_Form_Element_File Description decorator is different from all the others. Any Reason?
'Twas brillig, and Thomas Weidner at 23/11/09 17:57 did gyre and gimble: What do you mean with standard ? Actually the file element uses -addDecorator('Description', array('tag' = 'p', 'class' = 'description')) This is the same decorator as within Element and Captcha. Other elements like Image or Submit don't have a standard description decorator. That is very strange. On my copy of ZF, it seems that the following patch was part of my transition from 1.7.1 - 1.9.1 @@ -78,6 +83,7 @@ class Zend_Form_Element_File extends Zend_Form_Element_Xhtml if (empty($decorators)) { $this-addDecorator('File') -addDecorator('Errors') + -addDecorator('Description') -addDecorator('HtmlTag', array('tag' = 'dd')) -addDecorator('Label', array('tag' = 'dt')); } This means it didn't used to have a Description decoration and now it has one, but it's not using the one you metnion above. But looking in svn trunk just now I see you are correct http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Form/Element/File.php Seems it was fixed in r18944 which will hopefully be released with 1.9.6 when it comes along. 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] Re: ZF 1.9.6 Sanity Check Tarballs ready
'Twas brillig, and Matthew Weier O'Phinney at 23/11/09 20:56 did gyre and gimble: Greetings! Thanks everyone for participating in the Bug Hunt Days last week! Many of the fruits of your labors will be released this week, with ZF 1.9.6. I've prepared some sanity check tarballs: * Full packages: http://framework.zend.com/releases/ZendFramework-1.9.6/ZendFramework-1.9.6.tar.gz http://framework.zend.com/releases/ZendFramework-1.9.6/ZendFramework-1.9.6.zip * Minimal packages: http://framework.zend.com/releases/ZendFramework-1.9.6/ZendFramework-1.9.6-minimal.tar.gz http://framework.zend.com/releases/ZendFramework-1.9.6/ZendFramework-1.9.6-minimal.zip At this time, we plan to release late tomorrow (Tuesday) or early Wednesday (EST). Please test and let me know ASAP if you discover any show stoppers. They all 404 here, is there some kind of cache or CDN here that needs sync time? 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] Re: Zend_Form_Element_File Description decorator is different from all the others. Any Reason?
'Twas brillig, and Colin Guthrie at 23/11/09 20:56 did gyre and gimble: Seems it was fixed in r18944 which will hopefully be released with 1.9.6 when it comes along. Just checked the 1.9.6 sanity packages and this fix is not part of it :( I guess maybe 1.9.7 then! 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] Re: Session charing with Drupal
'Twas brillig, and Anders Gunnarsson at 02/10/09 19:00 did gyre and gimble: I've got a site with ZF as base, but have Drupal running in a sub folder. example.com/ (ZF) example.com/drupal-site/ (Drupal) My problem is that I get different Sessions IDs in drupal pages then I do in ZF pages. I don't understand why, I thought in was php and apache itself that handled the session. Drupals session handling is pretty hacked up, registering various handling functions etc. There is nothing wrong with that per-se but it makes it a pain for integration :( In includes/bootstrac.inc, under the case fro DRUPAL_BOOTSTRAP_SESSION try commenting out the session_start() call and instead calling your own Zend_Session start instead and see if that fixes it up for you (does for me, but then I use drupal as a main entry point and run Zend Applications as a bridge component - that way there is only one site template - the drupal one - so styling is simpler. 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] Re: ZF Download 1.9.1
'Twas brillig, and Ralph Schindler at 13/08/09 15:01 did gyre and gimble: This happens. Generally, our process for launching a new version of ZF takes a few hours from start to completion. You probably saw this during the beginning of the phase of deploying the new packages. Think of it like DNS, sometimes the full updates doesnt hit all of the proper servers until minutes or hours later. Since we use a CDN for our packages, this is more often than not the delay you see. I still haven't seen a release announce mail about 1.9.1 even tho' it's been almost five days since it was first spotted grazing somewhere near the CDN :p 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] Re: [fw-auth] Zend_Acl fixes in trunk for assertions ZF-1721 ZF-1722
'Twas brillig, and Ralph Schindler at 31/07/09 19:43 did gyre and gimble: Awesome! Well, I plan to close these issues by the end of the day (or weekend) assuming no one else pipes up about how well the solution works :) Not had a chance to test the changes yet (still lagging behind on 1.7.x.!), but I'm sure they fix up the problem. I should be able to give them a good test next week sometime and will be sure to let you know if they don't fix things up for my use case :p Thanks for working on it. 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] Re: Zend_Form: Adding elements to an existing display group
'Twas brillig, and Hector Virgen at 30/07/09 18:56 did gyre and gimble: Hello, I am having some trouble with Zend_Form and display groups (ZF 1.8.2). I want to add an existing form element to an existing display group within the same form, but when I call $displayGroup-addElement($element), the element is re-added to the form, causing it to be rendered twice (once in the display group, and again outside of the display group). Here is my code (trimmed for clarity): class MyForm extends Zend_Form { public function init() { /* ... */ } public function addStandard(Standard $standard) { $name = 'standard_' . $standard-getId(); $this-addElement('checkbox', $name); $displayGroup = $this-getDisplayGroup('standards'); $displayGroup-addElement($this-getElement($name)); } } I have also tried just specifying the element's name, but that ends up in a fatal error: Call to a member function getName() on a non-object in /usr/share/pear/Zend/Form/DisplayGroup.php on line 433 I also noticed that I cannot create a display group without adding elements to it: $this-addDisplayGroup(array(), 'standards'); // throws exception No valid elements specified for display group This makes it difficult to create empty display groups as containers for the elements to be added later. I can get around this by creating the display group automatically when the first standard is added, but I am stumped on how to add the next standard to the existing display group. I run up against the same problem. In the end I had to tear down and recreate the display group each time I wanted to add an element to it. I totally meant to follow up for plumb forgot - sorry :s Here is the code I use to get the desired end result. Ugly, but hey. You can probably guess some element names but $el is the new element and the $displayGroupLegend/Description vars are also filled in prior to this code but can be overridden. $displayGroup is obviously the name of the display group in question. HTHs $this-_form-addElement($el); if (!empty($displayGroup)) { $curr_elements = array(); $dg = $this-_form-getDisplayGroup($displayGroup); if (!is_null($dg)) { // It seems that the only way to edit an existing displaygroup // is to remove and recreate it :s // This would appear to be a bug in Zend Form. $displayGroupLegend = $dg-getLegend(); $displayGroupDescription = $dg-getDescription(); $cur_elements = array_keys($dg-getElements()); $this-_form-removeDisplayGroup($displayGroup); } $cur_elements[] = $el-getName(); $this-_form-addDisplayGroup($cur_elements, $displayGroup); $dg = $this-_form-getDisplayGroup($displayGroup); if (!empty($displayGroupLegend)) $dg-setLegend($displayGroupLegend); if (!empty($displayGroupDescription)) $dg-setDescription($displayGroupDescription); } -- 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] Re: Bulk insert with Zend_Db or Zend_Db_Table
'Twas brillig, and Matthew Weier O'Phinney at 25/06/09 15:39 did gyre and gimble: One of the big hurdles with this is that not every DB flavor honors the syntax -- which means that we cannot have a single solution at the abstraction layer, but instead solutions for each adapter type. If a community contributor is interested in this functionality and willing to do the legwork to provide it to all offerred adapters, I'd love to help shephard a proposal through. I've had this kind of functionality in our database layer for a while and as I'm converting things slowly to ZF, this is one of the things I was going to take a look at eventually. It would be fairly trivial to create an API and a generic implementation that simply inserts one row at a time, so the the base implementation should Just Work(tm) on all adapters. Then it would be a simple case of providing an extended implementation that supports the extended insert syntax and letting those adapters that support this use that instead. If no one beats me to it I'll bash something out eventually - no guarantees on time-scale I'm afraid! 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] Re: Zend joined tables query
'Twas brillig, and Brenton Alker at 23/06/09 04:22 did gyre and gimble: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 awesome wrote: I am new in Zend and relational database design. I have two tables that I would like to join in one so that certain values from 1st table are replaced with associated values from another table. This query works: SELECT a.iditems, a.model, (SELECT name FROM headings WHERE idheadings = a.heading1) as heading1Name, (SELECT name FROM headings WHERE idheadings = a.heading2) as heading2Name from items as a; I would like to to this kind of query with zend... is it possible? What you're doing is subselects, not joins. You can do subselects in ZF by creating them as separate selects then combining them. But I don't think you actually need them in this case. Guessing based on the query, I think this SQL is equivalent: SELECT items.iditems, items.model, h1.name as heading1Name, h2.name as heading2Name FROM items INNER JOIN headings AS h1 ON h1.idheadings = items.heading1 INNER JOIN headings AS h2 ON h2.idheadings = items.heading2 I *think* (not tried) that the first statement will return nuls when no match is found in the subselect, so this is more like a left join rahter than an inner join. Logic still applies, but just s/inner/left/. Which can be done in ZF like: $table = new Model_DbTable_Items(); $select = $table-getAdapter()-select() -from('items', array('iditems','model')) -joinInner(array('h1' = 'headings'), 'h1.idheadings = items.heading1', array('heading1Name' = 'name')) -joinInner(array('h2' = 'headings'), 'h1.idheadings = items.heading2', array('heading2Name' = 'name'))) -where('iditems = ?', '1'); $rows = $table-fetchAll($select); (Untested) - -- Brenton Alker PHP Developer - Brisbane, Australia http://blog.tekerson.com/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkpASnAACgkQ7bkAtAithuuoVgCfcMS8QKR1iuHOnK5UaBp3bFKM shoAoJi67Mpm+Mo06XNo8/EvvHyMRAxt =TTYe -END PGP SIGNATURE- -- 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] Re: World, Country, town city database
'Twas brillig, and Mark Wright at 09/06/09 08:37 did gyre and gimble: These are flat files that you can edit into an importable format: http://geonames.usgs.gov/domestic/download_data.htm Personally I've had good experience with http://www.geonames.org/ Their data is world wide and contains lat/long data as well as just place names. They provide handy csv files you can import without much effort. http://download.geonames.org/export/dump/ (scroll down to read the readme) Personally, I think the best solution is to use Postgresql with the PostGIS extension. Then you can import shapefiles that not only contain names but also boundaries. You can then do spatial queries which far exceed what mysql is capable of. I'm not going to start the holy war here but MySQL's spacial capabilities are not too shabby these days: http://dev.mysql.com/doc/refman/5.1/en/spatial-extensions.html Not necessarily complete but still more than usable for many situations. YMMV 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] Re: ZF 1.8.2 no more ../../../ in my views!
'Twas brillig, and Vadim Gabriel at 29/05/09 08:51 did gyre and gimble: No he can't Take a look at : http://zendframework.com/manual/en/zend.view.migration.html so unless he explicitly specify the lfi protection to false the ../../../ method will not work on 1.8 and it's no recommended anyways. Ahh my bad. I thought when I read that before that ithe LFI protection only kicked in when the view *started* with ../ but I guess my memory is playing tricks on me or I didn't fully read it properly the first time round! -- 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] Re: ZF 1.8.2 no more ../../../ in my views!
'Twas brillig, and monk.e.boy at 28/05/09 16:33 did gyre and gimble: Hey, In my views I use a common pagination style across all my modules like this: ?= $this-paginationControl($this-paginator, 'Sliding', '../../../views/scripts/partials/pagination.phtml'); ? Changing it to this: /var/www/ZF-apps/views/scripts/partials/pagination.phtml does not work - I get a not found in path error. How do I make this change? How do you guys share a single pagination.phtml across all modules? While Vadim's solution is the most elegant, you could do the old dirname(__FILE__).'/../../../views' trick. 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] Re: [abit offtopic ...] Any integration with Paypal?
'Twas brillig, and iceangel89 at 23/05/09 05:18 did gyre and gimble: i am starting with creating a site that integrates with paypal. does zend framework has any integration with paypal? or is there any guides to help me get started? was looking in paypal sandbox site ... still playing arnd with it. Yes there is a Zend_Payment proposal with a working paypay prototype... just search the archives of this list - it was only posted a month or so ago. 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] Re: [abit offtopic ...] Any integration with Paypal?
'Twas brillig, and iceangel89 at 23/05/09 14:07 did gyre and gimble: hmm i better wait for it to be more stable 1st shldnt play with payments ... Well it needs people to use it and work with it for it to become stable :) -- 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] Re: Zend_Service_LiveDocx - Read for review
'Twas brillig, and Jonathan Maron at 18/05/09 11:43 did gyre and gimble: After much work, Zend_Service_LiveDocx is ready for review. This looks really interesting. I've not got a use for it right now, but I'll keep it in mind :) 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] Re: Zend_Layout for individual actions?
'Twas brillig, and lightflowmark at 05/05/09 17:12 did gyre and gimble: Hi Mike - will that only render to placeholders within the layout script, or can I persuade it to render to placeholders within index.phtml somehow? I wrote a very simple view helper that transfers a placeholder to a layout region. After calling captureEnd() you just call another helper and it is appended to that area in the layout. Is this what you're looking for? I can post it if you like? 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] Re: Zend_form and getValues = empty array
'Twas brillig, and denadai2 at 30/04/09 10:58 did gyre and gimble: I've a problem: using getvalues i have an empty array as returned values. This appens if i submit the correct form, an empty form or if i put some chars. $form = new forms_RegisterForm(); if ($this-getRequest()-isPost()) { $values = $form-getValues(); print_r($values); if ($form-isValid($_POST)) { } else { $form-populate($values); } } Look at the examples again. You've not told your form where the values are coming from. It doesn't know that you want to get them from POST, so it's effectively not populated yet. You can populate it manually, but it doesn't make much sense in your example above. Calling isValid() will populate the form with the values you give it. Try: if ($this-getRequest()-isPost()) { if ($form-isValid($this-getRequest()-getPost())) { $values = $form-getValues(); print_r($values); ... } } -- 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] Re: How to get the previous page
'Twas brillig, and iceangel89 at 29/04/09 09:33 did gyre and gimble: i want to find out what is the URL that called a controller/action so that after processing somethings (editing a record) i can go back to that exact page. i am using Zend_Paginator so say i came from page 2 editing a record, i want to return to page 2 There is no framework specific way to do this AFAIK. You can check for HTTP_REFERRER HTTP header when you first land on your edit page, but I would not rely on the browser setting that every time, as different browsers may handle this differently. What you could do is write something into a cookie or session variable when you are on a page that supports being returned to (e.g. search results etc.) and then use that info to go back. A combination of both methods may be the most reliable, but you may still want to code in a fallback for when no info is present (e.g. when their session has timed out login in another window and they've directly requested your edit page for example). 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] Re: Zend_Payment feedback
'Twas brillig, and Tim Fountain at 23/04/09 16:03 did gyre and gimble: I would also strongly recommend that you look into 3-D Secure authorisation and work out how you would build support for this into the component. It would be very difficult to add this in at a later date without breaking backward compatibility (which is a problem ActiveMerchant, the Ruby equivalent of this, is currently having). Just wanted to add a big +1 on 3D Seucre support. I think this is very important in a modern payment gateway system. It should be optional, but it should also be very simple to include it (I smell a view helper coming on!). 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] Re: Iterating through Zend_Paginator items
'Twas brillig, and dele454 at 24/04/09 20:55 did gyre and gimble: Oops! Thanks mate i see where i should have know better. Thanks for clarifying. Much appreciated. Incidentally, if you prefer to use object notation you can do: $arr = array('foo' = 'bar'); $obj = (object)$arr; echo $obj-foo; 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] Re: _forward(): multiple controller instanciation
'Twas brillig, and Jan Pieper at 14/04/09 12:29 did gyre and gimble: Why is it needed to create a new controller instance for each forwarding from one action to another without changing the controller and/or module? My init()-functionality is not able to handle multiple calls. Okay I can change it to avoid twice execution but why is it needed to have multiple instances of one and the same controller? Yeah I run up against this problem too. IMO the main dispatch loop should maintain a collection of controllers and only call $obj = new $controllerClass and $obj-init() once for each $controllerClass, then call preDispatch and action method as per normal. At present, I have some code in my affected controllers to only run them once... public function init() { static $done = false; if (!$done) { // Do one time stuff ... $done = true; } } It's not so bad but like yourself, I'd prefer to have this built in. 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] Marking required form elements with a background colour
Hi, I'm trying to achieve what I thought was a simple task, but turns out to be rather complex... I just want to double check that it's not a totally stupid approach. So I have a form, and I want to ensure that required elements are rendered with a nice background colour to indicate this to the user. Now it seems that the Label decorator will helpfully put a class into the containing dt element (by default it's a dt... I know you can change this). That's great, but it's not the containing element for the actual field itself, so it's not overly useful for the stylistic result I want to achieve. So the approach I've taken is to create my own decorator, call RequiredClass, all it does is add either a required or optional class to the element. In order for this to work, it has to be processed before ViewHelper decorator. As the forms may be reused in a different context, I do not want to apply the decorators at a base class level. I therefore created an action helper called DecorateForm. This means I can do something like: function fooAction() { $this-view-form = $this-_helper-decorateForm(new My_Form()); } In order to ensure that each element in the form has the RequiredClass decorator I do the following in my DecorateForm action helper: foreach ($form-getElements() as $el) { $decorators = $el-getDecorators(); array_unshift($decorators, new My_Form_Decorator_RequiredClass()); $el-setDecorators($decorators); } While this is all abstracted etc. and doesn't really get in the way, it seems like a bit of a long road for a shortcut! Is there a better way to achieve this end result? e.g. Would it be better to instead change the HtmlTag decorator to add the class to the containing element? In the default case, this would make the dt and the dd consistent in terms of the class attached to them. If this is desirable and acceptable, I'd happily make that change and submit the patch. Cheers for any insights. 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] Re: Marking required form elements with a background colour
'Twas brillig, and Colin Guthrie at 13/04/09 11:42 did gyre and gimble: In the default case, this would make the dt and the dd consistent in terms of the class attached to them. When I wrote that, I thought that the Label decorator attached the class to the containing tag element, not the label/ element.. I'm wrong, so this is incorrect. The rest of the comments are still valid tho' ;) 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] Re: Disable id attribute for form elements?
Matthew (and others), 'Twas brillig, and Matthew Weier O'Phinney at 01/04/09 12:11 did gyre and gimble: -- fire-eyed-...@hotmail.com fire-eyed-...@hotmail.com wrote (on Wednesday, 01 April 2009, 10:14 AM +): Thanks for the response again. I just read in an issue that this is made intentional behaviour: http://framework.zend.com/issues/browse/ZF-277 But I strongly disagree with this. Therefor I created a new issue: http://framework.zend.com/issues/browse/ZF-6174 I can't get to the issue tracker right now, but I can tell you now that I'm going to deny the request. The reason is two-fold. First, the design of the form view helpers since the very beginning has been to *always* create IDs. This is to make it trivial to get to the discrete elements using JavaScript, as well as to make testing easy (easier to select DOM elements by ID than other methods, though Zend_Dom_Query now makes it less of an issue). I don't want to go over old ground here, but I'm running up against a problem with this now too. In my case I have a dynamic javascript form, that allows users to filter a search. When they add a new filter, a drop down appears asking them to pick a filter, when this is selected, it loads a further part of the form asking them to pick a comparator (e.g. =, =, on, before etc. depending on the search term) and a value to go with it. So I get a form like: [ Choice of filters (v)] [ Comparator (v)] [ value ] (-) (+) Clicking the plus sign gives me a new row, and a new Choice of filters drop down to be displayed... picking somethign from this will fill in the comparator and value fields etc. etc. Now there is nothing to stop a user adding the same filter twice... (e.g. perhaps I want to filter my data based on creation date, I may want all items created after 1st Jan 2009 but before 1st Feb... therefore I will be adding two versions of this form element. Now this works fine, but the id's of the elements generated serve absolutely no purpose here. All of my code is not based on id, but on class (as it is dynamic and I can add/remove filters at will). In the above example: [ Created on (v)] [ After (v)] [ 1st Jan 2009 ] (-) [ Created on (v)] [ Before (v)] [ 1st Feb 2009 ] (-) (+) 1 2 3 Here element 1 is used purely in javascript, but never referenced by it's ID. The events and bindings etc. happen when the element is added and it works with AJAX in a purely relative fashion (e.g. manipulating the elements with certainly classes in the same containing element as itself). Elements 2 and 3 will be submitted with the form (both of them as arrays to allow for multiple filtering). This is surely a valid case for disabling the id attribute? Currently the methods that get the elements and return them are returning the elements directly (for direct use in ajax), so I do not need the form itself to be returned, just the rendered elements. So I do a: echo str_replace('id=foo', '', $el-setAttrib('id', 'foo')) Which works but it's clearly very, very hick. If there was any easy way to disable the id attribute from rendering, then I could produce my dynamic form quite happily. I think this is a fairly valid use case. If this description/use case isn't clear, please just shout and I'll clarify. To force ids on all form elements can actually make it much worse for working with javascript. The power of javascript can come from manipulating the dom, adding in new parts and extending existing forms dynamically etc. So while the premise is laudable (i.e. always generate ids to make working with javascript easier), it is fundamentally incompatible with some use cases. 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] Re: Using this Mailing List as Newsgroup
'Twas brillig, and Sebastian H. at 01/04/09 15:51 did gyre and gimble: is there a way to use this mailing list with a newsgroup reader? Yup. That's what I do. See http://gmane.org/ The group is: gmane.comp.php.zend.framework.general and there is even. gmane.comp.php.zend.framework.announce Job's a good 'un. :) I try to view all mailing lists like this, saves individual subscriptions and as you can see it still lets me post :) 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] Zend_Form + Flash Messenger
Hi, Apologies if this has been covered before, but I did search quite a bit and asked on IRC before posting! As per general recommendations, in my code, I never produce any output on a posted page, but instead issue a redirect header. This prevents the back button breaking and people accidentally double posting things when doing so etc. Great. In order to pass messages of the ilk Update successful/Update failed, I use the Flash Messenger. Also great. But I'd really like to pass the whole of the Zend_Form across with my messages so I can redisplay the form. I can't see anything obvious in the docs to do this, so will I just have to build something similar to flash messenger (or extend it) to accept adding a form to it. I presume due to the sub form support[1] and some other posts I've read[2], that Zend_Form is session safe? If it's not I guess I'd have to store the -getValues() (or -getUnfilteredValues() and the -getMessages()/-getErrors()/-getErrorMessages() and then pass then over, then set them on a recreated form with -populate() and -setErrors()/-setErrorMessages() or something like that. (I'm a little confused as to what the differences are between -getMessages()/-getErrors()/-getErrorMessages() are (and their set* counterparts. The API docs are far from clear on their use). Any help/insights appreciated. Cheers Col [1] http://weierophinney.net/matthew/archives/159-Zend_Form-Advanced-Features.html [2] http://www.mail-archive.com/fw-general@lists.zend.com/msg05573.html -- 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] Re: Zend_Form + Flash Messenger
'Twas brillig, and Fire Eye'd Boy at 01/04/09 20:10 did gyre and gimble: I usually only redirect if a post has been successful, otherwise I redisplay the form. Thanks for the suggestion, but I decided on a policy a while back and I'm going to try very hard to stick to it. The reason I'm not a big fan of your suggestion is that two failed attempts in a row and the back button will break. So I'll probably try to create something that allows the form (or it's essential data) to be passed through. I'll let this list know what I come up with. It'll probably be a flash form helper based on flash messenger or perhaps I'll just hack flash messenger. Time will tell :) 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] Re: Zend_Form + Flash Messenger
Hi Kevin, 'Twas brillig, and Kevin McArthur at 01/04/09 20:20 did gyre and gimble: Correction from last post http://framework.zend.com/wiki/pages/viewpage.action?pageId=42130 Thanks for this. It looks like the right approach, but I'll hack something up shorter term for my own use. The only comment (whcih I will add above) is that some mechanism (or naming convention?) for PRG in a multipage environment. To illustrate, I'd say something along like: Form has 3 parts/actions first, second and third, and a final step done. Naming convention is that we always post to current part-do. index - clearForm - redir: first Get: first user fills in form for first Post: start-do; if (isValid()) redir: second else redir: first Get: second user fills in form for second Post: second-do: if (isValid()) redir: third else redir: second||first Get: third user fills in form for third Post: third-do: if (isValid()) redir: done else redir: third||second||first Get: done user celebrates with a nice cold beer Essentially, the form which handles post never, ever produces output, but instead redirects appropriately to the right controller which will display the form and present the feedback accordingly. This will mean that even after multiple failures on a given step, the back button will still work correctly. That's my thoughts on it. I'll add to the proposal. 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] Re: Potential bug in Regex routing regarding the $reset parameter
'Twas brillig, and Colin Guthrie at 17/03/09 17:33 did gyre and gimble: Hi, Just looking to see if I've got any conceptual problems here prior to submitting a proper bug report/patch. In Zend_View_Helper_Url the reset parameter is documented as: Whether or not to reset the route defaults with those provided. I've always taken this to mean that if the route being assembled is the same as the one matched on the current request, do not use the values extracted from the current request when assembling if this argument is true. So question one is, is this assumption correct? Assuming I am correct, when I look at the assemble() method of Zend_Controller_Router_Route_Regex it's clearly evident that the $reset parameter is completely ignored and $this-_values is always used. So under this logic, it is impossible to e.g. link to the same route as currently matched but with different values for some params, but leaving others to be filled in by their default values when said missing params were actually supplied in the currently matched route! Phew, that last sentence was a hard one to follow, so I'll do an example. Say I have a route: new Zend_Route_Regex( 'foo(?:/([\w-]+)(?:/([0-9]+))?)?', array('module' = 'blah', 'controller' = 'blah', 'action' = 'blah', 'arg1' = bar, 'arg2' = 1), array(1 = 'arg1', 2 = 'arg2') ); If the following URL is matched /foo/bar/42 And I use a view helper to create a new link on that page via: $this-url(array('arg1' = 'oink'), null, true); Then I'd expect a route of: /foo/oink to be produced (because null will match the current route, and true says the current values should be ignored. However this actually produces a route: /foo/oink/42 As the value matched in the current route is not reset as you would expect. This is the same regardless of the $reset parameter so: $this-url(array('arg1' = 'oink'), null, false); will also produce the same result: /foo/oink/42 So, my second question: is this a bug, or am I misunderstanding what $reset should do? Well I presume that the lack of response to this question means it's probably a real bug or people just don't know, so I've submitted it (along with a patch) to: http://www.framework.zend.com/issues/browse/ZF-6065 for those who care :) 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] Re: Potential bug in Regex routing regarding the $reset parameter
'Twas brillig, and Wil Sinclair at 19/03/09 18:41 did gyre and gimble: If you've gone through the process of checking for the bug in the issue tracker already and asked here, we encourage you to file an issue. Worst case scenario, we'll close it as 'not an issue' with an explanation why. In any case, this will make us deal with it at some point. :) Yup, indeedy. That's what I did. I generally ask here first with thing that I'm not 100% about (e.g. if I've just understood things incorrectly). But there is an issue in the tracker now and a patch to boot! http://www.framework.zend.com/issues/browse/ZF-6065 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] Potential bug in Regex routing regarding the $reset parameter
Hi, Just looking to see if I've got any conceptual problems here prior to submitting a proper bug report/patch. In Zend_View_Helper_Url the reset parameter is documented as: Whether or not to reset the route defaults with those provided. I've always taken this to mean that if the route being assembled is the same as the one matched on the current request, do not use the values extracted from the current request when assembling if this argument is true. So question one is, is this assumption correct? Assuming I am correct, when I look at the assemble() method of Zend_Controller_Router_Route_Regex it's clearly evident that the $reset parameter is completely ignored and $this-_values is always used. So under this logic, it is impossible to e.g. link to the same route as currently matched but with different values for some params, but leaving others to be filled in by their default values when said missing params were actually supplied in the currently matched route! Phew, that last sentence was a hard one to follow, so I'll do an example. Say I have a route: new Zend_Route_Regex( 'foo(?:/([\w-]+)(?:/([0-9]+))?)?', array('module' = 'blah', 'controller' = 'blah', 'action' = 'blah', 'arg1' = bar, 'arg2' = 1), array(1 = 'arg1', 2 = 'arg2') ); If the following URL is matched /foo/bar/42 And I use a view helper to create a new link on that page via: $this-url(array('arg1' = 'oink'), null, true); Then I'd expect a route of: /foo/oink to be produced (because null will match the current route, and true says the current values should be ignored. However this actually produces a route: /foo/oink/42 As the value matched in the current route is not reset as you would expect. This is the same regardless of the $reset parameter so: $this-url(array('arg1' = 'oink'), null, false); will also produce the same result: /foo/oink/42 So, my second question: is this a bug, or am I misunderstanding what $reset should do? Thanks 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] Re: Issue ZF-3379
'Twas brillig, and Giorgio Sironi at 25/02/09 16:35 did gyre and gimble: Personally, I import zf at every release and tag it in subversion repository of my project; so before a new import I can diff my changes and reapply them after the import. I also leave patches on Jira so anyone who encounters the bug/problem can download it. They sits there as documentation of a bug and provide a workaround. Yup I use exactly the same approach here. Vendor branches and svn-load-dirs.pl are very useful :) 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] Re: Zend Framework Support Forums
'Twas brillig, and Matthew Weier O'Phinney at 24/02/09 13:40 did gyre and gimble: -- vadim gavrilov vadim...@gmail.com wrote (on Tuesday, 24 February 2009, 03:02 PM +0200): Just a general questions, Why isn't there a Peer-to-Peer Technical Support forums for the Zend Framework? I mean the mailing list is ok and we get our qeustions answered but having some kind of a forum where developers could share ideas, tips, help each other (without relying on the mailing list) and show some application examples (code snippets) will be a very good addition to the already large community of developers. With a forum software you could also easly search things that were already asked and answered, You could archive topics and posts (unlike the current mailing archive) and i think alot more. I am pretty sure this will just benefit the ZF developer community, The questions is why something like this wasn't already made? We have an IRC channel: #zftalk on Freenode. If you want immediate connection to other developers and want to share code, that's the best place to go. We explicitly made the decision not to do a web-based forum as we wanted to minimize the number of support channels we needed to monitor. Most of the internal team are not fond of forums and prefer email as it's easier to filter and manage; when you're dealing with many thousands of messages a month, a forum becomes too difficult to monitor. However, we *have* integrated the mailing lists with Nabble, which gives many of the benefits of a forum, while still keeping the benefits of a mailing list. We have Nabble embedded on the archives page: http://framework.zend.com/archives and you can search posts there. Huge +1 from me. Personally, If find forums a PITA. They are great for one-off help or for hobbyist, but for people who work on this stuff day in and day out, having mailing lists is, quite frankly the *only* way to go. To elaborate, I am currently involved with about 25 different projects in one way or another. In total this works out at about 40 different mailing lists I subscribe to and try to keep vaguely abreast of. If this were done through forums, I would have to login to at least 25 different websites to check for new and interesting things people have said. This means my daily trawl would take me to multiple different website, with different styles, layouts and fonts. In the end this would probably take several hours. With mailing lists I have one simple UI I can use. The information is pushed (or if you use e.g. Gmane.org as I do, pulled via NNTP) into your preferred client software to organise as you see fit. Standard layout, standard ways of threading, standard fonts and colours. This makes keeping up to date possible for me. Doing things with forums would simply not work. So while I think forums have their place, it would just not feasible for me to participate in the projects I do if they used forums as their primary communications channel. This is also why rules on HTML emails (don't send them!) and accepted practices (e.g. selective quoting and no top-posting) are generally good ideas. Consistency means efficiency when you are dealing with multiple projects and lists! I didn't mean the above to sound like a rant, but it came out a bit like that!! :p 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] Re: Sharing controller plugin results with the controller
'Twas brillig, and sinkingfish at 20/02/09 11:48 did gyre and gimble: How do I share the acl generated in the plugin with the controller? Assuming you will only need one instance of your ACL class, just use the singleton pattern. You have your acl object in a singleton form (it's constructor is private and a public static getInstance() method that creates the class on first call and stores it to return on future calls). e.g. class My_Acl { private function __construct() { // Complex stuff } public static function getInstance() { static $instance = null; if (is_null($instance)) $instance = new My_Acl() return $instance; } // other public methods etc. } In order to get your ACL object in your code where you need it, you just call: $acl = My_Acl::getInstance(); The first time you call it the contructor will be called, on subsequent calls it will already be built. Job Done. You could also use Zend_Registry, but I much prefer this method when you can use it. I always feel that Zend_Registry is kinda cheating and is not too much better than global variables (not that I don't cheat myself sometimes :)) 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] Re: SECURITY ADVISORY
'Twas brillig, and GeorgeNLog at 20/02/09 09:14 did gyre and gimble: In other hand, I'm reading about LFI but don't understand where to fit this into a situation where a user can set the script path. Could you explain a real scenario where the user provides this (the script path where he wants to go)? There was an example on the original link: http://framework.zend.com/manual/en/zend.view.migration.html It's only when you pass unchecked user input directly into render() that there is a problem. If your app never does this, then you can safely disable LFI protection. 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] Re: Quick Question
'Twas brillig, and dele454 at 20/02/09 07:34 did gyre and gimble: Hi, I have this issue that's been lingering in my codes. Whenever i use the Zend_Mail or Zend_Captcha or any component that generates some kind of resource, i always get such resource twice. In context, if i use the Zend_Mail to send out mails - will recieve the same copy of that mail twice. Likewise for captcha, the image will be generate twice and saved in my captcha image location - though with two different texts on them. I have tried all sorts to recitfy this but to no avail. Any reason why this is so? I'm guessing that your dispatch loop is running twice for some reason... either that or you are handling it in the pre/postDispatch methods of a controller that you actually initialise twice (e.g. by running an action of that controller via an actionStack()). I'd imagine something like that is happening. You can easily test this by copying the Dispatcher class and sprinkling it with log calls. 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] Does this list filter and block certain mails?
Hi, Just wondering why some of my messages never seem to reach this list. I do use Gmane, so the problem could be there, but the list has consistently dropped a message I've tried to send three times now while other messages (like this one) and replies seem to get through fine. I don't get any feedback (possibly due to Gmane again) so it's a bit hard to work out why they are blocked. I do have code examples in them but I presume that shouldn't stop things from working... Any ideas? 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] Re: SECURITY ADVISORY
'Twas brillig, and Wil Sinclair at 18/02/09 03:51 did gyre and gimble: The Zend Framework team has been notified of a potential Local File Inclusion (LFI) attack vector in Zend_View's render() method. To address the issue, as of the 1.7.5 release the render() method no longer accepts paths that include parent directory traversal (e.g., ../ and ..\) in the path argument. This introduces a regression in behavior which can be addressed by turning off the lfiProtectionOn flag. For more information, see: http://framework.zend.com/manual/en/zend.view.migration.html Interesting. Out of curiosity, does this only apply to the values passed in to render() or also to the script paths themselves? My base paths tend do have ../ in them (dirname(__FILE__).'/../views' or something similar). Obviously you'd hope the app knows best in this regard so I hope this is permissable. I'll have a play later this week and find out :) 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] Re: SECURITY ADVISORY
'Twas brillig, and Matthew Weier O'Phinney at 18/02/09 13:07 did gyre and gimble: -- Colin Guthrie gm...@colin.guthr.ie wrote (on Wednesday, 18 February 2009, 09:09 AM +): 'Twas brillig, and Wil Sinclair at 18/02/09 03:51 did gyre and gimble: The Zend Framework team has been notified of a potential Local File Inclusion (LFI) attack vector in Zend_View's render() method. To address the issue, as of the 1.7.5 release the render() method no longer accepts paths that include parent directory traversal (e.g., ../ and ..\) in the path argument. This introduces a regression in behavior which can be addressed by turning off the lfiProtectionOn flag. For more information, see: http://framework.zend.com/manual/en/zend.view.migration.html Interesting. Out of curiosity, does this only apply to the values passed in to render() or also to the script paths themselves? My base paths tend do have ../ in them (dirname(__FILE__).'/../views' or something similar). Obviously you'd hope the app knows best in this regard so I hope this is permissable. Just the paths passed to render(). The original report was actually about the paths passed to addScriptPath(), but the examples showed using user input to specify those paths -- which is, quite simply, a really, really bad idea in the first place. Additionally, it's not uncommon to use relative paths when determining the view script paths, which would have made this a difficult hole to close. Excellent. This validates my thinking on the subject too which makes me feel I'm getting close to understanding all this jazz with some degree of accuracy ;) Cheers again. Col /me now wonders why the three attempts to post a new message to this list have vaporised into the ether :( -- 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] Re: OO getParam in __construct
'Twas brillig, and PHPScriptor at 14/02/09 15:23 did gyre and gimble: Ok, maybe I'm totally wrong but can I do something like this and how: class MyController extends Zend_Controller_Action { public $value public function __construct() { if($this-_request-getParam('value')) $this-value = $this-_request-getParam('value'); else $this-value = 0; } ... } is this possible? I want to set my $value so that I can use it in all my actions (when called). But the value can be a default (0) or it can be passed by getParam. Don't know if this is the correct way. Maybe someone can help me with this. Read the docs some more! You should implement the init() method which gets called after construction. You can then use the value in all your actions and/or the preDispatch() and postDispatch() methods too. 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] Re: [OT-PHP] Insert an associative array at beginning
'Twas brillig, and Deepak Shrestha at 11/02/09 07:56 did gyre and gimble: Hi, I got confused on why this is not working. I have an array of locations stored in $location variable which is fetched using fetchPairs(). I wanted to add and element Any = Any at the beginning of this $location. so my $locations is [from Zend_Degug::Dump($locations)]: = array(3) { [location1] = string(9) location1 [location2] = string(9) location2 [location3] = string(9) location3 } = I used: === array_splice($locations, 0, 0, array(Any = Any)); Expecting: array(4) { [Any] = string(3) Any [location1] = string(9) location1 [location2] = string(9) location2 [location3] = string(9) location3 } But I am getting: array(4) { [0] = string(3) Any [location1] = string(9) location1 [location2] = string(9) location2 [location3] = string(9) location3 } Why? Thanks If it's associative arrays you are working with, a simple: $loc2 = array('Any' = 'Any') + $locations; will do the job. 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] Re: How to contact the Zend Framework team about OOP bad practices/suggestions?
'Twas brillig, and Benjamin Eberlei at 11/02/09 17:03 did gyre and gimble: you should create an account at http://framework.zend.com/issues and file issues against Zend_Db, put their alert level up based on what you think is necessary. Also make sure not to put all the things into one issue, but split them up so that they are unique items to be worked at. ... and supply patches ;) 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] Re: Pushed on ActionStack with custom module/controller/action, yet they persist
'Twas brillig, and Aspra Flavius Adrian at 09/02/09 21:04 did gyre and gimble: Hi. In my Zend_Controller_Plugin_Abstract::routeStartup() I'm pushing custom actions to the actionstack. The problem is that $this-getFrontController()-getRequest()-get[Action|Module]Name() inside my Zend_Controller_Action::postDispatch() return the same module/action as in the URL, but in the controller plugin I'm calling $actionstack-actionToStack('navpane','index',$module); Do you have any idea what could cause this? Try: $this-getRequest()-get[Action|Module]Name() I've found that the request here is correct, vs the Zend_Controller_Front::getInstance()-getRequest() version which always has the details of the original request. HTHs 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] Re: Zend_Paginator and Action helper (or Actionstack)
'Twas brillig, and Marko Korhonen at 05/02/09 18:31 did gyre and gimble: Hello, I have a hard nut to crack. I'll try to explain my situtation: My Default_IndexController::indexAction is my frontpage. I use action helper to call another controller/action: Somemodule_ListController::latestAction There I have Zend_Paginator working nicely. This results my list to be rendered to the frontpage as sidebar block. Ok, next I'd like to have my list pagination controlled by ajax so I attach javascipt functions to pagination links. But the problem is following: Zend_Paginator partial uses url() view helper to create first/previous/next/last links to the list. Now becouse I used action helper, url() helper points all links to my frontpage = /default/index/index/page/2. I know this is becouse request object is the same as in my frontpage which is making the action call. So, I can't have my Ajax controls pointing to the right place =( Any thoughts? I just ran up against a very similar problem. What I have is: 1. A URL that can display paged links. In my case I use query strings as the URL structure is reserved for other uses. So I have e.g.: /administrator/entries?p=2 This is the main page (incl layout via Zend Layout) and works fine. But if I just want the segement of the page that is jsut the paginated results, the partial URL is: /administrator-part/somemodule/entries/list?p=2 To get these two types of links, I just rolled my own view helper to make things easier (I also had to pass through other params such as a q=foo argument) but really it's just about setting up the two different routes, one for the full layout page and one for the partial page and passing the route name as the second argument to url(). That way you can generate full page links for the href= bits and pass the partial page for an ajax thing. That way if the ajax bit fails, it still falls back gracefully to the href and full page reload. 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] Re: Zend Framework 1.7.4 is now available!
'Twas brillig, and swilhelm at 04/02/09 17:30 did gyre and gimble: Wil's post had an unfortunately line break. Issues list can be found http://framework.zend.com/issues/secure/IssueNavigator.jspa?requestId=10944 here (login required). X-MimeOLE: Produced By Microsoft Exchange V6.5 It's a sad state of affairs, that even after all these years, MS just gets email so very, very wrong :( I mean getting the fundamentals of email (like quote markers, and top posting by default) wrong in the early days meant that bad precedents that are hard to break now were created is bad enough, but Outlook rendering HTML mails with Word's rendering engine??? How much crack had been smoked that day when they thought that was a good idea?? (while this rant may be a little off topic, it's important to consider that Word's HTML renderer supports very little in the way of CSS so when you produce nice HTML emails in your web-app, make sure you stick to 1990's display techniques!) Anyway, thanks for the 1.7.4 (and every other) release :) 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] Re: Zend_Form using GET - How to set array in url params? Control sent params?
'Twas brillig, and Matthew Weier O'Phinney at 02/02/09 23:07 did gyre and gimble: -- drj201 drj...@gmail.com wrote (on Monday, 02 February 2009, 02:05 PM -0800): I have a Zend_Form object which uses the GET method of submission. Creating a new instance of my zend form and displaying it in the view works fine. By default, on submission of the form the browser is directed to the set action in my Zend_Form and the GET params are set to include those elements from my form such as: http://www.example.com/search?index=newssubmit=submit Question 1) Can I specify which GET params to pass to my form action? For example the submit=submit is not needed and is included by default because of the 'submit' element specified in my Zend_Form. No -- HTML forms submit all elements in the form (with the exception of unchecked checkboxes, for some reason). Yeah I asked the same question on IRC the other day too... it's very annoying having to name your submit button which in turn causes it to be submitted with the form. Could we perhaps have some kind of logic in Zend form that suppresses the name= attribute from being generated? I'd imagine a $element-noSubmit(true); or -unnamed(true) or whatever would work... but that said I've not delved into the Zend Form code much so I don't really know the consequences. Certainly, it's something that bugs me, but not so much I loose sleep over :) 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] Re: Zend_Form using GET - How to set array in url params? Control sent params?
'Twas brillig, and Colin Guthrie at 03/02/09 13:46 did gyre and gimble: 'Twas brillig, and Tim Fountain at 03/02/09 10:00 did gyre and gimble: There can be good reason to include the name attribute on submits. E.g. your form might contain two submit buttons ('Approve' and 'Reject'), and you use the submitted name in order to determine which was pressed. Personally, I don't like that approach as it use UI/i10n elements to determine application logic. 'Approve' and 'Reject' would have to be compared to their i10n versions in a multilingual app and it just doesn't feel right to do that. Perhaps I'm alone with this opinion tho' :) Incidentally, while the above is my opinion, I wasn't originally suggesting all submit elements do not have a name= field... just that it could be made optional. But as Til suggested I'll see if I can roll my own :) 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] Re: Zend_Form using GET - How to set array in url params? Control sent params?
'Twas brillig, and Tim Fountain at 03/02/09 14:23 did gyre and gimble: Sorry, my example wasn't very clear. The 'name' of the elements would be what you'd check in your application logic, and these are never shown to the user. 'Approve' and 'Reject' would be the 'value' of the submits, so these could be anything depending on your i10n settings. I think it was me who wasn't seeing it :) Yup, I see what you mean. Just check to see that !empty($_POST['btnAccept']) and you're happy. Fair point, but I still say it's ugly on a GET form when all you want is a ?q=fooo style argument but I accept the usefulness of being able to submit, erm, submit elements... just not in all cases :) Like I said already tho', I should be able to do that if I poke about enough. Cheers 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] Re: Zend_Form using GET - How to set array in url params? Control sent params?
'Twas brillig, and Tim Fountain at 03/02/09 10:00 did gyre and gimble: There can be good reason to include the name attribute on submits. E.g. your form might contain two submit buttons ('Approve' and 'Reject'), and you use the submitted name in order to determine which was pressed. Personally, I don't like that approach as it use UI/i10n elements to determine application logic. 'Approve' and 'Reject' would have to be compared to their i10n versions in a multilingual app and it just doesn't feel right to do that. Perhaps I'm alone with this opinion tho' :) 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] No announce for 1.7.3PL1
Hi, Just wanted to point out that 1.7.3PL1 didn't seem to get a release announcement. Also the Version.php file does not reflect that this is not the same version as the original 1.7.3. While I believe the changes were minimal and also noted in the 1.7.3 official release, would it not have made more sense to call this a 1.7.3.1 release? That way everything works as expected and is transparent etc.? Can't say I feel overly strongly about this, but figured it was worth mentioning :) 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] Re: No announce for 1.7.3PL1
'Twas brillig, and Wil Sinclair at 27/01/09 17:01 did gyre and gimble: We decided not to do a release announcement for patches. We've released them in the past for other packages like GData and didn't announce them then. Plus, there are no new features, bug fixes, etc., so it's not much of an announcement. :) If it would help avoid confusion, I can send a quick note to fw-general if we ever have to patch again. Thanks for the explanation (especially Matthews explanation of version_compare() usage - although as this is used inside Version.php, should the actual VERSION constant not be set to 1.7.3PL1 in there rather than left as 1.7.3 which is how the 1.7.3 release went out?) A quick headsup email would be good, although I think an official announcement on the zf-announce should also be sent. Many users will be using this as their only means of keeping up to date on things and surely even a patch to a release (which, let's face it is just another way of saying there were some bugs that we've now patched) is worth letting people know about? 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] Re: No announce for 1.7.3PL1
'Twas brillig, and Yannick Mortier at 27/01/09 19:43 did gyre and gimble: A patch level can also mean that there were just some smaller issues fixed or it had to be released quickly because of security issues. So there is no need for an announce of changes because there are usually none. So if a release is rolled out quickly due to security issues, there is no need to announce it? The logical extension of that is that those people running the potentially vulnerable software don't know there is a problem and therefore do not update it. That really doesn't make sense! (and yes, I know this particular case was not a security issue!). 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] Re: No announce for 1.7.3PL1
'Twas brillig, and Wil Sinclair at 27/01/09 20:20 did gyre and gimble: It was released due to a missing 'require' in the ZendX_JQuery component. Incidentally while looking at the ZendX_JQuery stuff today I noticed a prefix of ZendX_Dojo which is odd: $ grep -rn Dojo * JQuery/Form.php:45: -addElementPrefixPath('ZendX_Dojo_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator') I suspect it's a copy/paste error? I'm sorry that I didn't send out an announcement, but I really didn't think that this was significant enough to warrant one. Given the community's reaction, I'm thinking that it wasn't significant enough to issue the patch in the first place. I'll review 'to patch or not to patch' decision in more detail going forward and announce it on the contributors, general, and announce lists if we patch a release in the future. I didn't meant to open a can of worms here :( I would certainly not want to discourage you issuing the patch release or similar, it's just that any release without an announcement just feels wrong to me: you may spend some time debugging an issue in what you think is the most recent version only to find when you report the bug that it was fixed in the PL release and it's just that you didn't realise this was available because you did not look at the download page first. Even just a very quick announce with a totally cut down message saying e.g. patch release 1 has fixed a minor issue, see the 1.7.3 announcement for the full details of the 1.7.3 release would have been appreciated. I don't know if this process of sending such a mail to the announce list is awkward or not (due to moderation processes etc) or whether such a short announcement would be permitted. Anyway, like I say I don't mean to criticise and I do appreciate all your work :) 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] SQL_CALC_FOUND_ROWS with Zend_Db_Select
Hi, Is there a way to inject this into SELECT statements? This is typically very useful when paging and getting the correct number of results without having to re-run the query twice once with and once without the LIMIT/OFFSET components. e.g. SELECT SQL_CALC_FOUND_ROWS * from blah LIMIT 10 OFFSET 10; then SELECT FOUND_ROWS(); If this is something that would be accepted into ZF upstream, then I'll happily code it. It's more or less the same as $select-distinct($flag) function call. The select found rows things could be left to the user. So, I'm just asking if this would be accepted? If not I'll try and work out another way of achieving the same result without hacking ZF. 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] Re: SQL_CALC_FOUND_ROWS with Zend_Db_Select
'Twas brillig, and Dennis Becker at 26/01/09 10:54 did gyre and gimble: This is slower in comparison with a 2nd SELCT COUNT(PRIMARY_KEY_COLUMN) FROM blah - look at http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/ An interesting, if not always accurate (according to the comments) analysis. In some cases tho', due to the kind of select statement your running you'd have to do: $select-reset(Zend_Db_Select::COLUMNS); $select-reset(Zend_Db_Select::GROUP); $select-reset(Zend_Db_Select::ORDER); $select-columns(new Zend_Db_Expr('COUNT(DISTINCT table.pri_key_col)')); Depending on the use case, it could be faster/slower than the calc_found_rows technique. I always heard that with innodb that select count(*)'s were pretty inefficient anyway, but perhaps that no longer holds true. Either way, it's actually very simple to support this in Zend_Db_Select (I've already coded it up in an extended class), so I'll submit the patch upstream for inclusion in a future ZF release anyway. Cheers 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] Strategy for storing multilingual content in the database.
Hi Guys, I'm just wondering is there is a good Zend Framework-based methodology for storing multi-lingual content in a database? I know that there are several structures for doing this kind of thing, including tables of strings that include language identifiers and such like, but these can often be complex and hard to model. What I've done in the past is create some custom UDF functions in MySQL to pack multi-lingual content into a single field. I would do something like: INSERT INTO table SET field=LANG_PACK('en', 'Hello', 'fr', 'Bonjour'); I could then do: SELECT LANG_EXTRACT(field, 'fr', 'en') FROM table; which would give me back 'Bonjour'; or SELECT LANG_EXTRACT(field, 'de', 'en', 'fr') FROM table; which would give me back 'Hello' as no 'de' translation was found. In the past, I've generally integrated the call to LANG_EXTRACT into an API call in my db layer so when extracting the language for the current locale the app is running in is trivial - so in ZF parlance something similar to this: $db-select()-from('table', $db-langField('field')); (where $db-langField() would returns a Zend_Db_Expr). This has the advantage that only the correct language comes out of the database layer, and there is no logic required in the application. As the MySQL functions are written in C and the packed language format includes a header which contains exact byte locations of the substring we want and thus can return the data quickly. It also handles falling back to 2nd or thrid choice of language if the data is not present in the preferred language. Personally I really like the approach of dumping this logic into the db layer. It keeps the application logic quite simple. Some other MySQL functions allow for full extraction of the data in XML (LANG_XML()) format and thus allow for the creation of an editing interface that shows all languages (e.g. as tabs). Other functions include LANG_UPDATE() and LANG_PACK_XML() to perform what their name suggests. Now all of this is very non-standard. It works for me and I find it quite efficient and effective for my needs... there are however several disadvantages: 1. Indexing: The db layer cannot index this content particurly well, and comparing the result of a function is not that efficient as it needs a full table scan. 2. It requires custom functions to be compiled and installed on the db server. While this is quite simple, it's obviously an sysadmin overhead. So my basic question is, is there a standard way to do this kind of thing in ZF? Perhaps there is a construct in the ZF db layer (or such a construct could be create) to store the multilingual data in XML and extract out the specific string from the XML semi-transparently? This is kind of the opposite to Zend_Db_Expr where you define something that should be passed to the DB directly. I'd propose a Zend_Db_Filter which would have a way to know what expression to select ($f-getExpr()) and know that before the data is returned to the caller, it should be filtered ($fiels = $f-filter($field)). (This kind of filter could be useful for other things too, e.g. for creating an image object from raw image data etc.) Going back to my above example: $db-select()-from('table', $db-langField('field')); $db-langField() would return a Zend_Db_Filter object and the field itself would just store e.g. XML. I don't want to ramble on here and go off on too many tangents, so I'm just really canvassing ideas/opinions as to how this kind of thing could be done and what improvements can be made to ZF to support this. Thoughts? 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] Re: Quick question re an XSLT based Zend_View
'Twas brillig, and Matthew Ratzloff at 16/12/08 16:47 did gyre and gimble: FWIW, I'd like to see something like this. I had another message off list with a that would be interesting type response, so I'll see what i can knock up over the holidays (assuming my workload is eased somewhat!) 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] Re: Quick question re an XSLT based Zend_View
'Twas brillig, and Colin Guthrie at 11/12/08 11:54 did gyre and gimble: Hi, I'm in the position where I'd like to use XSLT scripts to render parts of my output (probably partials). In order to achieve this, I think it makes sense to create a Zend_View_Xslt class that implements Zend_View_Interface. That much makes sense. That said I'd be surprised if noone has done this before or not thought along the same lines :) I did find a partial reference in the following PDF (slide 15): http://slides.liip.ch/img/documents/zf-webtuesday.pdf And just a simple google shows a few references to such a concept but I'm not seeing anything concrete. Can anyone point me at something specific, or should I just roll my own for now and look to get it upstream (proposal, incubator etc.) as I become happy with it? OK, I take it from the lack of replies on this topic that there genuinely is nothing out there based on XSLT in terms of view code? I'll just mash something up myself for now and work on upstreaming it when I'm happy with the results. The general idea will be to use it to produce little blocks of views and thus it will probably be pretty thin on the helper integration front, but that's fine for my purposes. 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] Quick question re an XSLT based Zend_View
Hi, I'm in the position where I'd like to use XSLT scripts to render parts of my output (probably partials). In order to achieve this, I think it makes sense to create a Zend_View_Xslt class that implements Zend_View_Interface. That much makes sense. That said I'd be surprised if noone has done this before or not thought along the same lines :) I did find a partial reference in the following PDF (slide 15): http://slides.liip.ch/img/documents/zf-webtuesday.pdf And just a simple google shows a few references to such a concept but I'm not seeing anything concrete. Can anyone point me at something specific, or should I just roll my own for now and look to get it upstream (proposal, incubator etc.) as I become happy with it? 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] Re: Sharing a session between 2 hostnames
'Twas brillig, and Jan Pieper at 10/12/08 13:21 did gyre and gimble: Store session data in memcached. http://kevin.vanzonneveld.net/techblog/article/enhance_php_session_management/ That wouldn't solve anything, the problem is the cookie that is stored on the client (typically PHPSESSID) is only submited to the one domain. The fact that the server keeps it in memcache is technically irrelevant. If the user does not supply the right key, they wont be able to load their session data. Where memcache comes in useful is if the same session needs to be accessed on two web *servers* (not just hostnames!). 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] Broken Zend_Db_Select::joinUsing() for several releases
Hi, I'm just getting around to converting some queries in my system to using Zend_Db_Select (in the cases where I need such specific functionality). I was a little surprised to uncover a bug in Zend_Db_Select as I'd expect this is one area that is fairly heavily unit tested (i've not looked, it's just a guess) and also an area that quite a few people would use. But I noticed that it is producing incorrect SQL. It's not that fact that joinUsing() does not actually use the SQL USING() clause (I'm not sure how standard that is to be honest - could be a MySQLism), it's more the fact it totally messes up when table aliases are used! I found this bug: http://framework.zend.com/issues/browse/ZF-3309 I was very surprised to see that this was added in May, well over six months ago. While I've been using Zend for a while, and not been hit by this bug, I'm surprised this kind of thing has been left unfixed for so long! I'll try and work on a fix as without it I'll have to write a whole heap of more verbose code that I'd rather do without! 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] Re: Broken Zend_Db_Select::joinUsing() for several releases
'Twas brillig, and Ralph Schindler at 05/12/08 15:20 did gyre and gimble: Hi Colin, I'll try and work on a fix as without it I'll have to write a whole heap of more verbose code that I'd rather do without! Do you have any interest in taking this on? Fixing it? If so, great! In the mean time, I will reassign to myself and work up a unit test for it. It seems like it could be a relative easy fix. I've attached a fix to the ticket now (no idea if it's the perfect fix or not but I just copied the code from _join() a little and threw out some bits that were not needed), so hopefully it will pass your unit test :) Sadly while doing that work, I noticed another problem which I reported as: http://framework.zend.com/issues/browse/ZF-5165 which means that chaining multiple joinUsing() calls one after the other does not link one table to the next, it always goes back to the original from() table which is quite different to the SQL USING() syntax. Sadly, even if I fixed that, I'm not sure it would be allowed in as it would change the nature of the call (even although it is not mentioned in the docs if this is the intended behaviour or not). So not quite sure what to do there. 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] Re: Zend Mailing Lists [All]
'Twas brillig, and netlynx at 03/12/08 17:33 did gyre and gimble: netlynx wrote: I have been subscribed to the groups here for a while, and I am somewhat versed in pulling rss feeds and atom feeds and storing them in a database. What I am wondering is, is there a feed for these mailing lists (as opposed to downloading them via e-mail and filtering them into folders). Long explanation short, are the Zend Framework Mailing Lists available via RSS feed? (download only, not posting that is). Thanks Aaron Oh and just to clarify (laugh), I realize that I could register a mail account specifically to receive the groups and have PHP/Zend Framework handle the incoming messages. I am more-so looking for a feed (pull) as opposed to a mail (push) type scenario. Are you familiar with the concept of News Groups? (NNTP). This technology dates back a good few years and is arguably where mailing lists originated. Well, I personally use GMane which is a Mailing list to News Group gateway service. It's totally free and allows your pull based approach with the added advantage that it allows posting too! Most mail clients (e.g. Thunderbird, Outlook etc.) allow you to configure a Newsgroup account (it's really very similar in concept to IMAP), and failing that there are several very nice standalone newsgroup apps. As I participate in quite a few open source projects, I use Gmane whenever I can to save subscribing to yet another mailing list. It's almost certainly *exactly* what you want functionality wise, provided that not having it in RSS form is acceptable. http://www.gmane.org/ Col PS That's is why my email address is as listed. I used this address for all my gmane groups... If it get's overly spammed I just have to change it and reauthenticate myself (sometimes this does require subscribing to various mailing lists too as the authentication system doesn't always integrate fully, but you can turn off mail delivery on pretty much every mailing list out there, so the registration is only to allow you to post). -- 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] Re: Zendx Jquery Datepicker custom viewscript
Benjamin Eberlei wrote: when you want to seperate design and programming with zend form you can remove all markup decorators from the elements and just place them with ?= $form- element1; ? i think (or was it ?= $form-getElement('element1'); ?). designers can then build the markup while the programmers just build forms that dont have markup decorators (like htmltag, label, dd/dt). Of course the downside with that approach is that if you add a new element to your form, you have to inform the design team and ensure they add that element in. IMO it's probably better to establish a solid structural decoration plan of your forms and try not to vary that. The developers work with it from a structural perspective and the designers work with it from a CSS/styling perspective. If you have to change it, then do the whole let's actually talk/share information thing between the two teams. I think that is a more efficient approach than the more verbose way of essentially replicating knowledge of what the form contains on both logic and view sides of the fence. 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] Re: Zend_Acl howto know isAllowed is false due to assert fail?
Julian Davchev wrote: Hi, Lets say I have this snippet some code already for creating acl object $acl-allow('baby','house','break',$hadMilk); So how do I know i $isAllowed = $acl-isAllowed('baby','house','break'); // so if $isAllowed === falsehow do I know this is due to $hadMilk assert is false or just no such allow rule there? I think a question I would ask is why do you need to know this? Abstraction is good! Zend_ACL is a system that allows this abstraction. If you want to know the reasons why your ACL fails, then just check each condition manually and don't use the Zend_ACL system at all! I guess you could throw an exception or set something in a registry in your assert method if you really want to bubble this info up to the calling code, but I'd think seriously about the reasons behind doing this before going down this route. 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] PHP bug with chaining function calls that generate exceptions on x86_64
Hi, Just wanted to share this bug with you guys as I discovered it while using Zend Framework code. http://bugs.php.net/bug.php?id=46568 It only affects x86_64, but it's fairly easy to trigger this in Zend Framework as it makes quite extensive use of exceptions, often in a chained function call scenario. HTH's some people from scratching the old noodle too much. 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] Broken ViewRenderer inflections for :controller with custom dispatcher.
Hi, I'm just trying to integrate some view scripts and I am running into problems when creating the folder structure. I have a custom dispatcher which changes the class structure of the controllers to better suit my file layout and autoloading infrastructure. In the ViewRenderer.php file there is the function: protected function _translateSpec(array $vars = array()) { ... $controller = substr($dispatcher-formatControllerName($request-getControllerName()), 0, -10); ... } I have to ask why there is a hard-coded 10 character name there for the view folder name, based on the dispatcher-formatted class name? In my example I have a controller name of Controller_Index, this is converted to Contro, by the above line, and ultimately to contro later on. Obviously this code is assuming the Controller suffix on Controller names, but with a custom dispatcher this may not be the case. This assumption is not documented in the: http://www.framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.viewrenderer which talks about the conventions surrounding the automatic conversions: :controller: MixedCase and camelCasedWords are separated by dashes; underscores are converted to directory separators, and the entire string cast to lower case. Examples: FooBar becomes foo-bar; FooBar_Admin becomes foo-bar/admin. Internally, the inflector uses the filters Zend_Filter_Word_CamelCaseToDash, Zend_Filter_Word_UnderscoreToSeparator, and Zend_Filter_StringToLower. I appreciate I can set a custom inflector, but this shouldn't really have to be done and this substr should not be hard coded... In my case I want to strip off 11 characters from the front of my formatted controller name! Perhaps the dispatcher should have another method called: formatControllerNameForView() that (by default) does the substr(..., 0, 10) and which can be overwridden in a custom dispatcher? I need to implement a solution here, so I'd like to know the right approach to take, so the patch can go upstream. I could work around the problem with a custome inflector but I figure I may as well fix the root cause which is clearly a bug. 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] Re: Broken ViewRenderer inflections for :controller with custom dispatcher.
Colin Guthrie wrote: I could work around the problem with a custome inflector... Actually looking again, it's not possible to work around things in this way, so I really do need to fix the bug properly. I've come up with the attached patch that should work. Is this the right approach? Col PS, it also removes an unused call to the getInflector() -- 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/] Index: Controller/Dispatcher/Interface.php === --- Controller/Dispatcher/Interface.php (revision 31183) +++ Controller/Dispatcher/Interface.php (working copy) @@ -48,6 +48,17 @@ public function formatControllerName($unformatted); /** + * Formats a string into a controller name used for view scripts. This is used + * to take a raw controller name, such as one stored inside a Zend_Controller_Request_Abstract + * object, and reformat it to a proper name that could be used for further maniplation. + * e.g. to create a folder name for view scripts. + * + * @param string $unformatted + * @return string + */ +public function formatControllerNameForManipulation($unformatted); + +/** * Formats a string into an action name. This is used to take a raw * action name, such as one that would be packaged inside a request * object, and reformat into a proper method name that would be found Index: Controller/Dispatcher/Abstract.php === --- Controller/Dispatcher/Abstract.php (revision 31183) +++ Controller/Dispatcher/Abstract.php (working copy) @@ -101,10 +101,24 @@ */ public function formatControllerName($unformatted) { -return ucfirst($this-_formatName($unformatted)) . 'Controller'; +return $this-formatControllerNameForManipulation($unformatted) . 'Controller'; } /** + * Formats a string into a controller name used for view scripts. This is used + * to take a raw controller name, such as one stored inside a Zend_Controller_Request_Abstract + * object, and reformat it to a proper name that could be used for further maniplation. + * e.g. to create a folder name for view scripts. + * + * @param string $unformatted + * @return string + */ +public function formatControllerNameForManipulation($unformatted) +{ +return ucfirst($this-_formatName($unformatted)); +} + +/** * Formats a string into an action name. This is used to take a raw * action name, such as one that would be stored inside a Zend_Controller_Request_Abstract * object, and reformat into a proper method name that would be found Index: Controller/Action/Helper/ViewRenderer.php === --- Controller/Action/Helper/ViewRenderer.php (revision 31183) +++ Controller/Action/Helper/ViewRenderer.php (working copy) @@ -632,7 +632,6 @@ $vars['action'] = $action; } -$inflector = $this-getInflector(); if ($this-getNoController() || $this-getNeverController()) { $this-_setInflectorTarget($this-getViewScriptPathNoControllerSpec()); } else { @@ -844,7 +843,7 @@ $request= $this-getRequest(); $dispatcher = $this-_frontController-getDispatcher(); $module = $dispatcher-formatModuleName($request-getModuleName()); -$controller = substr($dispatcher-formatControllerName($request-getControllerName()), 0, -10); +$controller = $dispatcher-formatControllerNameForManipulation($request-getControllerName()); $action = $dispatcher-formatActionName($request-getActionName()); $params = compact('module', 'controller', 'action');
[fw-general] Re: Multiple auth adapters in Chain
Matthew Ratzloff wrote: Like Zend_Auth_Chain? That would be useful. Users add adapters, then call authenticate(). Yeah it would be quite useful. It would be interesting to see how the system could help with the following scenario. The application has a users table with an id column. Every user, regardless of auth method, needs to have a user_id. Say I authenticate myself via OpenID, I still need a user_id in the application. Perhaps the Zend_Auth_Chain object could have a structure for ensuring a local user row (and thus a user_id) is created when a user authenticates? I'd suggest a table structure something like: Users: id | whatever else User_Auth: id | mech | detail Users.id is auto-incrementing, and for every user that exists, there is one or more User_Auth rows (remember that it should be possible for the same user to authenticate via more than one system). The mech could default to the class name of the actual authadapter used, and the detail would be e.g. a URI in the case of open id or ldap etc. If the chain loader can automate the population of these tables then that would make it work very nicely IMO. 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] Re: Alternating row colors in a Zend_Form
DorkFest wrote: Anyone have any simple strategies for providing alternative row CSS classes (eg: odd-row, even-row) in a Zend_Form? I think the cycle view helper is used, but not sure how that fits in a zend form. http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Cycle+-+Kamil+Nowakowski I've not learned enough zend_form foo yet to know if/how the view helpers can be used in a zend form decorator. 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] Re: Multiple auth adapters in Chain
Jan Pieper wrote: Yeah it would be quite useful. It would be interesting to see how the system could help with the following scenario. The application has a users table with an id column. Every user, regardless of auth method, needs to have a user_id. Say I authenticate myself via OpenID, I still need a user_id in the application. Perhaps the Zend_Auth_Chain object could have a structure for ensuring a local user row (and thus a user_id) is created when a user authenticates? I'd suggest a table structure something like: Users: id | whatever else User_Auth: id | mech | detail Users.id is auto-incrementing, and for every user that exists, there is one or more User_Auth rows (remember that it should be possible for the same user to authenticate via more than one system). The mech could default to the class name of the actual authadapter used, and the detail would be e.g. a URI in the case of open id or ldap etc. If the chain loader can automate the population of these tables then that would make it work very nicely IMO. Col I hope I understood your mail but I don't think this should be function of this chain adapter implementation. Your case is very specific. Hmm that backfired then as I was actually trying to keep it fairly generic. If you read the OpenId website, you'll see that the first link[1] on the developers page[2] pretty much describes this structure. This is why I thought it would be sensible to include this functionality into the chained auth system. Col 1. http://www.plaxo.com/api/openid_recipe 2. http://openid.net/developers/ -- 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] Re: Is Zend_Form really this difficult?
Steven Szymczak wrote: ok, my form is build (not pretty), and in the interests of moving development forward, I've started working on the authenticating the values entered in the form. Only I can't get that far because submitting the form (with values or completely blank) results in the following error: Fatal error: Cannot unset string offsets in /Users/Steven/Sites/wa3gukin.com/library/Zend/Form/Element.php on line 1999 I found that particular line, and it says: if (isset($validator['options']['messages'])) { $messages = $validator['options']['messages']; (1999) unset($validator['options']['messages']); } Echoing $messages shows that it contains only /. What could the problem be? Looks like either $validator or $validator['options'] is actually a string rather than an array. print_r()/var_dump() of $validator would probably explain what's wrong and allow you to work out why $validator is not set correctly. Perhaps some stronger checks are needed on an API call somewhere... 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] Re: Tags for the memcached and APC backends for Zend_Cache - new approach
Diabl0 wrote: Hi As i seen this topic was discussed later, but i have new idea that IMHO can throw new light. What about combining memory cache backends with file cache fallback for tags? Ofcorse optional if someone wants this. This should give us benefits from fast memory cache and tagging system with only small drawback on performance needed to update (or retreive) tags cache from filesystem. And what you think about this idea? It's interesting but why use the filesystem? Why not use the cache itself but use a different key structure to track this (e.g. cache an array of keys that match the tag wibble under the key name Zend_Cache-keymap-wibble? This approach could be implemented in a base class and those backends not supporting tags could simple extend it. I've not looked at the intricacies of this from a data integrity point of view so there could be several reasons why this wouldn't work :) Also as a related issue, would it be possible to implement a cache invalidation queue system backed by a database? The reason I say this is when considering multi-server environments (let's assume there is one database for all servers). Say someone has a blog system (standard example!!) and has various articles. The articles are cached but when someone leaves a new comment, we want to invalidate the cache so it can be regenerated. A nice way to do this would be via the tag system (e.g. the cached article is tagged with the article id - the cache key being more complex than just the id alone). When someone leaves their comment, the tag is invalided *on the current server*. This is fine, but what if we are running multiple servers? We would like a method to clear out the caches on these servers also wouldn't we? If we had a kind of db-backed invalidation operation queue, some kind of garbage collector style routine could be built into the cache system so that the action of invalidating a cache based on tag in one server would put this invalidation into a db queue so that it could also be propagated to other servers within a short time frame too. The GC approach would take a x in y probability likilihood of running approach that other similar GC routines take (e.g. the session GC). When it is triggered it would query the queue and see if any new events have come in since last run, if there are, it processes them and then store a timestamp (in the cache of course!) of when it was last run. I've perhaps not explained the problem too well above, so if anyone is intrigued but thinks I must be smoking crack please ask. Also if I've missed something in the zend_cache system that can cope with multiple servers, please let me know (and I know e.g. memcached could be used on a multi-server setup, but there are times when APC and filesystem would be preferred). WDYT? 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] Re: Security Module
I wrote: Do you see your system supporting asserts or does this go beyond a drop-in module? Jason Eisenmenger wrote: Yes and this is one of the things I've spent the most time thinking about. Some kind of GUI that lets you select the required relationships between not just roles and resources, but between one object and another. Cool. I'd be interested in hearing how you solve this particular problem: How do you know what Resources a system supports beyond simple module controllers. e.g. consider you have a custom route that matches: article/0-9]+/edit It drops into the article controller and the edit action with the additional param of article_id, you'd really need to check that the given role has access to the specific resource with that id. In my system I'd use my article object itself as the resource and pass this through the ACL methods which ultimately finds it's way to the assert and I can type check it and extract the article id, author etc. and compare that against the current user to make sure they have permission. This works pretty well for me (with my fix from ZF-4460). I guess you'd probably create an top level folder called assertions or something and allow this to be glued together in your ACL editor, but I suspect the assertions would have to load up the details for the article independently (by using the article id from the request) rather than using the resource object itself. Anyway, thanks for sharing the screen cast, it helps me work on my own strategy even if I don't use your stuff directly :) 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] Re: Security Module
Jason Eisenmenger wrote: Hello list, If anyone is interested, I've posted a screencast demonstrating the drop-in security module that I showed at the ZendCon UnCon last month. If you're in the market for an ACL system for your site, check it out: http://oss.jasoneisen.com/2008/10/14/security-module-screencast/ That was very interesting Jason, thanks for that. I'm not sure I can use this as a drop in module in my apps, but it's certainly food for thought. As you clearly think about these things, I'd be interested to hear your feedback on the following bug that concerns the Zend_Acl system when checking that a user is permitted to access a given resource while using an assert: http://framework.zend.com/issues/browse/ZF-4460 Do you see your system supporting asserts or does this go beyond a drop-in module? 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] Re: Zend Framework 1.7 Preview Release is now available!
Matthew Weier O'Phinney wrote: In this particular case, the performance enhancements were made to the PluginLoader, which is used in a variety of places in the framework. Basically, we were looping over paths manually and checking if a file was readable; this becomes slower and slower the more paths that need to be traversed to find the correct file. Ironically, there's an option in loadFile() that allows you to pass a set of directories to loop over; directory iteration is done by resetting the include_path briefly and using fopen(), which has an argument for searching the include_path -- which is many times faster than manually doing it. The net gain is around 12.5% in a real-world application (i.e., 1/8 increase), but could vary based on the requirements of your application. Just as a minor followup to this. I see that array_key_exists() is used quite frequently in the Zend codebase. After some simple benchmarks, I note that this can often be improved by the simple use of an isset() or !empty() call instead (these being language constructs rather than function calls). Ex1: array_key_exists('foo', $arr) == isset($arr['foo']) Ex2: (array_key_exists('foo', $arr) true == $arr['foo']) == !empty($arr['foo']) This does not always hold 100% true and it is sometimes necessary to use array_key_exists where isset() or empty() would give incorrect results in the context, e.g. $arr['foo'] = null; isset($arr['foo']) == false !empty($arr['foo']) == false array_key_exists('foo', $arr) == true Having done some basic benchmarks, on this thread: http://thread.gmane.org/gmane.comp.php.general/190070 the second example above gave me a ~3.5x speed increase. If there is a 2-depth array that needs checking then it yielded a ~4.5x speed increase. This would seem like a fairly easy low hanging fruit optimisation that could be made in the ZF with minimum of hassle. 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/]