Re: [fw-general] Naming your Namespace
At my company (http://www.targetspot.com) we did something really radical and used our company name: "Targetspot_" Crazy, I know. - jake On Fri, Mar 26, 2010 at 3:31 PM, Rob Allen wrote: > > On 26 Mar 2010, at 16:31, jsuggs wrote: > >> Just curious, but do most people namespace their code according to their >> project or do you just use something generic say "App"? > > > I'm going to buck the trend here :) Nearly all my apps have a library/App > which holds controller plugins, action helpers and app-wide view helpers. > It's all intentionally application-specific and not intended for reuse. If > it's for re-use then it goes into a named library. > > Regards, > > Rob... > > -- > Rob Allen : http://akrabat.com > Zend Framework Tutorial: http://akrabat.com/zft > Author of Zend Framework in Action: http://www.zendframeworkinaction.com > >
Re: [fw-general] Re: Unit Testing with Zend_Test
On Wed, Mar 24, 2010 at 1:09 PM, Joseph Crawford wrote: > > Jake, > > Will I also have to move my Bootstrap.php file into the /tests/application/ > directory or will it know where to find it? No, just establish where your application.ini file is relative to your tests. I typically have a TestHelper.php file that sets up the environment, much like the index.php file in a traditional Zend MVC application. > > Thanks, > Joseph Crawford > -- > View this message in context: > http://n4.nabble.com/Unit-Testing-with-Zend-Test-tp1680861p1680875.html > Jake, > > is there a reason you have to do it manually in the tests but not in the > actual application? Not sure what the reason is, I imagine it's because you aren't allowing Zend_Application to initialize the bootstrap, instead you're doing it manually. > > Thanks, > Joseph Crawford > Sent from the Zend Framework mailing list archive at Nabble.com. >
Re: [fw-general] Unit Testing with Zend_Test
Joseph: Within an instance of Zend_Test_PHPUnit_ControllerTestCase: ... public function appBootstrap() { $this->application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $this->application->bootstrap(); $this->getFrontController()->setParam('bootstrap', $this->application->getBootstrap()); } ... You have to set the bootstrap param manually! - jake On Wed, Mar 24, 2010 at 1:02 PM, Joseph Crawford wrote: > > Hello Everyone, > > I have been working with Unit Testing in a ZF Application over the last few > days and I have hit a problem. What I am wondering is if my > application/Bootstrap.php file will be executed when testing. The reason I > am asking is because I will want all of my custom routes to resolve > properly. I also would like to find out if the Zend_Controller_Front is > setup. > > In one of my test methods I am doing $bootstrap = > Zend_Controller_Front::getInstance()->getParam('bootstrap'); and when I > var_dump the $bootstrap variable I am getting back NULL. > > My directory structure for my application is the same as generated by > Zend_Tool and my tests are in the following structure: > > /tests > --/application > /controllers > --/ControllerTest.php > /models > --/ModelTest.php > --/library > /MyLib > --/FileTest.php > > I have created the bootstrap.php file which the phpunit.xml executes and I > am using a class to actually setup the testing environment. All of my test > cases extend from ControllerTestCase.php which looks like the following: > > class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase > { > /** > * @var Zend_Application > */ > protected $application; > > public function setUp() > { > $this->bootstrap = array($this, 'appBootstrap'); > parent::setUp(); > } > > public function appBootstrap() > { > $this->application = new Zend_Application( > OVISTORE_ENVIRONMENT, > APPLICATION_PATH . '/configs/app.ini' > ); > } > } > > So I wonder with this setup is there anything I *have* to do in order to > make the Zend_Controller_Front::getInstance()->getParam('bootstrap') not > return NULL? > > Thanks, > Joseph Crawford > -- > View this message in context: > http://n4.nabble.com/Unit-Testing-with-Zend-Test-tp1680861p1680861.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
Re: [fw-general] Zend_Loader_Autoloader::setZfPath() + application.ini won't ever work
So here is what I ended up doing: Directory for different versions of ZF %> mkdir -p /usr/share/php/ZendFramework Directory for Zend_Loader_*, Zend_Application, Zend_Exception (static version 1.10.2) %> mkdir -p /usr/share/php/ZendFrameworkLoader/library/Zend %> cd /usr/share/php/ZendFramework %> wget http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2-minimal.tar.gz %> tar -xzvf ZendFramework-1.10.2-minimal.tar.gz %> mv ZendFramework-1.10.2-minimal 1.10.2 %> cd 1.10.2/library/Zend Copy out Application, Loader classes before removing require_once %> cp -r Exception.php Application.php Loader* /usr/share/php/ZendFrameworkLoader/library/Zend Remove require_once calls from ALL versioned copies of ZF %> find . -name '*.php' -print0 | xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g' Now in my index.php: http://gist.github.com/338279 Some takeaways: 1. Won't be able to use pear to keep up to date on ZF, though I knew this going in. 2. Still can't get application.ini directives to work, though I don't think I'd want to use application.ini to define my autoloaderZfPath because then I'd have to segregate a whole bunch of ZF classes. 3. Using this method, the following application.ini directives broke for me, so I had to replicate the functionality outside of Zend_Application, in my index.php: includePaths.library autoloadernamespaces.My = "My_" This may be because I'm now replacing the autoloader initialized by Zend_Application with my own. 4. The section for setZfPath needs to be rewritten to reflect the fact that you'll need a modified ZF install (without require_once) in order to use it. Those issues aside, we're loving the ability to dynamically assign different ZF versions by environment. Thanks for all the help! - Jake On Fri, Mar 19, 2010 at 2:20 PM, Mike A wrote: > On 19 Mar 2010 at 13:22, Matthew Weier O'Phinney wrote: >> -- Mike A wrote >> (on Friday, 19 March 2010, 04:29 PM -): >> > On 19 Mar 2010 at 10:52, Matthew Weier O'Phinney wrote: >> > >> > > -- Jake McGraw wrote >> > > (on Thursday, 18 March 2010, 07:02 PM -0400): >> > > > I'd like to use Zend_Loader_Autoloader::setZfPath() and the >> > > > autoloaderZfPath application.ini directive to select a ZF version >> > > > based on Environment, exactly as described here: >> > > > >> > > > >> > > > http://framework.zend.com/manual/en/zend.loader.autoloader.html#zend.loader.autoloader.zf-version >> > > > >> > > > What the tutorial fails to cover is how does one introduce >> > > > Zend/Loader/Autoloader.php into your executing code without knowing >> > > > the desired ZF path/version before executing Zend_Application? It's >> > > > a >> > > > kind of chicken and egg problem. Also, I've noticed that if you >> > > > don't >> > > > use the same version of Zend/Loader/Autoloader.php as the one you >> > > > define in your setZfPath, then you'll get a fatal error (duplicate >> > > > class) as require_once('Zend/Loader.php') will execute because >> > > > you're >> > > > now operating in a different directory. The only way around this >> > > > issue >> > > > is to remove every instance of require_once from all ZF classes and >> > > > rely on Zend_Loader_Autoloader for all file inclusions. >> > > > >> > > > So, my question is, how are we supposed to use >> > > > Zend_Loader_Autoloader::setZfPath() and the autoloaderZf directives? >> > > >> > > I'd make the following recommendations: >> > > >> > > * Have a tree with just Zend/Exception.php, Zend/Loader.php, and the >> > > Zend/Loader/ subtree. Stick that on your include_path. This should >> > > be >> > > from 1.10.0 or later. >> > > >> > > * Then, in your index.php, setup autoloading and the ZF version. This >> > > will ensure that Zend_Application comes from the version you've >> > > selected, and should prevent any issues. >> > > >> > > * Optimally, on all versions of ZF, strip the require_once calls, per >> > > the performance appendix. >> > >> > Is this an argument for Zend shipping ZF with two installs? Part 1 the >> > core and part 2 the bulk? >> > >> > IMHO, philosophically and from a business perspective, it treads on >> > very dangerous ground
Re: [fw-general] Zend_Loader_Autoloader::setZfPath() + application.ini won't ever work
On Fri, Mar 19, 2010 at 2:17 AM, Mike A wrote: > On 18 Mar 2010 at 19:02, Jake McGraw wrote: >> I'd like to use Zend_Loader_Autoloader::setZfPath() and the >> autoloaderZfPath application.ini directive to select a ZF version >> based on Environment, exactly as described here: >> >> >> http://framework.zend.com/manual/en/zend.loader.autoloader.html#zend.loader.autoloader.zf-version >> >> What the tutorial fails to cover is how does one introduce >> Zend/Loader/Autoloader.php into your executing code without knowing >> the desired ZF path/version before executing Zend_Application? It's a >> kind of chicken and egg problem. Also, I've noticed that if you don't >> use the same version of Zend/Loader/Autoloader.php as the one you >> define in your setZfPath, then you'll get a fatal error (duplicate >> class) as require_once('Zend/Loader.php') will execute because you're >> now operating in a different directory. The only way around this issue >> is to remove every instance of require_once from all ZF classes and >> rely on Zend_Loader_Autoloader for all file inclusions. >> >> So, my question is, how are we supposed to use >> Zend_Loader_Autoloader::setZfPath() and the autoloaderZf directives? > As it happens I have just written about this issue in a > book chapter under authorship. Not perfect, but try... > $libraries="/../libraries/"; > $zf_path="ZF"; > $zf_ver="1.10.2"; Ok, but your use of $zf_path and $zf_ver makes the whole autoloaderZfPath, autoloaderZfVersion application.ini directives moot, correct? What I don't understand is, how does one use Zend_Loader_Autoloader::setZfPath(), without first loading some components of the Zend Framework? What I've encountered is that, as soon as you include/instantiate Zend_Loader_Autoloader, you've sullied the namespace, require_once won't look in the same directory as the original version of ZF that you used to include the autoloader, therefore, any duplicate require_once's will cause duplicate class errors. So, my question still stands, how does one use Zend_Loader_Autoloader::setZfPath(), where the ZF path will be different from the one used to include the autoloader? > // Ensure 'libraries/' folder is on include_path > set_include_path(implode(PATH_SEPARATOR, array( > realpath(APPLICATION_PATH . > $libraries.$zf_path.'/'.$zf_ver.'/library/'), > get_include_path(), ))); > require_once 'Zend/Application.php'; > $application = new Zend_Application( > APPLICATION_ENV, > APPLICATION_PATH . '/config/config.ini' > ); > $autoloader = Zend_Loader_Autoloader::getInstance(); > $path=realpath(APPLICATION_PATH . $libraries.$zf_path); > $autoloader->setZfPath($path, $zf_ver); > My folder structure matches the one in the example except > that Zend framework ("$zf_path") sits one level below my > libraries because I have personalised libraries I also > want to access. > It's messy, with more lines of code than necessary in a > perfect world - read "perfect framework" ;) Also, > depending on the need to transport across OSs, it may be > desirable to use the PATH_SEPARATOR constant in place of > "/". It does, though, enable a single change of $zf_ver to > attach the appropriate ZF version. > HTH a little... > Mike A. >
[fw-general] Zend_Loader_Autoloader::setZfPath() + application.ini won't ever work
I'd like to use Zend_Loader_Autoloader::setZfPath() and the autoloaderZfPath application.ini directive to select a ZF version based on Environment, exactly as described here: http://framework.zend.com/manual/en/zend.loader.autoloader.html#zend.loader.autoloader.zf-version What the tutorial fails to cover is how does one introduce Zend/Loader/Autoloader.php into your executing code without knowing the desired ZF path/version before executing Zend_Application? It's a kind of chicken and egg problem. Also, I've noticed that if you don't use the same version of Zend/Loader/Autoloader.php as the one you define in your setZfPath, then you'll get a fatal error (duplicate class) as require_once('Zend/Loader.php') will execute because you're now operating in a different directory. The only way around this issue is to remove every instance of require_once from all ZF classes and rely on Zend_Loader_Autoloader for all file inclusions. So, my question is, how are we supposed to use Zend_Loader_Autoloader::setZfPath() and the autoloaderZf directives? - jake
Re: [fw-general] Zend_Auth::getInstance()->clearIdentity() doesn't seem to log me out?
On Tue, Mar 9, 2010 at 12:05 AM, Cameron wrote: > > > On Tue, Mar 9, 2010 at 10:49 AM, Jake McGraw wrote: >> >> >> On Mon, Mar 8, 2010 at 8:51 PM, Cameron wrote: >>> >>> Ok, I just tried removing everything except for >>> >>> $data = $authAdapter->getResultRowObject(null, 'password'); >>> $auth->getStorage()->write($data); >>> >>> all, the $authNamespace stuff is gone, and it makes no difference - still >>> can't log out. Does clearIdentity() not work when there's something in the >>> Zend_Auth instance's storage? Because I use the storage all around my >>> application... It forms the basis of my ACL class... >>> >>> Oh. Ok. Is it possible that Zend_Auth's storage is completely >>> separate to the authenticated session? that clearIdentity() doesn't touch >>> it? >> >> Typically, I don't mess with the identity created by the Auth Adapter. >> However, there are instances where you need to store more than the $identity >> (which may only be an email or userId), for that I use Session_Namespace, >> check out my example: >> http://gist.github.com/326089 >> - jake > > So I'm doing this wrong? Because I've been pulling my identity out of > Zend_Auth like this: Zend_Auth::getInstance()->getStorage()->read()->id... I > don't recall why I was doing it like that, but it seemed to work at the > time. > You aren't ever required to directly interface with the Zend_Auth Storage instance, though there is nothing technically wrong with it, I prefer Zend_Auth::getInstance()->getIdentity() if the identity is available. I think the disconnect here is that you're trying to store more than the user identity (email, userId, username, etc) inside the the instance of Zend_Auth storage, which isn't technically wrong, it's just not what the built in default storage system was written for. I work around this by using another persistent storage method, in my case Zend_Session_Namespace. - jake
Re: [fw-general] Validate numbers [Scanned]
You can use Digits and Between: http://framework.zend.com/manual/en/zend.validate.set.html#zend.validate.set.digits http://framework.zend.com/manual/en/zend.validate.set.html#zend.validate.set.between - jake On Fri, Mar 5, 2010 at 4:47 PM, Steve Rayner wrote: > What validators am i supposed to use to validated that a form entry value is > a number and it is between two given values? I tried between but that seems > to treat the input like test.
Re: [fw-general] Zend_Auth::getInstance()->clearIdentity() doesn't seem to log me out?
On Thu, Mar 4, 2010 at 11:39 PM, Hector Virgen wrote: > Anything in your cookies causing you to stay logged in? > > -- > Hector > > > On Thu, Mar 4, 2010 at 7:30 PM, Cameron wrote: >> >> Hi guys, I'm really not sure where I'm going with this one, it seems like >> I must be doing something completely wrong, but I'm not really sure where to >> even start looking. >> >> Here's my logout action: >> >> public function logoutAction() { >> Zend_Auth::getInstance()->clearIdentity(); >> $this->_helper->redirector('/'); >> } >> >> Pretty simple, right? The redirect certainly works, but for some reason, >> I'm still logged in! I've even tried $_SESSION = ''; to brute force the >> session to be deleted, but there i am, still logged in. Anyone got any ideas >> on this one? How are you confirming that you're still logged in? Perhaps that's the issue? - jake > >
Re: [fw-general] Unit testing Zend_Forms
On Tue, Jan 5, 2010 at 7:56 PM, Steven Szymczak wrote: > I've just started digging deeper into Zend_Form and I'm interested in how to > go about unit testing them. I've looked through the PHPUnit docs, > zf-general archives, and Pádraic Brady's blog (briefly) but haven't found > anything extremely useful. So can anybody here point me in the direction of > any articles that deal with this? Are you trying to use Zend_Test or just PHPUnit by itself. Personally, the built in support for PHPUnit and ZF MVC rocks, though, like every ZF Component, takes a little of work to get started. The best resources I've found for this are: Unit Testing with the Zend Framework with Zend_Test and PHPUnit http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/comment-page-1/ I know it's a drag, but really, read every line in the manual, and work along with the examples: http://framework.zend.com/manual/en/zend.test.html - jake > > Cheers, > -- Steven > > -- > スティーブン > >
Re: [fw-general] Faltal Error with Controller Action on ZF
Can you show us some code? - jake On Mon, Jan 4, 2010 at 8:36 AM, Jacques Marques wrote: > > Hello, > > When I change anything in my controller and try access it I receive this > message: > Fatal Error: Cannot override final method Zend_Controller_Action::_forward() > ... > > I am using Zend Framework 1.9.5 with Zend Server on Linux. > > Thanks, > -- > View this message in context: > http://n4.nabble.com/Faltal-Error-with-Controller-Action-on-ZF-tp998248p998248.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
Re: [fw-general] AjaxContent
Assuming it's Iterable, if not, use type casting first: $res = (array) $res; - jake On Tue, Dec 22, 2009 at 4:46 PM, Jake McGraw wrote: > foreach($res as $field => $value) { > $this->view->{$field} = $value; > } > > On Tue, Dec 22, 2009 at 4:28 PM, Eugen_cro wrote: >> >> Hi all, I'm studying AjaxContent helper to stop my previous practice to just >> echo things from controller for json responses.. >> >> Now, I have one question: >> >> I have a object like this: >> $res->rows = 1; >> $res->columns = 2; >> >> Now, I pass that object to view: >> $this->view->res = $res; >> >> And I get json response but with object name inside: >> {"res":{"rows": "1", "columns":"2"}} >> >> How can I get rid off that "res" in my responce since I need only variables >> that are in the object >> {"rows": "1", "columns":"2"} >> >> Thx >> -- >> View this message in context: >> http://n4.nabble.com/AjaxContent-tp977365p977365.html >> Sent from the Zend Framework mailing list archive at Nabble.com. >> >
Re: [fw-general] AjaxContent
foreach($res as $field => $value) { $this->view->{$field} = $value; } On Tue, Dec 22, 2009 at 4:28 PM, Eugen_cro wrote: > > Hi all, I'm studying AjaxContent helper to stop my previous practice to just > echo things from controller for json responses.. > > Now, I have one question: > > I have a object like this: > $res->rows = 1; > $res->columns = 2; > > Now, I pass that object to view: > $this->view->res = $res; > > And I get json response but with object name inside: > {"res":{"rows": "1", "columns":"2"}} > > How can I get rid off that "res" in my responce since I need only variables > that are in the object > {"rows": "1", "columns":"2"} > > Thx > -- > View this message in context: > http://n4.nabble.com/AjaxContent-tp977365p977365.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
Re: [fw-general] URL issue with multiple customers sharing the same application
On Mon, Dec 21, 2009 at 11:10 AM, Daniel Latter wrote: > OK thanks for the replies, I understand your reasons but this too seems > unmanageable, say if you have 50 customers, thats 50 databases!!? or am I > missing somthing? > This isn't so terrible, sandboxing accounts to their own databases makes your model code a lot simpler (for example, you don't need to pass around an account id, join and filter every single query). You can also backup and restore whole accounts using mysqldump instead of some kind of custom built solution. You can also, (very easily) break off clients to separate boxes should they generate enough traffic (or pay for the privilege). The only con is building an administrative interface may be a bit more complicated, though I'd rather have the majority of bugs in an app I deal with, than the one my customers work with. - jake > > Thanks again. > > > Dan > > > > > > 2009/12/21 Guillaume ORIOL > >> I had two reasons in mind: >> - security (the db user has rights only on its database) >> - simplicity (no need to prefix table names or to add a customer column in >> every table PK) >> >> -- >> Guillaume >> >> Le 21/12/09 16:40, Daniel Latter a écrit : >> >> Thanks for the reply, >> >> What was your main reason for using separate databases instead of one >> single database? >> >> Dan >> >> >> >> >> 2009/12/21 Guillaume ORIOL >> >>> Yes, I have exactly one database per customer and one more for >>> supervision purpose (where access to customer databases are defined). >>> >>> Le 21/12/09 16:08, Daniel Latter a écrit : >>> >>> Hi, >>> >>> I have a situation very similar to yours, although I am not sure about >>> the answer to your question, I have a quesiton for you: when you say you >>> have several databases, what do you mean? do you mean one per >>> customer/application? >>> >>> Thanks >>> Dan >>> >>> >>> >>> >>> >>> 2009/12/21 Guillaume ORIOL >>> Working on an application that is the same for multiple customers, I had to face a design option. I wanted to avoid installing the application as many times as we had customers (for maintenance reasons). Therefore I chose to have a unique code installation but several databases. Each customer would access its application by adding its account name to the application base URL: webapp.domain.com/account1/ webapp.domain.com/account2/ etc. Following this URL prefix are the regular MVC parameters, ie: webapp.domain.com/account1/module/controller/action I define a default route replacement in my Bootstrap including the account parameter (see below) and retrieve this special parameter from a FrontController plugin where I setup the default database adapter. I encounter a problem with functions that build URLs (for instance $view->url(...) or $redirector->gotoRoute(...), etc.). All of these functions should add the current account parameter at the beginning of the URL, but none of them is aware of it. (It should also apply to other functions like $page->getHref() for Zend_Navigation.) What design option would you suggest (overload all of these functions, change dynamically the base URL of the application)? Thanks for any help - - - - - Here is the redefined default route: $route = new Zend_Controller_Router_Route( ':account/:module/:controller/:action/*', array( 'account'=> 'demo', 'module' => 'default', 'controller' => 'index', 'action' => 'index') ); $router->addRoute('default', $route); I would also like to make " webapp.domain.com/account1/module/controller/action" equivalent to " account1.webapp.domain.com/module/controller/action". I guess it is possible with the Zend_Controller_Router_Route_Hostname, but did not try already. $route = new Zend_Controller_Router_Route_Hostname( ':account.webapp.domain.com', array( 'module' => 'default', 'controller' => 'index', 'action' => 'index' ) ); -- Guillaume ORIOL >>> >
[fw-general] Using Connection Mock with Zend_Test_PHPUnit_ControllerTestCase
I'm digging into some TDD, and I've managed to convert all of my Models to use Zend_Test_PHPUnit_DatabaseTestCase and it works wonderfully. My question is, is there any way to integrate Connection Mocking, like that with my model testing to work within the Zend_Test_PHPUnit_ControllerTestCase? I see that PHPUnit has a whole suite dedicated database mocking, but I really enjoy the simplicity and tight integration between Zend_Db and Zend_Test_PHPUnit_DatabaseTestCase. Thanks, - jake
Re: [fw-general] Survey: Development environment for PHP/ZFW
On Sat, May 2, 2009 at 1:14 PM, howard chen wrote: > Please feel free to answer: > > 1. What OS you are using during development? Windows? Mac? Linux? Mac OSX > 2. Do you edit source code on localhost or remote? i.e. is your > testing environment reside on localhost or remote? Remote > 3. What tool or IDE you are using? Ultraedit? Apanta? Eclipse PDT? Started using TextMate on the Mac Moved to Zend Studio for Eclipse, proved too buggy Moved to Eclipse PDT, was a resource hog, still kind of buggy Back to Textmate > 4. Which versioning system your are using? svn? git? svk + svn for work, git for personal dev > 5. Do you use PHPUnit or other testing tools? Our company uses Charles mostly > > p.s. have a good day. >
Re: [fw-general] Base Controller convenience methods
Steven: To get code completion do something like: /** * @var MyCustomHelper */ protected $myCustomHelper; ... public function init() { ... $this->myCustomHelper = $this->_helper->myCustomHelper; ... } using the @var notation will allow Eclipse to expand any reference. - jake On Tue, Feb 24, 2009 at 9:23 AM, O'BRIEN, Steven X wrote: > This might sound trivial but an advantage of using base controllers is that > you get code completion using eclipse or zend studio. > > Do you get code completion when using action helpers? > > For example it would be great if you could go $this->_helper->[List of all > available helpers] > > > > -Original Message- > From: Marko Korhonen [mailto:marko.korho...@datafisher.com] > Sent: 19 February 2009 20:27 > To: fw-general@lists.zend.com > Subject: Re: [fw-general] Base Controller convienience methods > > > > Ok, done. > > Now I have converted most of the methods in my base controllers as action > helpers, plugins or just moved them to views. > > I have the final challenge: > > I declare "blocks" to my sidebar with my new action helper "Block". > > Example, $this->_helper->block($block, "left_sidebar", 0); // renders $block > object to left sidebar as first block > > BUT. I want to add some blocks in every module/controller/action or in every > action/somecontroller. > > Before I added these helper calls to my base controller but now I don't have > base controllers. > > So, next I tried plugins. Well, I can't access current controller. > Ok, I could use action helpers. BUT, then I need to add these helper calls > to every controller... > > I was thinking about following: > > Somekind of Hook system. > -should go through $frontController->getModuleDirectory() to get every > module > -should check if some file exists in the moduledir > -if file exits, it should be loaded, and if the class "Module_Hook" exists, > it should make new Module_Hook(); > -Now it gets tricky... > -where to add event calls ? Hook:someEvent($args); > -Can this Hook class have access to needed resources, for example action > helpers > > what, where, why o why!! > > br, Marko (drinking beer) > > > > Matthew Weier O'Phinney-3 wrote: >> >> -- Marko Korhonen wrote >> (on Monday, 16 February 2009, 05:04 AM -0800): >>> I'm pretty sure that others have done the same as me: >>> >>> Base Controllers like My_BaseController and used as follows: >>> Module_SomeController extends MyLibrary_Controller_Base >>> >>> Well, if so, you probably have done some methods just to shorten things a >>> bit. >>> >>> I'll share some of my "convienience" methods and I hope you got some >>> ideas/feedback/bugs noticed and maybe some great convienience methods to >>> share... >>> >>> I still would like to get Module Base Controller, but it does not >>> autoload >>> itself =( >>> Module_SomeController extends Module_BaseController >> >> This is what action helpers were designed for -- to allow for common >> functionality between action controllers, and also for distributing >> functionality to use in different projects. If I may, I'd recommend >> rewriting these as action helpers. >> >> One change I'm going to add before 1.8 is the addition of a >> "getHelperBroker()" method to both the action controller and abstract >> action helper (this latter will proxy to the action controller). This >> will allow your action helpers to have access to other action helpers >> trivially. For example: >> >> $this->getHelperBroker()->json($data); >> >> This should help with re-use, and further eliminate reasons for "base" >> controllers in your projects. >> >>> --- >>> >>> // output json without rendering any layouts/templates >>> protected function json($data) >>> { >>> $this->_helper->json($data); >>> } >>> >>> // Is the current action frontpage >>> protected function isFrontpage() >>> { >>> $front = $this->getFrontController(); >>> >>> return (boolean) $this->_module == $front->getDefaultModule() && >>> $this->_controller == $front->getDefaultControllerName() && >>> $this->_action >>> == $front->getDefaultAction(); >>> } >>> >>> // Disable layout and/or viewRenderer >>> protected function disableUI($layout = true, $viewRenderer = true) >>> { >>> if ($layout) $this->_helper->layout->disableLayout(); >>> >>> if ($viewRenderer) $this->_helper->viewRenderer->setNoRender(); >>> } >>> >>> // Set layout >>> protected function setLayout($layout) >>> { >>> $this->_helper->layout->setLayout($layout); >>> } >>> >>> // Set template >>> protected function setTemplate($template) >>> { >>> $this->_helper->viewRenderer($template); >>> } >>> >>> // Change the response segment (default is being $this->layout()->content >>> protected function setResponseSegment($segment) >>> { >>> $this->_helper->viewRenderer->setResponseSegment($segment); >>> } >>> >>> // Set page title >>> public function setTitle($title) >>> { >>> $this->view->headT
Re: [fw-general] Validating a person's name with Zend Validate
Philip: Well, if you've got no choice, I suppose it's time to read up on PHP regex, when using Unicode character classes (see http://us.php.net/manual/en/regexp.reference.php > Unicode character properties) you can scoop up all of the meaningful letters of a given code set. Also, why don't you try the following for the name w/ punctuation uppercase dilemma: preg_replace_callback('/(\b\w)/', create_function('$matches','return strtoupper($matches[1]);'), $string); - jake On Wed, Jan 7, 2009 at 4:37 PM, Philip G wrote: > 2009/1/7 Jake McGraw >> >> Philip: >> >> Names (especially if you're handling international characters) tend to >> have a huge sub set of possible characters and users tend to get very >> pissed off if you develop a pattern that blocks their legal name. My >> advice to you, check if it's blank, make sure it isn't too long for >> your database field, check it for injection attacks, store it and call >> it a day. >> >> - jake > > > I completely agree. Unfortunately our client doesn't. This is the very > client, which we've fought tooth and nail to *stop* forcing uppercase first > character of names. We lost that battle. So if a user types in "O'Reilly", > it will show as "O'reilly." Why the change? Because they typed in "beth" and > wanted it to display "Beth." > Yes. They are quite a frustrating client. It's even worse when we have a > middle man between us and them. > --- > Philip > g...@gpcentre.net > http://www.gpcentre.net/ >
Re: [fw-general] Validating a person's name with Zend Validate
Philip: Names (especially if you're handling international characters) tend to have a huge sub set of possible characters and users tend to get very pissed off if you develop a pattern that blocks their legal name. My advice to you, check if it's blank, make sure it isn't too long for your database field, check it for injection attacks, store it and call it a day. - jake 2009/1/7 Philip G : > > I'm trying to figure out the best way to validate a name, using > Zend_Validate, while maintaining UTF8 compliance. Zend_Validate_Alpha() will > check for alphabetic characters. However, while it allows "Николь" to go > through, "O'Reilly" fails because of the apostrophe. > Is there some way to add characters to Alpha()? Or is there another way I > can go about this? RegEx is a little more complex, since it'll also need to > include international characters, of which I don't even know the regex for. > --- > Philip > g...@gpcentre.net > http://www.gpcentre.net/ >
Re: [fw-general] What do you use to manage your ZF projects?
My company uses: Mantis + SVN + svk (for branching) Mantis has a really nice plugin for commits that catches "bug " and appends the commit to the bug status. - jake On Sun, Dec 21, 2008 at 2:33 PM, Robert Castley wrote: > Hi, > > Just curious here. I/we currently use Bugzilla & CVS, no formal wiki but I > do have a MediaWiki used for somethings. > > I am looking for a solution that fits all, so the obvious choices are 'Trac' > like. > > My problem is that I need a solution that will support multiple projects. > (Trac doesn't score well in this area.) > > Bugzilla is used by multiple PHP, Java & C/C++ products. CVS is used only > by PHP developers the 'others' use VSS. > MediaWiki is used for 'sparse' documentation. > > > My gripes with the current setup: > > Bugzilla - v. slow and ugly but it fitted the bill at the time. > CVS - I like, no love, CVS but I know that there are better solutions out > there but am concerned about migration etc. > MediaWiki - Probably too much of an overkill for what we need and it is not > that easy to configured, extend etc. > > I now that the ZF team uses JIRA, Confluence etc but I have a budget of > £0/$0 :-) and don't qualify for the OS licenses. > > So ... I would be interested on the views of others of a 'one hat fits all' > solution that can handle multiple projects. > The solution needs to offer Issues/Bug tracking and Wiki at a minimum. > Integration with SCM not important but > if it does it great. > > I would prefer a PHP based solution but happy to consider others i.e. Ruby, > Perl, Java etc. > > - Robert > > > > This email has been scanned for all known viruses by the MessageLabs Email > Security Service and the Macro 4 plc internal virus protection system. > >
Re: [fw-general] Re: Conflict between Zend_Session::setSaveHandler(memcache) and session.save_handler=memcache
I figured it out, thanks to Ruby developers who wanted to use shared memcache sessions between Ruby and PHP: Apparently, PECL memcache for sessions stores a specially serialized string of the form: field|serialized_object;field|serialized_object; So I wrote a decode function: function decode($string) { preg_match_all('/\w+|/',$string,$matches); $fields = $matches[0]; $objects = explode(';',$string); $return = array(); foreach($fields as $idx => $field) { $return[preg_replace('/\|$/','',$field)] = unserialize(str_replace($field,'',$objects[$idx])); } return $return; } and it works. Thanks for the help though. - jake On Fri, Dec 12, 2008 at 2:11 PM, till wrote: > On Fri, Dec 12, 2008 at 7:30 PM, Jake McGraw wrote: >> Update: >> >> Looks like the PECL serialize/unserialize used for storing the >> $_SESSION array is different from PHP serialize/unserialize, so when >> Zend app tries to read in the serialized data it doesn't understand >> the serialized $_SESSION array. >> >> Anyone have experience with this? > > I'm not aware of differences, cause I don't know about pecl/serialize? > I thought those are in core. So I'm not sure what your comment relates > to. > > But anyway, maybe this helps: > <http://cvs.php.net/viewvc.cgi/pear/HTTP_Session2/HTTP/Session2/Container/Memcache.php?revision=1.6&view=markup> > > It's the memcache driver/container we use for HTTP_Session2. It > implements the basics (read, write, close, open, etc.). > > Till >> >> - jake >> >> On Fri, Dec 12, 2008 at 12:31 PM, Jake McGraw wrote: >>> I'm trying to create a custom Zend_Session save handler that works >>> with memcache. The code basically goes like this: >>> >>> >> >>> class Custom_Session_SaveHandler_Memcached implements >>> Zend_Session_SaveHandler_Interface { >>> >>> private $cache = null; >>> >>> public function __construct($cache) { >>>$this->cache = $cache; >>> } >>> >>> public function read ($id) { >>>if(!($data = $this->cache->load($id))) { >>> return ''; >>>} else { >>> return $data; >>>} >>> } >>> >>> public function write ($id, $data) { >>>$this->cache->save($data, $id); >>>return true; >>> } >>> >>> public function open ($save_path, $name) { >>>return true; >>> } >>> >>> public function close () { >>>return true; >>> } >>> >>> public function destroy ($id) { >>> } >>> >>> // not used for memcache >>> public function gc ($maxlifetime) { >>>return true; >>> } >>> } >>> >>> This works perfectly fine, session information is saved to memcache >>> using the SID. The problem I'm having is that I have some legacy code >>> which won't be utilizing Zend Framework and also uses memcache to save >>> session information. I'd like to be able to share session information >>> between the legacy code and my Zend App, but I've hit a wall because >>> there appears to be a conflict between >>> Zend_Session::setSaveHandler(memcache) and using the ini directive >>> "session.save_handler=memcache". >>> >>> After debugging the issue, basically watching the state of my memcache >>> values when transitioning from legacy code to my Zend app, it appears >>> that the session information gets cleared between requests, so that >>> any values written to memcache by the legacy app save handler won't >>> transition into the Zend app and viceversa. >>> >>> Besides using ini settings in the Zend app, does anyone have any >>> advice as to why this is happening? >>> >>> - jake >>> >> >
[fw-general] Re: Conflict between Zend_Session::setSaveHandler(memcache) and session.save_handler=memcache
Update: Looks like the PECL serialize/unserialize used for storing the $_SESSION array is different from PHP serialize/unserialize, so when Zend app tries to read in the serialized data it doesn't understand the serialized $_SESSION array. Anyone have experience with this? - jake On Fri, Dec 12, 2008 at 12:31 PM, Jake McGraw wrote: > I'm trying to create a custom Zend_Session save handler that works > with memcache. The code basically goes like this: > > > class Custom_Session_SaveHandler_Memcached implements > Zend_Session_SaveHandler_Interface { > > private $cache = null; > > public function __construct($cache) { >$this->cache = $cache; > } > > public function read ($id) { >if(!($data = $this->cache->load($id))) { > return ''; >} else { > return $data; >} > } > > public function write ($id, $data) { >$this->cache->save($data, $id); >return true; > } > > public function open ($save_path, $name) { >return true; > } > > public function close () { >return true; > } > > public function destroy ($id) { > } > > // not used for memcache > public function gc ($maxlifetime) { >return true; > } > } > > This works perfectly fine, session information is saved to memcache > using the SID. The problem I'm having is that I have some legacy code > which won't be utilizing Zend Framework and also uses memcache to save > session information. I'd like to be able to share session information > between the legacy code and my Zend App, but I've hit a wall because > there appears to be a conflict between > Zend_Session::setSaveHandler(memcache) and using the ini directive > "session.save_handler=memcache". > > After debugging the issue, basically watching the state of my memcache > values when transitioning from legacy code to my Zend app, it appears > that the session information gets cleared between requests, so that > any values written to memcache by the legacy app save handler won't > transition into the Zend app and viceversa. > > Besides using ini settings in the Zend app, does anyone have any > advice as to why this is happening? > > - jake >
[fw-general] Conflict between Zend_Session::setSaveHandler(memcache) and session.save_handler=memcache
I'm trying to create a custom Zend_Session save handler that works with memcache. The code basically goes like this: cache = $cache; } public function read ($id) { if(!($data = $this->cache->load($id))) { return ''; } else { return $data; } } public function write ($id, $data) { $this->cache->save($data, $id); return true; } public function open ($save_path, $name) { return true; } public function close () { return true; } public function destroy ($id) { } // not used for memcache public function gc ($maxlifetime) { return true; } } This works perfectly fine, session information is saved to memcache using the SID. The problem I'm having is that I have some legacy code which won't be utilizing Zend Framework and also uses memcache to save session information. I'd like to be able to share session information between the legacy code and my Zend App, but I've hit a wall because there appears to be a conflict between Zend_Session::setSaveHandler(memcache) and using the ini directive "session.save_handler=memcache". After debugging the issue, basically watching the state of my memcache values when transitioning from legacy code to my Zend app, it appears that the session information gets cleared between requests, so that any values written to memcache by the legacy app save handler won't transition into the Zend app and viceversa. Besides using ini settings in the Zend app, does anyone have any advice as to why this is happening? - jake
Re: [fw-general] Extending Zend_View_Helper_Json
2008/9/8 Christoph Dorn <[EMAIL PROTECTED]>: > I just re-read your message and saw that you were referring to > Zend_View_Helper_Json which does not exit and should work. > > Did you mean to say Zend_Controller_Action_Helper_Json? Yes, that is it, running the following as my BaseController::init() function works across all my inheriting controllers: public function init() { $this->_helper->getHelper('Json')->suppressExit = TRUE; } - jake > > Christoph > > > > Jake McGraw wrote: > > $this->getHelper('Json')->suppressExit = true; > > Chris, you saved me at least day from having to rewrite all those > Controllers and testing, thank you so very much. > > - jake > > On Mon, Sep 8, 2008 at 2:24 PM, Jaka Jančar <[EMAIL PROTECTED]> wrote: > > > Ahh, yes, this is the beauty of some ZF helpers, stuff just exit()'s =) It's > the same in Redirector action helper... never mind if I still have stuff to > do, it just terminates the script. > > I wouldn't put logging into the Json helper, that's ugly. I would however > rewrite it, so it doesn't exit. > > I replaced the Redirector helper with my own Goto helper, which does > something like: > -- > $this->getResponse()->setRedirect($url, $this->getCode()); > Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->setNoRender(); > Zend_Controller_Action_HelperBroker::getStaticHelper('Layout')->disableLayout(); > -- > You can probably do something similar. Just modify the response and disable > viewrenderer and layout. > > I would do the actual logging in a controller plugin (not helper!). That way > it's more pluggable. > > Regards, > Jaka Jancar > > > On 8. Sep 2008, at 20:15, Jake McGraw wrote: > > > > Hello all, bit of a problem, not sure how to resolve it. > > We've developed a RESTful JSON API using Zend Framework MVC. The API > makes heavy use of the Zend_View_Helper_Json object, each controller, > which represents a separate resource does the following when its done > processing: > > $this->_helper->json( $data ); > > All of this was fine and dandy, until it was decided that we need > logging to record every request/response to the API. I setup a > BaseController which logs the request during preDispatch. Now, my > problem is that directly calling $this->_helper->json( $data ) sends > the response and exits, so, postDispatch never occurs. I've tried to > resolve this by extending Zend_View_Helper_Json as follows: > > class BaseHelperJson extends Zend_View_Helper_Json > { > public function json( $data, $keepLayouts = false ) > { > // ... Do some logging ... > parent::json( $data, $keepLayouts ); > } > } > > Then during init() I tried replacing the Zend Json Helper with my own... > > public function init() > { > // Do some init... > > $this->_helper->removeHelper('json'); > $this->_helper->addHelper(new BaseHelperJson()); > > // Whoops, how do I reference BaseHelperJson?? > } > > This causes an error because addHelper() expects > Zend_View_Helper_Abstract... regardless, I wouldn't know how to > reference my custom helper as $this->_helper->json anyway. So my > question: is there any way to resolve this using OOP or Zend MVC magic > or will I have to go through each controller and replace > $this->_helper->json with something that plays nice with the > dispatcher? > > - jake > > > > > -- > Christoph Dorn > http://www.ChristophDorn.com/
Re: [fw-general] Extending Zend_View_Helper_Json
$this->getHelper('Json')->suppressExit = true; Chris, you saved me at least day from having to rewrite all those Controllers and testing, thank you so very much. - jake On Mon, Sep 8, 2008 at 2:24 PM, Jaka Jančar <[EMAIL PROTECTED]> wrote: > Ahh, yes, this is the beauty of some ZF helpers, stuff just exit()'s =) It's > the same in Redirector action helper... never mind if I still have stuff to > do, it just terminates the script. > > I wouldn't put logging into the Json helper, that's ugly. I would however > rewrite it, so it doesn't exit. > > I replaced the Redirector helper with my own Goto helper, which does > something like: > -- > $this->getResponse()->setRedirect($url, $this->getCode()); > Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->setNoRender(); > Zend_Controller_Action_HelperBroker::getStaticHelper('Layout')->disableLayout(); > -- > You can probably do something similar. Just modify the response and disable > viewrenderer and layout. > > I would do the actual logging in a controller plugin (not helper!). That way > it's more pluggable. > > Regards, > Jaka Jancar > > > On 8. Sep 2008, at 20:15, Jake McGraw wrote: > >> Hello all, bit of a problem, not sure how to resolve it. >> >> We've developed a RESTful JSON API using Zend Framework MVC. The API >> makes heavy use of the Zend_View_Helper_Json object, each controller, >> which represents a separate resource does the following when its done >> processing: >> >> $this->_helper->json( $data ); >> >> All of this was fine and dandy, until it was decided that we need >> logging to record every request/response to the API. I setup a >> BaseController which logs the request during preDispatch. Now, my >> problem is that directly calling $this->_helper->json( $data ) sends >> the response and exits, so, postDispatch never occurs. I've tried to >> resolve this by extending Zend_View_Helper_Json as follows: >> >> class BaseHelperJson extends Zend_View_Helper_Json >> { >> public function json( $data, $keepLayouts = false ) >> { >> // ... Do some logging ... >> parent::json( $data, $keepLayouts ); >> } >> } >> >> Then during init() I tried replacing the Zend Json Helper with my own... >> >> public function init() >> { >> // Do some init... >> >> $this->_helper->removeHelper('json'); >> $this->_helper->addHelper(new BaseHelperJson()); >> >> // Whoops, how do I reference BaseHelperJson?? >> } >> >> This causes an error because addHelper() expects >> Zend_View_Helper_Abstract... regardless, I wouldn't know how to >> reference my custom helper as $this->_helper->json anyway. So my >> question: is there any way to resolve this using OOP or Zend MVC magic >> or will I have to go through each controller and replace >> $this->_helper->json with something that plays nice with the >> dispatcher? >> >> - jake > >
[fw-general] Extending Zend_View_Helper_Json
Hello all, bit of a problem, not sure how to resolve it. We've developed a RESTful JSON API using Zend Framework MVC. The API makes heavy use of the Zend_View_Helper_Json object, each controller, which represents a separate resource does the following when its done processing: $this->_helper->json( $data ); All of this was fine and dandy, until it was decided that we need logging to record every request/response to the API. I setup a BaseController which logs the request during preDispatch. Now, my problem is that directly calling $this->_helper->json( $data ) sends the response and exits, so, postDispatch never occurs. I've tried to resolve this by extending Zend_View_Helper_Json as follows: class BaseHelperJson extends Zend_View_Helper_Json { public function json( $data, $keepLayouts = false ) { // ... Do some logging ... parent::json( $data, $keepLayouts ); } } Then during init() I tried replacing the Zend Json Helper with my own... public function init() { // Do some init... $this->_helper->removeHelper('json'); $this->_helper->addHelper(new BaseHelperJson()); // Whoops, how do I reference BaseHelperJson?? } This causes an error because addHelper() expects Zend_View_Helper_Abstract... regardless, I wouldn't know how to reference my custom helper as $this->_helper->json anyway. So my question: is there any way to resolve this using OOP or Zend MVC magic or will I have to go through each controller and replace $this->_helper->json with something that plays nice with the dispatcher? - jake
[fw-general] [OT] Throwing an exception from set_error_handler messes up $trace[args]
This isn't necessarily a problem with Zend Framework, but I encountered it while trying to beautify my PHP error screens using ZF MVC. Here's the scenario: I'm using the following code to generate exceptions when an error occurs in PHP: if (!function_exists('exceptions_error_handler')) { function exceptions_error_handler($severity, 0, $errfile, $errline) { throw new ErrorException($errstr, 0, $severity, $errfile, $errline); } } set_error_handler('exceptions_error_handler', E_ALL); Now, when an error occurs within one of my Controllers, ErrorController will take over: class IndexController extends Zend_Controller_Action { public function indexAction() { $foo->bar; // Uninitialized var } } In the view script for my error controller, I print out a nice, formatted trace of the exception, using Exception::getTrace(). Here's where I'm having the problem; exceptions generated from PHP errors always have $trace[args] off by one. That is, each call entry in the trace stack will have the function parameters for the previous call, so, above will producea backtrace of: function exceptions_error_handler() IndexController::indexAction(String("indexAction")) Zend_Controller_Action::dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) Zend_Controller_Dispatcher_Standard::dispatch() Zend_Controller_Front::dispatch() Notice indexAction("indexAction")... "indexAction" is should be in the trace for the previous call: Zend_Controller_Action::dispatch("indexAction") not IndexController::indexAction(). I achieve the expected result when I explicitly throw an exception: class IndexController extends Zend_Controller_Action { public function indexAction() { throw new Exception("foobar!"); } } Will produce a backtrace of: IndexController::indexAction() Zend_Controller_Action::dispatch(String("indexAction")) Zend_Controller_Dispatcher_Standard::dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) Zend_Controller_Front::dispatch() So my question is, Is this a known issue with debug_backtrace() and exceptions thrown from set_error_handler() or am I missing something? - jake
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
Everyone, sorry to bother you with this, turns out I've been doing too much programming in true functional languages, which PHP is not, and I had some code which I thought was ok, but some how combined with a call to json_decode caused PHP to crash. I was basically doing something like: function round_datetime(Zend_Date &$datetime) { $tmp = clone $datetime; $tmp->set(0, Zend_Date::SECOND); $tmp->set($tmp->get(Zend_Date::MINUTE)<30?0:30, Zend_Date::MINUTE); return $tmp; } To zero-out the seconds portion of a Zend_Date object and fix the minutes to 0 or 30. I would then do something like: public function fooAction() { $now = new Zend_Date(); $min = round_datetime($now)->get('-MM-dd'); // ... // Get JSON from API server using generated time above // ... json_decode($jsonString); } Now, since this worked without the json_decode call, I was under the impression that the error was with json_decode, not my weird datetime function. Well, I have removed the datetime function, and now everything works. All of this has been very weird, because I don't see how round_datetime + json_decode interacted in a way to crash PHP. Perhaps some Zend people could provide a perspective? Thanks for all help. - jake On Fri, Aug 15, 2008 at 3:51 PM, Jake McGraw <[EMAIL PROTECTED]> wrote: > Terre: > > Thanks for the effort, but I have also been able to set up a basic > Controller / Layout / View and get my code to work. There still > appears to be some kind of intractable issue going on here that has to > do with json_decode and Zend MVC will my existing code base. I'm going > to try to refactor my code, and get this working. I'll report back my > findings. > > - jake > > On Fri, Aug 15, 2008 at 2:37 PM, Terre Porter > <[EMAIL PROTECTED]> wrote: >> >> I put together a basic test project. >> >> Used the layout and the view tpl you provided. >> >> I've got this as my controller function. >> >> public function indexAction() >> { >>$jsonData = '--string from text file--'; >>$result = json_decode($jsonData); >>var_dump($result); >> } >> >> I get a "hello world" and a var dump of the json data. >> >> What needs to happen to the $results data for it to be used on the >> layout/view? >> >> Terre >> >> -Original Message- >> From: Jake McGraw [mailto:[EMAIL PROTECTED] >> Sent: Friday, August 15, 2008 1:07 PM >> To: Terre Porter; fw-general >> Subject: Re: [fw-general] Zend_Json::decode in Controller causing Blank >> Screen of Death >> >> On Fri, Aug 15, 2008 at 12:31 PM, Terre Porter >> <[EMAIL PROTECTED]> wrote: >>> >>> I've been following this a little. >>> >>> If I understand this right... >>> >>> The json decode works if you dump the var but not if you allow the >>> page to run through the view. >>> >>> What happens in the view? >>> >>> You mention these : >>> >>> -- sets HTML head >>> -- spits out contents >> >> My Layout: >> >> > >>// >>$this->headMeta() >>->appendHttpEquiv('Content-Type', 'text/html; >> charset=UTF-8') >>->appendHttpEquiv('Content-Language', 'en-US'); >> >>$this->headTitle() >>->headTitle('My Page', 'APPEND'); >> >>echo $this->doctype('XHTML1_STRICT'); >> ?> >> >> http://www.w3.org/1999/xhtml";> >> >> headMeta() ?> >> >>headTitle() ?> >> >> >> >>layout()->content ?> >> >> >> >> >> My View: >> HELLO WORLD >> >> In the course of debugging this, I've tried to take out all of the possible >> bugs, I've narrowed it down to one thing: attempting to json_decode a >> perfectly valid JSON string, which I've attached, prior to preDispatch(), >> View, Layout rendering causes blank screen. >> >> - jake >> >>> >>> Does the view do anything to the data? i.e. expect a exact array key >>> to exist? >>> >>> Just some thoughts >>> Terre >>> >>> >>> -Original Message- >>> From: Jake McGraw [mailto:[EMAIL PROTECTED] >>> Sent: Friday, August 15, 2008 12:13 PM >>> To: fw-general@lists.zend.com >>> Subj
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
Terre: Thanks for the effort, but I have also been able to set up a basic Controller / Layout / View and get my code to work. There still appears to be some kind of intractable issue going on here that has to do with json_decode and Zend MVC will my existing code base. I'm going to try to refactor my code, and get this working. I'll report back my findings. - jake On Fri, Aug 15, 2008 at 2:37 PM, Terre Porter <[EMAIL PROTECTED]> wrote: > > I put together a basic test project. > > Used the layout and the view tpl you provided. > > I've got this as my controller function. > > public function indexAction() > { >$jsonData = '--string from text file--'; >$result = json_decode($jsonData); >var_dump($result); > } > > I get a "hello world" and a var dump of the json data. > > What needs to happen to the $results data for it to be used on the > layout/view? > > Terre > > -Original Message- > From: Jake McGraw [mailto:[EMAIL PROTECTED] > Sent: Friday, August 15, 2008 1:07 PM > To: Terre Porter; fw-general > Subject: Re: [fw-general] Zend_Json::decode in Controller causing Blank > Screen of Death > > On Fri, Aug 15, 2008 at 12:31 PM, Terre Porter > <[EMAIL PROTECTED]> wrote: >> >> I've been following this a little. >> >> If I understand this right... >> >> The json decode works if you dump the var but not if you allow the >> page to run through the view. >> >> What happens in the view? >> >> You mention these : >> >> -- sets HTML head >> -- spits out contents > > My Layout: > > >// >$this->headMeta() >->appendHttpEquiv('Content-Type', 'text/html; > charset=UTF-8') >->appendHttpEquiv('Content-Language', 'en-US'); > >$this->headTitle() >->headTitle('My Page', 'APPEND'); > >echo $this->doctype('XHTML1_STRICT'); > ?> > > http://www.w3.org/1999/xhtml";> > >headMeta() ?> > >headTitle() ?> > > > >layout()->content ?> > > > > > My View: > HELLO WORLD > > In the course of debugging this, I've tried to take out all of the possible > bugs, I've narrowed it down to one thing: attempting to json_decode a > perfectly valid JSON string, which I've attached, prior to preDispatch(), > View, Layout rendering causes blank screen. > > - jake > >> >> Does the view do anything to the data? i.e. expect a exact array key >> to exist? >> >> Just some thoughts >> Terre >> >> >> -Original Message- >> From: Jake McGraw [mailto:[EMAIL PROTECTED] >> Sent: Friday, August 15, 2008 12:13 PM >> To: fw-general@lists.zend.com >> Subject: Re: [fw-general] Zend_Json::decode in Controller causing >> Blank Screen of Death >> >>> Comment out the above line and see what happens -- this is what the >>> previous comment was getting at. >>> >> >> Still not working, commented out line, restarted apache, same issue... >> I'm not sure that this is related to json/xdebug, as >> Zend_Json::decode/json_decode both operate correctly with the same >> JSON string outside of the Zend MVC, it is only when I use any of the >> following: >> >> Zend_Json::decode($jsonString); >> >> Zend_Json::$useBuiltinEncoderDecoder = TRUE >> Zend_Json::decode($jsonString); >> >> json_decode($jsonString, TRUE); >> >> and then allow Layout, View to render that I get the blank screen. >> Note, I'm not actually doing anything with the resulting PHP array >> from the decoding. I'm not passing it to the view, which simply sets >> the HTML head and spits out the content. I'm just attempting to dump it. >> >> Again, thanks for the help! >> >> - jake >> >>> >>>> Again, nothing in error reporting, logging, etc. Just a blank screen. >>>> Also, this works fine (same JSON) outside of Zend_Controller_Action. >>>> >>>> > -Matt >>>> > >>>> > On Fri, Aug 15, 2008 at 8:20 AM, Jake McGraw <[EMAIL PROTECTED]> >> wrote: >>>> >> >>>> >> I've spent the last two days struggling with this error: >>>> >> >>>> >> We've been utilizing REST-ful JSON server for a couple of months >>>> >>
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
On Fri, Aug 15, 2008 at 12:31 PM, Terre Porter <[EMAIL PROTECTED]> wrote: > > I've been following this a little. > > If I understand this right... > > The json decode works if you dump the var but not if you allow the page to > run through the view. > > What happens in the view? > > You mention these : > > -- sets HTML head > -- spits out contents My Layout: $this->headMeta() ->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ->appendHttpEquiv('Content-Language', 'en-US'); $this->headTitle() ->headTitle('My Page', 'APPEND'); echo $this->doctype('XHTML1_STRICT'); ?> http://www.w3.org/1999/xhtml";> headMeta() ?> headTitle() ?> layout()->content ?> My View: HELLO WORLD In the course of debugging this, I've tried to take out all of the possible bugs, I've narrowed it down to one thing: attempting to json_decode a perfectly valid JSON string, which I've attached, prior to preDispatch(), View, Layout rendering causes blank screen. - jake > > Does the view do anything to the data? i.e. expect a exact array key to > exist? > > Just some thoughts > Terre > > > -Original Message- > From: Jake McGraw [mailto:[EMAIL PROTECTED] > Sent: Friday, August 15, 2008 12:13 PM > To: fw-general@lists.zend.com > Subject: Re: [fw-general] Zend_Json::decode in Controller causing Blank > Screen of Death > >> Comment out the above line and see what happens -- this is what the >> previous comment was getting at. >> > > Still not working, commented out line, restarted apache, same issue... > I'm not sure that this is related to json/xdebug, as > Zend_Json::decode/json_decode both operate correctly with the same JSON > string outside of the Zend MVC, it is only when I use any of the > following: > > Zend_Json::decode($jsonString); > > Zend_Json::$useBuiltinEncoderDecoder = TRUE Zend_Json::decode($jsonString); > > json_decode($jsonString, TRUE); > > and then allow Layout, View to render that I get the blank screen. > Note, I'm not actually doing anything with the resulting PHP array from the > decoding. I'm not passing it to the view, which simply sets the HTML head > and spits out the content. I'm just attempting to dump it. > > Again, thanks for the help! > > - jake > >> >>> Again, nothing in error reporting, logging, etc. Just a blank screen. >>> Also, this works fine (same JSON) outside of Zend_Controller_Action. >>> >>> > -Matt >>> > >>> > On Fri, Aug 15, 2008 at 8:20 AM, Jake McGraw <[EMAIL PROTECTED]> > wrote: >>> >> >>> >> I've spent the last two days struggling with this error: >>> >> >>> >> We've been utilizing REST-ful JSON server for a couple of months now > to host our data api (it's written using Zend Framework). Our client apps > access this API, and decode the JSON. Yesterday, one of our client apps > stopped working, generating no errors, no ouput, just a blank screen. After > commenting out the majority of the code, we found the following code was > causing the grief: >>> >> >>> >> >> >> >>> >> // BaseController extends Zend_Controller_Action class >>> >> CustomController extends BaseController { >>> >> >>> >> public function someAction() { >>> >> >>> >> $result = $this->api->get('resource', array('field1' => >>> >> 'value1')); >>> >> >>> >> $result = >>> >> Zend_Json::decode($result->getResponse()->getBody()); >>> >> >>> >> var_dump($result); >>> >> >>> >> // exit; >>> >> } >>> >> >>> >> } >>> >> >>> >> Now, we only get the blank screen when we allow our dispatcher to > render our Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the > following logic steps work fine: >>> >> >>> >> - Uncomment exit, prevent Layout, View rendering >>> >> var_dump($result); exit; >>> >> >>> >> - Check body for valid JSON (everything OK in JSON Lint) >>> >> - Layout, View render correctly >>> &g
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
> Comment out the above line and see what happens -- this is what the > previous comment was getting at. > Still not working, commented out line, restarted apache, same issue... I'm not sure that this is related to json/xdebug, as Zend_Json::decode/json_decode both operate correctly with the same JSON string outside of the Zend MVC, it is only when I use any of the following: Zend_Json::decode($jsonString); Zend_Json::$useBuiltinEncoderDecoder = TRUE Zend_Json::decode($jsonString); json_decode($jsonString, TRUE); and then allow Layout, View to render that I get the blank screen. Note, I'm not actually doing anything with the resulting PHP array from the decoding. I'm not passing it to the view, which simply sets the HTML head and spits out the content. I'm just attempting to dump it. Again, thanks for the help! - jake > >> Again, nothing in error reporting, logging, etc. Just a blank screen. >> Also, this works fine (same JSON) outside of Zend_Controller_Action. >> >> > -Matt >> > >> > On Fri, Aug 15, 2008 at 8:20 AM, Jake McGraw <[EMAIL PROTECTED]> wrote: >> >> >> >> I've spent the last two days struggling with this error: >> >> >> >> We've been utilizing REST-ful JSON server for a couple of months now to >> >> host our data api (it's written using Zend Framework). Our client apps >> >> access this API, and decode the JSON. Yesterday, one of our client apps >> >> stopped working, generating no errors, no ouput, just a blank screen. >> >> After commenting out the majority of the code, we found the following >> >> code was causing the grief: >> >> >> >> > >> >> >> // BaseController extends Zend_Controller_Action >> >> class CustomController extends BaseController { >> >> >> >> public function someAction() { >> >> >> >> $result = $this->api->get('resource', array('field1' => 'value1')); >> >> >> >> $result = Zend_Json::decode($result->getResponse()->getBody()); >> >> >> >> var_dump($result); >> >> >> >> // exit; >> >> } >> >> >> >> } >> >> >> >> Now, we only get the blank screen when we allow our dispatcher to render >> >> our Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the >> >> following logic steps work fine: >> >> >> >> - Uncomment exit, prevent Layout, View rendering >> >> var_dump($result); >> >> exit; >> >> >> >> - Check body for valid JSON (everything OK in JSON Lint) >> >> - Layout, View render correctly >> >> var_dump($result->getResponse()->getBody()); >> >> >> >> - Try another JSON string >> >> - Layout, View render correctly >> >> var_dump(Zend_Json::decode('[{"foo":"bar"}]')); >> >> >> >> The JSON looks something like this: >> >> >> >> [ >> >> { >> >> "cm_broadcast_type": "National Broadcast Networks", >> >> "id": "12659575", >> >> "station_id": "12336", >> >> "program_id": "EP010501290006", >> >> "start_time": "2008081400", >> >> "end_time": "2008081401", >> >> "cc": "Y", >> >> "title": "Greatest American Dog" >> >> }, >> >> { >> >> "cm_broadcast_type": "National Broadcast Networks", >> >> "id": "11469048", >> >> "station_id": "12336", >> >> "program_id": "EP007537910036", >> >> "start_time": "2008081401", >> >> "end_time": "2008081402", >> >> "cc": "Y", >> >> "title": "Criminal Minds" >> >> }, >> >> ... Continue ... >> >> ] >> >> >> >> So, as I've said, the problem only occurs when we allow the dispatcher to >> >> continue rendering Layout, View after using Zend_Json::decode, any help >> >> would be MUCH appreciated. >> >> >> >> - jake >> > > -- > Matthew Weier O'Phinney > Software Architect | [EMAIL PROTECTED] > Zend Framework | http://framework.zend.com/ >
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
> Do you have ext/json installed? According to phpinfo(): json json support enabled json version 1.2.1 and grepping our ini file: ;extension=json.so So, I assume we're using the built-in version of json_(encode|decode) > This is (I hope) unlikely, but if you somehow have Xdebug installed on this > production server, Zend_Json can trigger xdebug.max_nesting_level in certain > situations. You would probably see an error in this case, but I'm including > this just to be on the safe side. Grepping out ini file: ;extension=xdebug.so zend_extension_ts="/usr/local/lib/php/extensions/no-debug-non-zts-20050922/xdebug.so" Again, nothing in error reporting, logging, etc. Just a blank screen. Also, this works fine (same JSON) outside of Zend_Controller_Action. > -Matt > > On Fri, Aug 15, 2008 at 8:20 AM, Jake McGraw <[EMAIL PROTECTED]> wrote: >> >> I've spent the last two days struggling with this error: >> >> We've been utilizing REST-ful JSON server for a couple of months now to host >> our data api (it's written using Zend Framework). Our client apps access >> this API, and decode the JSON. Yesterday, one of our client apps stopped >> working, generating no errors, no ouput, just a blank screen. After >> commenting out the majority of the code, we found the following code was >> causing the grief: >> >> > >> // BaseController extends Zend_Controller_Action >> class CustomController extends BaseController { >> >> public function someAction() { >> >> $result = $this->api->get('resource', array('field1' => 'value1')); >> >> $result = Zend_Json::decode($result->getResponse()->getBody()); >> >> var_dump($result); >> >> // exit; >> } >> >> } >> >> Now, we only get the blank screen when we allow our dispatcher to render our >> Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the following >> logic steps work fine: >> >> - Uncomment exit, prevent Layout, View rendering >> var_dump($result); >> exit; >> >> - Check body for valid JSON (everything OK in JSON Lint) >> - Layout, View render correctly >> var_dump($result->getResponse()->getBody()); >> >> - Try another JSON string >> - Layout, View render correctly >> var_dump(Zend_Json::decode('[{"foo":"bar"}]')); >> >> The JSON looks something like this: >> >> [ >> { >> "cm_broadcast_type": "National Broadcast Networks", >> "id": "12659575", >> "station_id": "12336", >> "program_id": "EP010501290006", >> "start_time": "2008081400", >> "end_time": "2008081401", >> "cc": "Y", >> "title": "Greatest American Dog" >> }, >> { >> "cm_broadcast_type": "National Broadcast Networks", >> "id": "11469048", >> "station_id": "12336", >> "program_id": "EP007537910036", >> "start_time": "2008081401", >> "end_time": "2008081402", >> "cc": "Y", >> "title": "Criminal Minds" >> }, >> ... Continue ... >> ] >> >> So, as I've said, the problem only occurs when we allow the dispatcher to >> continue rendering Layout, View after using Zend_Json::decode, any help >> would be MUCH appreciated. >> >> - jake
Re: [fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
> Are there no errors written to logs? Usually when I get a blank screen > display_errors = Off, but log_errors = On. > I wish, looking at the error log now, some debugging I did earlier shows up there, but nothing for my current set of problems. This is on one of our development servers, so error_reporting, log_errors, everything is set up. - jake > > > On Fri, Aug 15, 2008 at 5:20 PM, Jake McGraw <[EMAIL PROTECTED]> wrote: > >> I've spent the last two days struggling with this error: >> >> We've been utilizing REST-ful JSON server for a couple of months now to >> host our data api (it's written using Zend Framework). Our client apps >> access this API, and decode the JSON. Yesterday, one of our client apps >> stopped working, generating no errors, no ouput, just a blank screen. After >> commenting out the majority of the code, we found the following code was >> causing the grief: >> >> > >> // BaseController extends Zend_Controller_Action >> class CustomController extends BaseController { >> >> public function someAction() { >> >> $result = $this->api->get('resource', array('field1' => 'value1')); >> >> $result = Zend_Json::decode($result->getResponse()->getBody()); >> >> var_dump($result); >> >> // exit; >> } >> >> } >> >> Now, we only get the blank screen when we allow our dispatcher to render >> our Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the following >> logic steps work fine: >> >> - Uncomment exit, prevent Layout, View rendering >> var_dump($result); >> exit; >> >> - Check body for valid JSON (everything OK in JSON Lint) >> - Layout, View render correctly >> var_dump($result->getResponse()->getBody()); >> >> - Try another JSON string >> - Layout, View render correctly >> var_dump(Zend_Json::decode('[{"foo":"bar"}]')); >> >> The JSON looks something like this: >> >> [ >> { >> "cm_broadcast_type": "National Broadcast Networks", >> "id": "12659575", >> "station_id": "12336", >> "program_id": "EP010501290006", >> "start_time": "2008081400", >> "end_time": "2008081401", >> "cc": "Y", >> "title": "Greatest American Dog" >> }, >> { >> "cm_broadcast_type": "National Broadcast Networks", >> "id": "11469048", >> "station_id": "12336", >> "program_id": "EP007537910036", >> "start_time": "2008081401", >> "end_time": "2008081402", >> "cc": "Y", >> "title": "Criminal Minds" >> }, >> ... Continue ... >> ] >> >> So, as I've said, the problem only occurs when we allow the dispatcher to >> continue rendering Layout, View after using Zend_Json::decode, any help >> would be MUCH appreciated. >> >> - jake >> >> >
[fw-general] Zend_Json::decode in Controller causing Blank Screen of Death
I've spent the last two days struggling with this error: We've been utilizing REST-ful JSON server for a couple of months now to host our data api (it's written using Zend Framework). Our client apps access this API, and decode the JSON. Yesterday, one of our client apps stopped working, generating no errors, no ouput, just a blank screen. After commenting out the majority of the code, we found the following code was causing the grief: api->get('resource', array('field1' => 'value1')); $result = Zend_Json::decode($result->getResponse()->getBody()); var_dump($result); // exit; } } Now, we only get the blank screen when we allow our dispatcher to render our Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the following logic steps work fine: - Uncomment exit, prevent Layout, View rendering var_dump($result); exit; - Check body for valid JSON (everything OK in JSON Lint) - Layout, View render correctly var_dump($result->getResponse()->getBody()); - Try another JSON string - Layout, View render correctly var_dump(Zend_Json::decode('[{"foo":"bar"}]')); The JSON looks something like this: [ { "cm_broadcast_type": "National Broadcast Networks", "id": "12659575", "station_id": "12336", "program_id": "EP010501290006", "start_time": "2008081400", "end_time": "2008081401", "cc": "Y", "title": "Greatest American Dog" }, { "cm_broadcast_type": "National Broadcast Networks", "id": "11469048", "station_id": "12336", "program_id": "EP007537910036", "start_time": "2008081401", "end_time": "2008081402", "cc": "Y", "title": "Criminal Minds" }, ... Continue ... ] So, as I've said, the problem only occurs when we allow the dispatcher to continue rendering Layout, View after using Zend_Json::decode, any help would be MUCH appreciated. - jake
Re: [fw-general] Zend_View_Helper_Jquery - Ready for Review
Page not found: http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Jquery+-+Benjamin+Eberlei - jake On Thu, Jul 17, 2008 at 11:41 AM, Juan Felipe Alvarez Saldarriaga < [EMAIL PROTECTED]> wrote: > Great news! :D > > Like Matthew say, don't care wich JS framework you use if you can use it > via Zend Framework! :D :D, I think most important is bring Zend Framework > more options. > > Thx for the news!. > > - Original Message - > From: "Matthew Weier O'Phinney" <[EMAIL PROTECTED]> > To: fw-general@lists.zend.com > Sent: Tuesday, July 15, 2008 6:21:08 AM GMT -05:00 Columbia > Subject: Re: [fw-general] Zend_View_Helper_Jquery - Ready for Review > > -- Cristian Bichis <[EMAIL PROTECTED]> wrote > (on Tuesday, 15 July 2008, 08:52 AM +0300): > > A very good idea, since jQuery is probably the most used JS > > library/framewok. > > Just a note: let's keep comments like the above out of the discussions. > JS library choice is practically a religious topic, and everybody has > their favorite and their opinions. Let's focus on implementation and > requirements in the discussions. > > BTW, Benjamin, I've commented on the proposal. > > > > i wanted to let you know that my Zend_View_Helper_Jquery proposal is > > > ready for review: > > > > > > > http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_Jquery+-+Benjamin+Eberlei > > > > > > Please discuss. Important discussion for the beginning are the > > > concerns/problems I raised in the first comment of that proposal > > > regarding jQuery plugin architecture. I would appreciate every bit of > > > input on this issue (and the component overall of course). > > -- > Matthew Weier O'Phinney > Software Architect | [EMAIL PROTECTED] > Zend Framework | http://framework.zend.com/ >
Re: [fw-general] Recent Component Promotions
> You can find it in the svn repo. It will be compiled and part of the > official 1.6 docs later on, but for now, the code lives in the repository > only (as it is usual for new components. > No proposal documentation? Not that I don't mind digging elbow deep into new code, just thought there would be a little hand holding in the work leading up to the move to an officially sanctioned Zend Component. - jake
Re: [fw-general] Recent Component Promotions
> > I've promoted the following components from standard/incubator/ to > > standard/trunk/ in preparation for the 1.6.0 release: > > > > > > Where is this in the wiki? > > http://framework.zend.com/wiki/display/ZFPROP/Standard+Library I should have been more specific, I'm not seeing any documentation for Zend_Dom_Query, where can I find this. - jake
Re: [fw-general] Recent Component Promotions
> I've promoted the following components from standard/incubator/ to > standard/trunk/ in preparation for the 1.6.0 release: > Where is this in the wiki? - jake
Re: [fw-general] XML RPC calls no longer working in 1.5, possibly due to server introspection?
> Is this still the case for the 1.5.2 release or current trunk? The > indications on that bug are that it's fixed. > Looking at 1.5.2, looks like this was fixed. - jake > >> > /** >> * FIXME Use this class instead of Zend_XmlRpc_Client until bug is fixed >> * http://framework.zend.com/issues/browse/ZF-2978 >> */ >> class BugFixXmlRpcClient extends Zend_XmlRpc_Client >> { >> public function call($method, $params = array()) >> { >> $request = new Zend_XmlRpc_Request($method, $params); >> $this->doRequest($request); >> if ($this->getLastResponse()->isFault()) { >> $fault = $this->getLastResponse()->getFault(); >> throw new >> Zend_XmlRpc_Client_FaultException($fault->getMessage(), >> $fault->getCode()); >> } >> return $this->getLastResponse()->getReturnValue(); >> } >> } >> >> >> - jake >> >> >> On Wed, Jul 9, 2008 at 11:52 AM, David Edwards >> <[EMAIL PROTECTED]> wrote: >> > >> > Hi, >> > >> > We have been using the ZF XmlRpc classes to communicate with our payment >> > gateway for a while now, and this has worked fine for us in the past (using >> > 1.0.x). However, in testing a newer version of the ZF libraries (1.5.x), >> > our >> > XML RPC calls stopped working, giving out the error: >> > >> > java.lang.Exception: RPC handler object "system" not found and no default >> > handler registered >> > >> > Having dug around a bit, it appears that Zend_XmlRpc_Client now includes >> > some code to handle empty array parameters in the call() method (according >> > to the comments in the code), and it's in this block that the client makes >> > an additional method call (system.methodSignature), to which the gateway >> > server replies with the above error. >> > >> > I'm a bit stuck as to what's happening here. Is it the case that the >> > payment >> > gateway is breaking the XMLRPC spec (i.e. there should be a system object >> > on >> > the other end)? Is there a way to get Zend_XmlRpc_Client not to perform >> > these calls? Any advice on the matter is greatly appreciated. >> > >> > Many thanks, >> > >> > David Edwards >> > -- >> > View this message in context: >> > http://www.nabble.com/XML-RPC-calls-no-longer-working-in-1.5%2C-possibly-due-to-server-introspection--tp18363733p18363733.html >> > Sent from the Zend Framework mailing list archive at Nabble.com. >> > >> > >> > > -- > Matthew Weier O'Phinney > Software Architect | [EMAIL PROTECTED] > Zend Framework | http://framework.zend.com/ >
Re: [fw-general] XML RPC calls no longer working in 1.5, possibly due to server introspection?
I believe a lot of folks have been bit by this bug: http://framework.zend.com/issues/browse/ZF-2978 The solution is posted here: http://framework.zend.com/issues/browse/ZF-2978?focusedCommentId=20489#action_20489 Doesn't work because $_lastResponse is a private member so try using this: http://framework.zend.com/issues/browse/ZF-2978 */ class BugFixXmlRpcClient extends Zend_XmlRpc_Client { public function call($method, $params = array()) { $request = new Zend_XmlRpc_Request($method, $params); $this->doRequest($request); if ($this->getLastResponse()->isFault()) { $fault = $this->getLastResponse()->getFault(); throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode()); } return $this->getLastResponse()->getReturnValue(); } } - jake On Wed, Jul 9, 2008 at 11:52 AM, David Edwards <[EMAIL PROTECTED]> wrote: > > Hi, > > We have been using the ZF XmlRpc classes to communicate with our payment > gateway for a while now, and this has worked fine for us in the past (using > 1.0.x). However, in testing a newer version of the ZF libraries (1.5.x), our > XML RPC calls stopped working, giving out the error: > > java.lang.Exception: RPC handler object "system" not found and no default > handler registered > > Having dug around a bit, it appears that Zend_XmlRpc_Client now includes > some code to handle empty array parameters in the call() method (according > to the comments in the code), and it's in this block that the client makes > an additional method call (system.methodSignature), to which the gateway > server replies with the above error. > > I'm a bit stuck as to what's happening here. Is it the case that the payment > gateway is breaking the XMLRPC spec (i.e. there should be a system object on > the other end)? Is there a way to get Zend_XmlRpc_Client not to perform > these calls? Any advice on the matter is greatly appreciated. > > Many thanks, > > David Edwards > -- > View this message in context: > http://www.nabble.com/XML-RPC-calls-no-longer-working-in-1.5%2C-possibly-due-to-server-introspection--tp18363733p18363733.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >
Re: [fw-general] Zend_Db, pdo_mysql, Transaction Support?
> The default table handler in MySQL is MyISAM which doesn't support > transactions. InnoDB does support transactions. Ahh, that makes sense, the tables in question are MyISAM. Thanks for the input. - jake On Wed, Jun 25, 2008 at 12:31 PM, James Dempster <[EMAIL PROTECTED]> wrote: > For transactions to work on MySQL the table handlers is required to support > transactions. > > The default table handler in MySQL is MyISAM which doesn't support > transactions. InnoDB does support transactions. > > Double check that you are using a table handler that supports transactions. > > /James Dempster > > On Wed, Jun 25, 2008 at 4:56 PM, Jake McGraw <[EMAIL PROTECTED]> wrote: >> >> Here's the code: >> >> http://rafb.net/p/GEpl5468.html (Code paste site) >> >> My problem is that the first insertion is always successfully >> committed to the database, even when I throw an exception. I've read >> up on the way pdo_mysql handles "transactions", none of my code >> performs any task on DDLs, so my question is: >> >> Does Zend_Db using pdo_mysql support transactions? >> >> - jake > >
[fw-general] Zend_Db, pdo_mysql, Transaction Support?
Here's the code: http://rafb.net/p/GEpl5468.html (Code paste site) My problem is that the first insertion is always successfully committed to the database, even when I throw an exception. I've read up on the way pdo_mysql handles "transactions", none of my code performs any task on DDLs, so my question is: Does Zend_Db using pdo_mysql support transactions? - jake
Re: [fw-general] Re: Using FlashMessenger to display a message when there was an error processing a form
> My goal with this helper was to be able to leverage a similar interface to > FlashMessenger > for a generic message storage that would persist messages across redirects > _and_ make them available if a redirect did _not_ occur. This is a solution we came up with at company, I'd highly suggest people take this route. - jake
Re: [fw-general] Using FlashMessenger to display a message when there was an error processing a form
FlashMessenger is meant for displaying messages only after receiving a second request, like a redirect: FIRST REQUEST Client to Server - POST form values Server - Process form values Server - Form values will cause a redirect, record all messages FlashMessenger Server to Client - Send redirect SECOND REQUEST Client to Server - GET redirect page Server - Check FlashMessenger queue for messages Server to Client - Print out messages In order to solve your problem, record messages to an internal message queue (say an array on Zend_Registry) when you aren't redirecting, otherwise use FlashMessenger. - jake On Tue, Jun 3, 2008 at 10:11 AM, Jeffrey Sambells <[EMAIL PROTECTED]> wrote: > I think the issue is around adding to the flash messenger and then > retrieving the message at the end of the same request (no refresh). I'm > having a similar issue where we use the flash messenger to store messages > and then try to retrieve them during the same request. Sometimes the > application needs to re-direct and sometimes not so the flash messenger > seemed the appropriate place to store them but often they don't show up > until the following page load. I haven't had time to loot into it though. > > - Jeff > > > On 3-Jun-08, at 9:56 AM, Bart McLeod wrote: > >> If you submit the form and validate it, your post data will still be in >> the form, while the page has been refreshed (there has been a round trip to >> the server upon form submission). >> >> I did never use flashmessenger, but I do not see why it would not display >> its message when the user submits the form and thus refreshes the page? >> >> Bart >> >> Vincent schreef: >>> >>> Hi, >>> >>> In my project, the user now and then has to submit a form. Sometimes, >>> there is an error with processing this form (e.g. the data couldn't be >>> inserted into the database). >>> >>> To communicate this to the user, I use the FlashMessenger action helper. >>> However, the FlashMessenger won't display its messages until the next page >>> load, which means I'll either have to refresh the page and lose the POST >>> data, or preserve the POST data so I can populate the form with whatever the >>> user just submitted, but lose the error message. >>> >>> What would be the recommended way to have both? >>> >>> Thanks, >>> -- >>> Vincent > >
Re: [fw-general] Gdata and Analytics
Analytics currently doesn't provide an API: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55561 - jake On Fri, May 30, 2008 at 10:18 AM, Łukasz Wojciechowski <[EMAIL PROTECTED]> wrote: > Hey, > > is it possible to login to analytics with Gdata? I was trying with > > $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'analytics'); > > but then you can't fetch anything from analytics because you're not logged in. > > Any ideas? > > -- > Łukasz Wojciechowski > http://nostrzak.blogspot.com >
Re: [fw-general] Does headScript() Work Correctly?
I've used headScript with great success, typically, I'll have a layout define my js library and then have each template insert it's particular: layout.phtml: headScript()->prependFile('/js/jquery.js'); ?> ... further down ... headScript() ?> search.phtml: headScript()->appendFile('/js/search.js'); ?> This correctly generates all of my
Re: [fw-general] Zend_Registry is good for?
> I was much faster and pratic than any oo way.. By this logic, why are you using any Zend Framework component? Everything Zend does can be accomplished without a single object, just process scripts top to bottom, throw in a couple of conditional includes and put each piece of "functionality" in a separate file. There you go, you've avoided OO and have just taken a trip back in time to PHP3. The PHP projects you mention have code bases stretching back several years and are seeking to support the maximum number of configurations, therefore, they may use anachronisms which are no longer accepted as optimal. PHP has gone OO because, in what I imagine to be most developers opinions, objects as containers for reusable sections of code is easier to maintain than the method I described above. Zend_Registry provides a common interface for global variables WITHOUT messing up the global name space. If $GLOBALS did just that, without the side effect of depositing variables in the global name space, I wouldn't disagree with you. - jake
Re: [fw-general] Zend Framework and Port based virtual host
Depends on what communications protocol Dow Jones implements, you can try using the "php://input" file I/O stream to access raw POST information for your script, see: http://us.php.net/wrappers.php - jake On Tue, Apr 22, 2008 at 9:15 AM, Bill YILDIRIM <[EMAIL PROTECTED]> wrote: > Thanks for the quick reply Jake, > > One think I forgot to mention, I will be receiving some data through this > port (Dow Jones News Wire) in XML format. Is it still possible? > > > > Jake McGraw wrote: > > > I believe you'll want to use Apache Virtual Hosts for this, as that is > > what you would use to process SSL requests on port 443, so putting > > something similar, with a different port should work: > > > > > > ServerName my.domain.com > > RedirectPermanent / http://my.domain.com/services/dj > > > > > > Two caveats: Be sure your port choice doesn't conflict with another > > service and that the port is open to accept incoming transmissions. > > > > - jake > > > > > > On Tue, Apr 22, 2008 at 8:17 AM, billyildirim <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > I have an application running on standard port 80. Is it possible to > > > redirect a port (let's say 2) to the same applicaton but different > > > controller? let's say i want to redirect > > > http://my.domain.com:2 to http://my.domain.com/services/dj > (services is > > > not a controller, it is a module) > > > > > > thanks > > > Bill > > > -- > > > View this message in context: > http://www.nabble.com/Zend-Framework-and-Port-based-virtual-host-tp16823831p16823831.html > > > Sent from the Zend Framework mailing list archive at Nabble.com. > > > > > > > > > > > > > > > >
Re: [fw-general] Zend Framework and Port based virtual host
I believe you'll want to use Apache Virtual Hosts for this, as that is what you would use to process SSL requests on port 443, so putting something similar, with a different port should work: ServerName my.domain.com RedirectPermanent / http://my.domain.com/services/dj Two caveats: Be sure your port choice doesn't conflict with another service and that the port is open to accept incoming transmissions. - jake On Tue, Apr 22, 2008 at 8:17 AM, billyildirim <[EMAIL PROTECTED]> wrote: > > Hi, > I have an application running on standard port 80. Is it possible to > redirect a port (let's say 2) to the same applicaton but different > controller? let's say i want to redirect > http://my.domain.com:2 to http://my.domain.com/services/dj (services is > not a controller, it is a module) > > thanks > Bill > -- > View this message in context: > http://www.nabble.com/Zend-Framework-and-Port-based-virtual-host-tp16823831p16823831.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >
[fw-general] Comment on ZF-2978: Zend_XmlRpc_Client returning system.methodSignature
Matthew, anyone watching this issue: The provided solution: class My_XmlRpc_Client extends Zend_XmlRpc_Client { public function call($method, $params = array()) { $request = new Zend_XmlRpc_Request($method, $params); $this->doRequest($request); if ($this->_lastResponse->isFault()) { $fault = $this->_lastResponse->getFault(); throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode()); } return $this->_lastResponse->getReturnValue(); } } Doesn't work because $_lastRequest is **private** in Zend_XmlRpc_Client, Line 91: private $_lastRequest = null; Here is a solution that works in the meantime (until 1.5.2?): class My_XmlRpc_Client extends Zend_XmlRpc_Client { public function call($method, $params = array()) { $request = new Zend_XmlRpc_Request($method, $params); $this->doRequest($request); if ($this->getLastResponse()->isFault()) { $fault = $this->getLastResponse()->getFault(); throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode()); } return $this->getLastResponse()->getReturnValue(); } } I would have posted this on the tracker, but I didn't see a comment field (even though I am registered to use the service). - jake
Re: [fw-general] Google App Engine
Technically, support for Zend Framework isn't required, they only need to support PHP to get it working. I sat through the demo, looks promising as an alternative to Amazon storage services. - jake On Tue, Apr 8, 2008 at 10:47 AM, Bradley Holt <[EMAIL PROTECTED]> wrote: > Has anyone else heard about the new Google App Engine? It currently only > supports Python and the Django web application framework but they say, > "other programming languages and runtime environment configurations are > being considered for future releases." Would anyone else use this if Google > added support for PHP and Zend Framework? If so, is there anyone who has a > contact within Google who can suggest this idea? > > -- > Bradley Holt > [EMAIL PROTECTED] > >
Re: [fw-general] FlashMessenger API Documentation?
Thanks, I eventually figured it out, now I have another question about FlashMessenger: Is there an equivalent Action Helper which will "deliver" a message in the same request that it was generated in? I realize this is trivial to accomplish using an array data member within a controller and then assigned to the view. I'd just like to know if there is a common way of doing this. - jake On Mon, Mar 24, 2008 at 10:20 AM, Eric Marden <[EMAIL PROTECTED]> wrote: > > From: Jake McGraw > > > For the life of me, I can't find the FlashMessenger documentation in > the API browser: > > Hi Jake, > > Look under Zend_Controller > Zend_Controller_Action > Classes > > Zend_Controller_Action_Helper_FlashMessenger in the API Docs > > > > -- > Eric Marden > Sr. PHP Developer > > > >
[fw-general] Re: FlashMessenger API Documentation?
Nevermind, turns out to be a Controller_Helper http://framework.zend.com/apidoc/core/Zend_Controller/Zend_Controller_Action/Zend_Controller_Action_Helper_FlashMessenger.html - jake On Fri, Mar 21, 2008 at 3:15 PM, Jake McGraw <[EMAIL PROTECTED]> wrote: > For the life of me, I can't find the FlashMessenger documentation in > the API browser: > > http://framework.zend.com/apidoc/core/classtrees_Zend_View.html > > If it isn't there, where should it be? > > - jake >
[fw-general] FlashMessenger API Documentation?
For the life of me, I can't find the FlashMessenger documentation in the API browser: http://framework.zend.com/apidoc/core/classtrees_Zend_View.html If it isn't there, where should it be? - jake
Re: [fw-general] Zend Framework 1.5 has landed!
Thanks! On Mon, Mar 17, 2008 at 12:35 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > -- Jake McGraw <[EMAIL PROTECTED]> wrote > (on Monday, 17 March 2008, 12:13 PM -0400): > > > http://framework.zend.com/manual/en/zend.gdata.youtube.html > > > > Shows up as Japanese for me :(. > > Minor caching configuration issue -- fixed now. :-) > > > > > > On Mon, Mar 17, 2008 at 11:57 AM, Tobias Gies <[EMAIL PROTECTED]> wrote: > > > Hey Matthew, > > > > > > > > > > Actually... that "language switch" is part of the search form. There's > > > > another box below the list of components that allows you to browse the > > > > manual by language (uses static links). > > > A-ha! I'd have expected this box to be above the components box. The > > > implementation is flawed for me, however; every link in this box indeed > > > points to a link like /manual/de/index.html (, /manual/ru/index.html, > > > etc...), however the index (or any other requested page) itself is in > > > English, and it links to sites like /manual/en/zend.magic.html. > > > > > > Best regards, > > > Tobias > > > > > > > > > > > > > > > > -Ursprüngliche Nachricht- > > > > Von: Wil Sinclair [mailto:[EMAIL PROTECTED] > > > > Gesendet: Montag, 17. März 2008 14:51 > > > > An: fw-general@lists.zend.com > > > > Betreff: [fw-general] Zend Framework 1.5 has landed! > > > > > > > > Well, folks, we made it. Zend Framework 1.5 GA is now released and > > > > available at the framework site: > > > > > > > > http://framework.zend.com/download > > > > > > > > And just to remind you once again of all the new features in 1.5: > > > > > > > > * New Zend_Form component with support for AJAX-enabled form elements > > > > * New action and view helpers for automating and facilitating AJAX > > > > requests and alternate response formats > > > > * Infocard, OpenID, and LDAP authentication adapters > > > > * Support for complex Lucene searches, including fuzzy, date-range, > and > > > > wildcard queries > > > > * Support for Lucene 2.1 index file format > > > > * Partial, Placeholder, Action, and Header view helpers for advanced > > > > view composition and rendering > > > > * New Zend_Layout component for automating and facilitating site > layouts > > > > * UTF-8 support for PDF documents > > > > * New Nirvanix, Technorati, and SlideShare web services > > > > > > > > There are a lot of people to thank, since there are a lot of people > who > > > > worked hard to make this happen. First of all, thanks to all the Zend > > > > Framework contributors who helped in all kinds of ways to make this a > > > > truly great, high-quality release. I would personally like to thank > the > > > > Zend Framework team here at Zend for working the long hours this > weekend > > > > to make sure everything came together on Monday morning. There were > also > > > > some very selfless souls in marketing who stayed up late over the last > > > > few days to make sure the site was at its best in both style and > > > > substance for the big day. Finally we'd like to thank all the ZF users > > > > out there who inspire us to continue improving Zend Framework and who > > > > never fail to keep us on our toes. :) We hope this release not only > > > > lives up to your high expectations but goes beyond them. > > > > > > > > Now we can finally say that we wholeheartedly recommend the 1.5 > release > > > > for production use. > > > > > > > > Enjoy ZF 1.5! > > > > > > > > ,Wil > > > > > > > > > > -- > > > Matthew Weier O'Phinney > > > PHP Developer| [EMAIL PROTECTED] > > > Zend - The PHP Company | http://www.zend.com/ > > > > > > > > > > -- > > > Matthew Weier O'Phinney > PHP Developer| [EMAIL PROTECTED] > Zend - The PHP Company | http://www.zend.com/ >
Re: [fw-general] Zend Framework 1.5 has landed!
http://framework.zend.com/manual/en/zend.gdata.youtube.html Shows up as Japanese for me :(. - jake On Mon, Mar 17, 2008 at 11:57 AM, Tobias Gies <[EMAIL PROTECTED]> wrote: > Hey Matthew, > > > > Actually... that "language switch" is part of the search form. There's > > another box below the list of components that allows you to browse the > > manual by language (uses static links). > A-ha! I'd have expected this box to be above the components box. The > implementation is flawed for me, however; every link in this box indeed > points to a link like /manual/de/index.html (, /manual/ru/index.html, > etc...), however the index (or any other requested page) itself is in > English, and it links to sites like /manual/en/zend.magic.html. > > Best regards, > Tobias > > > > > > -Ursprüngliche Nachricht- > > Von: Wil Sinclair [mailto:[EMAIL PROTECTED] > > Gesendet: Montag, 17. März 2008 14:51 > > An: fw-general@lists.zend.com > > Betreff: [fw-general] Zend Framework 1.5 has landed! > > > > Well, folks, we made it. Zend Framework 1.5 GA is now released and > > available at the framework site: > > > > http://framework.zend.com/download > > > > And just to remind you once again of all the new features in 1.5: > > > > * New Zend_Form component with support for AJAX-enabled form elements > > * New action and view helpers for automating and facilitating AJAX > > requests and alternate response formats > > * Infocard, OpenID, and LDAP authentication adapters > > * Support for complex Lucene searches, including fuzzy, date-range, and > > wildcard queries > > * Support for Lucene 2.1 index file format > > * Partial, Placeholder, Action, and Header view helpers for advanced > > view composition and rendering > > * New Zend_Layout component for automating and facilitating site layouts > > * UTF-8 support for PDF documents > > * New Nirvanix, Technorati, and SlideShare web services > > > > There are a lot of people to thank, since there are a lot of people who > > worked hard to make this happen. First of all, thanks to all the Zend > > Framework contributors who helped in all kinds of ways to make this a > > truly great, high-quality release. I would personally like to thank the > > Zend Framework team here at Zend for working the long hours this weekend > > to make sure everything came together on Monday morning. There were also > > some very selfless souls in marketing who stayed up late over the last > > few days to make sure the site was at its best in both style and > > substance for the big day. Finally we'd like to thank all the ZF users > > out there who inspire us to continue improving Zend Framework and who > > never fail to keep us on our toes. :) We hope this release not only > > lives up to your high expectations but goes beyond them. > > > > Now we can finally say that we wholeheartedly recommend the 1.5 release > > for production use. > > > > Enjoy ZF 1.5! > > > > ,Wil > > > > -- > Matthew Weier O'Phinney > PHP Developer| [EMAIL PROTECTED] > Zend - The PHP Company | http://www.zend.com/ > >
Re: [fw-general] Zend Framework 1.5 has landed!
woohoo, site search! Much appreciated. - jake On Mon, Mar 17, 2008 at 9:58 AM, Alan Wagstaff <[EMAIL PROTECTED]> wrote: > Thanks to Wil and everyone involved in the Zend Framework project - > downloading it as we speak :-) > > Love the new site as well, looks very "Web 2.0" :-) > > Just one thing though, the Quick Start link from the ZF site homepage > gives an action not found error :-( > > Keep up the good work all! > > Alan > > > > On 17/03/2008, Wil Sinclair <[EMAIL PROTECTED]> wrote: > > Well, folks, we made it. Zend Framework 1.5 GA is now released and > > available at the framework site: > > > > http://framework.zend.com/download > > > > And just to remind you once again of all the new features in 1.5: > > > > * New Zend_Form component with support for AJAX-enabled form elements > > * New action and view helpers for automating and facilitating AJAX > > requests and alternate response formats > > * Infocard, OpenID, and LDAP authentication adapters > > * Support for complex Lucene searches, including fuzzy, date-range, and > > wildcard queries > > * Support for Lucene 2.1 index file format > > * Partial, Placeholder, Action, and Header view helpers for advanced > > view composition and rendering > > * New Zend_Layout component for automating and facilitating site layouts > > * UTF-8 support for PDF documents > > * New Nirvanix, Technorati, and SlideShare web services > > > > There are a lot of people to thank, since there are a lot of people who > > worked hard to make this happen. First of all, thanks to all the Zend > > Framework contributors who helped in all kinds of ways to make this a > > truly great, high-quality release. I would personally like to thank the > > Zend Framework team here at Zend for working the long hours this weekend > > to make sure everything came together on Monday morning. There were also > > some very selfless souls in marketing who stayed up late over the last > > few days to make sure the site was at its best in both style and > > substance for the big day. Finally we'd like to thank all the ZF users > > out there who inspire us to continue improving Zend Framework and who > > never fail to keep us on our toes. :) We hope this release not only > > lives up to your high expectations but goes beyond them. > > > > Now we can finally say that we wholeheartedly recommend the 1.5 release > > for production use. > > > > Enjoy ZF 1.5! > > > > ,Wil > > >