Re: [Phplib-users] PHP Notice: oohforms
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@dr...> - 2004-11-04 23:33:56
|
[It appears either my mail client or SourceForge's list prog are doing
something strange with the encoding - sorry about an random "=3D20" showing=
up
throughout.]
> Thanks for prompt response, there seem to be a few more problems
> here. Each page access generates so *many* notices its hard to know
> I've got them all until they are fixed. I figured one out by myself:
>=20
> # diff oohforms.inc-save oohforms.inc
> 272c272
> < if ($el->hidden) {
> ---
> > if (isset($el->hidden)) {
Actually, there are more problems with hidden - the code can't decide if it
is a scalar or an array. I would use the following patch:
84c84
< var $hidden=3D1;
---
> var $hidden=3Darray();
208c208
< if ($this->hidden) {
---
> if (is_array($this->hidden) and !empty($this->hidden)) {
272c272
< if ($el->hidden) {
---
> if (is_array($el->hidden)) {
> But I don't know what to do with these:
>=20
> PHP Notice: Undefined index: frozen - line 308
308c308
< if ($this->elements[$name]["frozen"]) {
---
> if (!empty($this->elements[$name]["frozen"])) {
> PHP Notice: Undefined index: ndx_array - line 230
230c230
< $str .=3D $el->self_get_js($elrec["ndx_array"]);
---
> $str .=3D $el->self_get_js((!empty($elrec["ndx_array"])) ?
$elrec["ndx_array"] : array());
> PHP Notice: Undefined property: method - line 345
The marshal_dispatch function does not use the first argument passed to it.
Since I don't know how this might be used in other people's code, I have
simply set the first argument to an empty string rather than change the
function declaration.
345c345
< if ($res =3D $el->marshal_dispatch($this->method, "self_validate"))=
{
---
> if ($res =3D $el->marshal_dispatch("", "self_validate")) {
369c369
< $el->marshal_dispatch($this->method, "self_load_defaults");
---
> $el->marshal_dispatch("", "self_load_defaults");
> PHP Notice: Undefined index: Kill - line 21
I can't find this in the oohforms files - this might be in your code.
My entire patch for the file so far:
RCS file: /cvsroot/phplib/php-lib-stable/php/oohforms.inc,v
retrieving revision 1.5
diff -r1.5 oohforms.inc
71c71
< if ($cv_tab[$k]=3D=3D"ignore") {
---
> if (!empty($cv_tab[$k]) and ("ignore"=3D=3D$cv_tab[$k])) {
74c74
< $k =3D ($cv_tab[$k] ? $cv_tab[$k] : $k);
---
> $k =3D ((!empty($cv_tab[$k])) ? $cv_tab[$k] : $k);
84c84
< var $hidden=3D1;
---
> var $hidden=3Darray();
208c208
< if ($this->hidden) {
---
> if (is_array($this->hidden) and !empty($this->hidden)) {
230c230
< $str .=3D $el->self_get_js($elrec["ndx_array"]);
---
> $str .=3D $el->self_get_js((!empty($elrec["ndx_array"])) ?
$elrec["ndx_array"] : array());
252c252
< if ($t =3D $cv_tab[$el["type"]]) {
---
> if (!empty($cv_tab[$el["type"]]) and $t =3D $cv_tab[$el["type"]]) {
268c268
< if ($el->isfile) {
---
> if (isset($el->isfile) and $el->isfile) {
272c272
< if ($el->hidden) {
---
> if (is_array($el->hidden)) {
308c308
< if ($this->elements[$name]["frozen"]) {
---
> if (!empty($this->elements[$name]["frozen"])) {
345c345
< if ($res =3D $el->marshal_dispatch($this->method, "self_validate"))=
{
---
> if ($res =3D $el->marshal_dispatch("", "self_validate")) {
369c369
< $el->marshal_dispatch($this->method, "self_load_defaults");
---
> $el->marshal_dispatch("", "self_load_defaults");
--=20
Layne Weathers
|