Call to undefined function ‘output_cache_disable’

This is a Zend Studio warning that has been bugging me lately.

The culprit is the file dummy.php, distributed with Zend Debugger. As per the installation instructions provided by the README file, one should “4. Copy the dummy.php file to your document root directory.” but the project I’m currently reviewing (FengOffice 1.7.3.1) has three copies of that file in three different folders. So a build in Zend Studio always gives that warning three times.

I know that in this particular case, I could simply erase all the dummy.php copies in the project, and forget the issue. And that’s exactly what I’m going to do.

But the issue is caused by a common programming idiom in PHP.

{[ .dummy | 1.hilite(=php,ln-1=) ]}

The code calls a contextual function only if it exists (@3-5). This is certainly correct, but fools up the simple Zend Studio validator.

It would be better if the code defined the expected contextual function if it didn’t exist, and called the function in any case (@3-6).

{[ .smarter_dummy | 1.hilite(=php,ln-1=) ]}

This makes Zend Studio give no more warnings.

Anyway, all in all, I think that Zend Studio could be a little smarter and don’t give warnings for function calls inside function_exists blocks.

I know that this could be quite difficult to implement, so an alternative workaround could be an option for telling Zend Studio not to show a specific warning, specific up to the file and line, i.e. up to a single issue in the problems panel.

Open a file by path on Mac OS X

I’ve been looking for a way to open a deeply nested file in Zend Studio 8 on an iMac.

Not an easy task.

The best I could do is

  1. open a Finder window and press [Shift + Command + G]
  2. in the text box enter the file path
  3. remove the file portion
  4. hit Go
  5. drag and drop the file from the Finder window to the Zend Studio window

Hide Intrusive Ads with a Bookmarklet

I was reading a page with content literally buried beneath flashy ads, and I really couldn’t concentrate.

This is my solution, very very simple.

  1. Once: Drag and drop these bookmarklets into your bookmarks
    1. jQuerify: {[.jquerify | 1.hilite(=javascript=)]}
    2. iToggle: {[.itoggle | 1.hilite(=javascript=)]}
  2. Any time: Execute jQuerify and then iToggle

It’s also quite safe, because you can get iframes back.

Anyway, consider the Kick Ass bookmarklet if you’re really upset.