View Source


<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_View::supressNotices()
{zone-data}

{zone-data:proposer-list}
[~ralph]
{zone-data}

{zone-data:revision}
1.1 - 1 August 2006: Updated from community comments.
{zone-data}

{zone-data:overview}
The general idea is to allow developers to code an application with error_reporting(E_ALL | E_STRICT); while allowing Zend_View scripts to execute with the same error reporting MINUS E_NOTICE. The idea here is that during script execution, there is generally a lower level of strictness when it comes to using an object that may not have a pre-set property or using an array without a preset key.
{zone-data}

{zone-data:references}
* [Similar Trick in PHP Manual |http://us3.php.net/manual/en/function.error-reporting.php#64060]
{zone-data}

{zone-data:requirements}
This api addition would require a public method called supressNotices($bool) that accepts a bool on whether to include that functionality at rendertime.
{zone-data}

{zone-data:dependencies}
* Zend_View
{zone-data}

{zone-data:operation}
The component is instantiated with a mind-link that ...
{zone-data}

{zone-data:milestones}
Describe some intermediate state of this component in terms of design notes, additional material added to this page, and / code. Note any significant dependencies here, such as, "Milestone #3 can not be completed until feature Foo has been added to ZF component XYZ." Milestones will be required for acceptance of future proposals. They are not hard, and many times you will only need to think of the first three below.
* Milestone 1: [design notes will be published here|http://framework.zend.com/wiki/x/sg]
* Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
* Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists.

If a milestone is already done, begin the description with "\[DONE\]", like this:
* Milestone #: \[DONE\] Unit tests ...
{zone-data}

{zone-data:class-list}
no classes
{zone-data}

{zone-data:use-cases}

Typically, a single form might be used for both the C and the U in the CRUD mantra. Imagine using Zend_Db_Table for this CRUD application, and that for updating you have passed the row object to the form.phtml script. The current only way to suppress notices is by doing the following.

{code}

<form action="/form-admin/save/" method="POST">

Date <br />
<?= $this->formText('date', @$this->rowthing->date); ?>
<br /><br />


Topic<br />
<?= $this->formText('topic', @$this->rowthing->topic); ?>
<br /><br />

Abstract<br />
<?= $this->formTextarea('abstract', @$this->rowthing->abstract); ?>
<br /><br />

<input type="submit" value="Save" />

</form>

{code}


The problem with the above is that if Zend_Db_Table_Row decides to throw an error, that will get suppressed as well as the @ does not discriminate.

The following (similar) code would be needed at render time
{code}
$_viewPreviousErrorLevel=error_reporting();
error_reporting($_viewPreviousErrorLevel& ~E_NOTICE);
// script execution here
error_reporting($_viewPreviousErrorLevel);
{code}

{zone-data}

{zone-data:skeletons}
none
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>