30
Copyright © 2007, Zend Technologies Inc. PHP Development Tools 2.0 – Success Story. Michael Spector, Zend Technologies

PHP Development Tools 2.0 - Success Story

Embed Size (px)

DESCRIPTION

PHP Development Tools 2.0 for users and adopters.

Citation preview

Page 1: PHP Development Tools 2.0 - Success Story

Copyright © 2007, Zend Technologies Inc.

PHP Development Tools 2.0 – Success Story.Michael Spector,

Zend Technologies

Page 2: PHP Development Tools 2.0 - Success Story

Project History |

Apr 8, 2023| 2

Overview

• PDT 1.0 history• PDT NG goals• Dynamic languages toolkit (DLTK)• PDT 2.0 features• Extending PDT example• Q&A

Page 3: PHP Development Tools 2.0 - Success Story

Project History |

Apr 8, 2023| 3

Project history

• Project creation review in March 2006.• First release in September 2007.• Initial contribution by IBM and Zend.

Page 4: PHP Development Tools 2.0 - Success Story

Project History |

Apr 8, 2023| 4

PDT 1.0 requirements

• Providing developers with PHP capabilities: Source editing:

• Code Assist• Syntax coloring• Code folding• Open Declaration (CTRL + click)• Annotations (task, breakpoints, CVS)

Code Inspection & Navigation:• PHP Explorer View• Outline View• Open PHP Element

Debugging:• Local script debugging.• Remote application debugging.

Page 5: PHP Development Tools 2.0 - Success Story

Project History |

Apr 8, 2023| 5

PDT 1.0 : initial design

WST Source Editing

PHP Source EditingPHP Model

PHP Explorer Project Outline Outline

PHPDebugger

Page 6: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 6

PDT next generation: goals

• Performance & scalability improvements. Model memory management improvement. Model change notifications narrowing.

• Create type binding infrastructure that can be reused for: Better code assist. Static analysis tool. Refactoring.

• Ability to separate resources from code.• More JDT-like features.

Page 7: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 7

Best practices: JDT

JDT

JDT Clones

JSDTRDT DLTKCDT…

DLTK Extenders

DLTKTCL

DLTKRuby

PDTDLTK

JavaScript …

Page 8: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 8

What does DLTK provide?

Core

Indexer

Build Path

Problems Reporting

Type Inference

Type Hierarchy

Validation

Search Engine

UI

Script Explorer

Outline

Type Hierarchy

Call Hierarchy

Open Element

Editor

Actions

Extra

Mylyn

RSE

Debug

Interpreters

DBGP

Debug UI

Page 9: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 9

New design

PHPDebugger

WST Source Editing

PHP Source Editing

DLTK Core

PHP Enabler

DLTK UI

PHP Enabler

Page 10: PHP Development Tools 2.0 - Success Story

Copyright © 2007, Zend Technologies Inc.

PHP Development Tools 2.0 Features

Page 11: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 11

Lighter & Faster

• Utilizing proven DLTK (JDT) indexing mechanism. No more loading model into memory on startup. Granulated search mechanism.

• Optimized memory management. Limited memory usage by most recently used elements and

AST.

Page 12: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 12

Build Path configuration

• Ability to separate application code from resources.

Page 13: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 13

Mark occurrences

• Highlight all occurrences of the selected element:

• Highlight all method exit points:

And more…

Page 14: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 14

Override annotations

• Triangle annotation indicates overridden or implemented method:

Page 15: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 15

Type Hierarchy

• Makes easier understanding the hierarchy of class or interface.

Page 16: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 16

Smart Code Assist

• Sophisticated code assist proposals using type inference.

Page 17: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 17

PHP 5.3 support (PDT 2.1)

• Choose PHP 5.3 version when creating a project:

• Code Assist:

• PHP Explorer & Outline:

Page 18: PHP Development Tools 2.0 - Success Story

Copyright © 2007, Zend Technologies Inc.

Extending PHP Development Tools 2.0

Page 19: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 19

XSS in PHP #1

• What’s wrong with the following code?

• Calling this script normally:

Page 20: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 20

XSS in PHP #2

• What happens if the following URL is used?

• Solution:

Page 21: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 21

XSS protection plug-in example

• Warn PHP developer when script parameters are accessed in a non-“safe” way.

• Input is considered “safe” when it’s passed through htmlentities() PHP function.

Page 22: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 22

XSS protection plug-in example (step 1)

• Step #1: Create new plug-in• Step #2: Add build participant extension:

Page 23: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 23

XSS protection plug-in example (step 2)

• Build participant factory

• Implement build participant

Page 24: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 24

AST search algorithm

ModuleDeclaration

PHPCall

Expression

ArrayVariable

Reference

(htmlentities())

($_GET[“name”])

(PHP script root node)

………

1. Process PHP script AST.

2. When function call node is met, and it’s a htmlentities() call – remember this node.

3. When special array variable is met – verify that the parent was htmlentities() function call.

Page 25: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 25

XSS protection plug-in example (step 3)

• Determine the function call name:

Page 26: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 26

XSS protection plug-in example

• “Catch” unsafe references:

Page 27: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 27

XSS protection plug-in example (hooray!)

• Final result:

Page 28: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 28

PDT Adopters

Zend Studio for Eclipse

IBM REST Development Framework

Aspect PHP Development Tools

Smarty Support for PDT

http://www.zend.com/en/products/studio/

http://www.projectzero.org/

http://code.google.com/p/apdt/

http://code.google.com/p/smartypdt/

Page 29: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 29

Additional Resources

• PDT site: http://www.eclipse.org/pdt

• PDT download: http://download.eclipse.org/tools/pdt/downloads

• Extending PDT examples: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.pdt/examples/?root=Tools

_Project

• PDT bundle with local debugger: http://www.zend.com/en/community/pdt

• PHP stack download: http://www.zend.com/en/community/zend-server-ce

Page 30: PHP Development Tools 2.0 - Success Story

Name of this section |

Apr 8, 2023| 30

Thank You