Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'catchable fatal error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. I've been banging on the following error for awhile and I cannot tell what is wrong, please help: Catchable fatal error: Argument 2 passed to ShapeFactory::Create() must be an array, string given, called in /home/content/14/11625314/html/AdvPHPwOOP/factory.php on line 22 and defined in /home/content/14/11625314/html/AdvPHPwOOP/ShapeFactory.php on line 11 I'm using PHP 5.3 thru goDaddy Here's the code: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Factory</title> <link rel="stylesheet" href="style.css"> </head> <body> <?php # Script 7.4 - factory.php // This page uses the ShapeFactory class (Script 7.2). // Load the class definitions: require('ShapeFactory.php'); require('Shape.php'); require('Triangle.php'); require('Rectangle.php'); // Minimal validation: if (isset($_GET['shape'], $_GET['dimensions'])) { // Create the new object: $obj=ShapeFactory::Create($_GET['shape'],$_GET['dimensions']); // Print a little introduction: echo "<h2>Creating a {$_GET['shape']}...</h2>"; // Print the area: echo '<p>The area is ' . $obj->getArea() . '</p>'; // Print the perimeter: echo '<p>The perimeter is ' . $obj->getPerimeter() . '</p>'; } else { echo '<p class="error">Please provide a shape type and size.</p>'; } // Delete the object: unset($obj); ?> </body> </html> **************** <?php # Script 7.3 - ShapeFactory.php // This page defines a ShapeFactory class which uses the Factory pattern. /* The ShapeFactory class. * The class contains no attributes. * The class contains one method: Create(). */ abstract class ShapeFactory { // Static method that creates objects: static function Create($type, array $sizes) { // Determine the object type based upon the parameters received. switch ($type) { case 'rectangle': return new Rectangle($sizes[0], $sizes[1]); break; case 'triangle': return new Triangle($sizes[0], $sizes[1], $sizes[2]); break; } // End of switch. } // End of Create() method. } // End of ShapeFactory class.
×
×
  • Create New...