Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Johannes Schlüter:
More on references
Feb 23, 2016 @ 16:48:31

Johannes Schlüter has continued his series of posts with this second part looking more at reference handling in PHP (how they're handled "behind the scenes" that is).

In a few different places I saw comments about my last blog post about references and performance where commentators noted that my example was pointless. Which of course is true and to some degree the point.

I read a lot of PHP code and from time to time I see people with a non-PHP background (or otherwise influenced) putting references everywhere they pass arrays or such in order to prevent copies. I knew this was a bad practice in PHP 5 and wanted to verify this in PHP 7.

In the post he talks about passing references to methods and how it can lead to less clarity in the resulting code. He also wonders about the situation when you don't actually want to modify the variable passed in and making copies (losing any performance gain). He suggests that using references should only come when you know exactly how the value will be used in the method, not casually or just for performance reasons.

tagged: references php5 clear code php7 copy

Link: http://schlueters.de/blog/archives/181-More-on-references.html

Symfony Blog:
All symfony 1.x versions available on Github
Oct 26, 2011 @ 14:15:15

Fabien Potencier has made an announcement on the Symfony Blog today about all the availability of previous Symfony versions on github.

symfony1 is well and alive and many developers are now using it for projects hosted on Git. But as the official symfony 1 repository is hosted on Subversion, it's not always easy to get things versioned easily. As of today, this becomes much more easier. If you are using Git and symfony1, you can now use the official symfony1 Git clone.

There are branches for each of the major 1.x releases as well as tags for some of the minor releases. You can, of course, still access the latest packages directly via the symfony website.

tagged: symfony version1 github clone svn copy

Link:

NETTUTS.com:
Magento 1.3: PHP Developer’s Guide – Free Copies
Apr 20, 2010 @ 15:28:26

NETTUTS.com is having a give away of some free copies of the Packt book "Magento 1.3: PHP Developer's Guide" for anyone that comments on the post.

Magento is one of the most popular PHP eCommerce solutions available for web developers. In their own words, it’s the fastest growing eCommerce platform in the world. Packt Publishing has generously donated a handful of copies of their latest Magento book, called "Magento 1.3: PHP Developer's Guide".

The book goes into the depth PHP developers will need to really get into the heart of Magento and create customized modules with advanced functionality to make it just what you need.

tagged: free copy book packt magento developer contest

Link:

Sameer Borate's Blog:
Detecting duplicate code in PHP files
Apr 08, 2009 @ 16:16:17

On his blog today Sameer looks at a method for finding duplicate code in your applications with the help of PHPCPD.

Duplicated code in projects is a frequent thing and also the one ripe for factoring out in a new class or function. Cut/Paste coding is a common development practice among programmers, a lot of which can lead to code size increase and maintenance nightmares. PHPCPD (php copy paste detector) is a PEAR tool that makes it easier to detect duplicate code in php projects. Below is a short tutorial on the PHPCPD package.

You can either install the tool via a PEAR channel or directly from the github site. Once its downloaded and extracted you can immediately run it on the subdirectory of your choice. He also includes a more extended example - a search on a minimum of 5 lines of 70 tokens found to trip the filter in finding cloned functionality.

tagged: phpcpd pear channel install tutorial copy paste detector

Link:

Jaisen Mathai's Blog:
How to host the php.net manual on your laptop for offline use
Mar 12, 2009 @ 17:53:51

Jaisen Mathai has a helpful hint for those that do any offline work with PHP on their own development systems - how to mirror the PHP manual on a local web server.

In addition to [a local copy of your source] being faster to develop, it lets you work without needing to be connected to the Internet. But what about the tools you use while developing? If you’re a PHP developer then the manual at php.net is an invaluable tool. It only make sense to have it available for when you’re not online.

His example follows the official mirroring part of the PHP.net website and uses a slightly modified rsync command to fetch the manual information from the php.net site and drops it in a location locally. He throws in an Apache configuration too for a simple VirtualHost to get it up and running.

tagged: phpnet manual offline local copy rsync mirror documentation

Link:

Sara Golemon's:
You're being lied to.
Jan 29, 2007 @ 14:38:00

If you think you know what's going on behind the scenes when you're working with objects in PHP5 - you're wrong. You're even being lied to, according to Sara Golemon's latest entry:

If you're among the crowd who have migrated an OOP based application from PHP4 to PHP5, then I'm sure you've heard the expression "Objects are copied by reference by default in PHP5". Whoever told you that, was lying.

As she explains, the truth is more that they behave that way, not that they are actually like that. She talks about what objects actually are and how things are handled differently from PHP4 to PHP5. She also "lies" a little also about the "copying" part, and explains the internal structure of a variable to show why.

She also includes a bit on why referencing variables when it's not really a must is a bad idea - the main idea of it being a waste of space and memory in the application.

tagged: php5 object reference copy behave lie php5 object reference copy behave lie

Link:

Sara Golemon's:
You're being lied to.
Jan 29, 2007 @ 14:38:00

If you think you know what's going on behind the scenes when you're working with objects in PHP5 - you're wrong. You're even being lied to, according to Sara Golemon's latest entry:

If you're among the crowd who have migrated an OOP based application from PHP4 to PHP5, then I'm sure you've heard the expression "Objects are copied by reference by default in PHP5". Whoever told you that, was lying.

As she explains, the truth is more that they behave that way, not that they are actually like that. She talks about what objects actually are and how things are handled differently from PHP4 to PHP5. She also "lies" a little also about the "copying" part, and explains the internal structure of a variable to show why.

She also includes a bit on why referencing variables when it's not really a must is a bad idea - the main idea of it being a waste of space and memory in the application.

tagged: php5 object reference copy behave lie php5 object reference copy behave lie

Link:

4Null4.de:
Four new vulnerabilities in PHP found
Apr 10, 2006 @ 20:41:31

According to this new post on 4null4.de today, there are four new vulnerabilities in the most recent releases of PHP that have been found.

heise online, the popular and well-known German IT news site, conveys four new vulnerabilities in the PHP script language. PHP is often used for web applications such as WordPress and many bulletin board systems like phpBB or vBulletin. The issues can be found in PHP versions up to (and including) 4.4.2 and 5.1.2, and the current CVS snapshots for the upcoming 5.1.3 release will be first to fix the issues.

The errors are:

  • A problem with copy() that circumvents the "Safe Mode" for users who are logged in at the system.
  • A possible issue with tempname() that could ignore the "Safe Mode" setting also
  • a third leak that could lead to a web server process crashing (recusive function calls)
  • and an XSS attack issue with the standard phpinfo() page

The 4null4.de post has a summary of the issues, but the original article from heise has the complete info (as well as links to examples of the problems as documented on SecurityReason.com).

tagged: vulnerabilities four new copy tempname crash phpinfo vulnerabilities four new copy tempname crash phpinfo

Link:

4Null4.de:
Four new vulnerabilities in PHP found
Apr 10, 2006 @ 20:41:31

According to this new post on 4null4.de today, there are four new vulnerabilities in the most recent releases of PHP that have been found.

heise online, the popular and well-known German IT news site, conveys four new vulnerabilities in the PHP script language. PHP is often used for web applications such as WordPress and many bulletin board systems like phpBB or vBulletin. The issues can be found in PHP versions up to (and including) 4.4.2 and 5.1.2, and the current CVS snapshots for the upcoming 5.1.3 release will be first to fix the issues.

The errors are:

  • A problem with copy() that circumvents the "Safe Mode" for users who are logged in at the system.
  • A possible issue with tempname() that could ignore the "Safe Mode" setting also
  • a third leak that could lead to a web server process crashing (recusive function calls)
  • and an XSS attack issue with the standard phpinfo() page

The 4null4.de post has a summary of the issues, but the original article from heise has the complete info (as well as links to examples of the problems as documented on SecurityReason.com).

tagged: vulnerabilities four new copy tempname crash phpinfo vulnerabilities four new copy tempname crash phpinfo

Link:


Trending Topics: