Consider these two classes. Class Accepter in
placement_class es.inc.php works as a form validation object, and it
works like a charm:
PHP:
// placement_class es.inc.php - THIS ONE WORKS!
class Accepter {
function Accepter() {
$this->dbAP =& new DBActionPerform er();
$this->dbAP->connect();
$this->validate();
$this->dbAP->disconnect() ;
$this->dbAP = null;
}
/**
* Perform validation
*
* @access private
*/
function &validate() {
// STATIC VOID METHOD
foreach ($_POST as $key => $val) if (!isset(${$key} ))
${$key} = $val;
$varErrArray = array();
array_push($var ErrArray,
'placement_name |setMandatory~s etMinLength~set MaxLe
ngth~setPattern |You must enter a location name~Your location name
must be 2 or more characters~Your location name must be 50 or fewer
characters in length~^(?!.*<[^>]+> )|Your location name configuration
is unrecognizable by our system, please re-enter with legitimate
characters|');
array_push($var ErrArray, 'unique_key|set Mandatory|You must
have a unique key prior to posting||');
/*---------------------------------------------------------------------------------------------------------------------
createErrorMsgC ollection function from
formvalidation. inc standalone function returns an array of
ErrorMsgCollect ion
objects
-----------------------------------------------------------------------------------------------------------------------*/
$this->errorMsgObjArr ay =&
createErrorMsgC ollection($varE rrArray);
// CREATE FORM OBJECT PASSING ARRAY OF OBJECTS AS
PARAMETER
$this->formValidato r =& new FormValidator(' ',
$this->errorMsgObjArr ay);
$this->isValid = $this->formValidato r->isValid();
$this->setErrorArray( $this->formValidato r->getErrorArray( ));
$this->formValidato r = null;
$this->errorMsgObjArr ay = null;
/*
if (strcmp(strtolo wer($action), 'add') == 0 ||
(strcmp(strtolo wer($action), 'edit') == 0 && $placement_name !==
$origPlacementN ame))
$this->checkDuplicate Placement($plac ement_name);
// CHECK FOR DUPLICATE PLACEMENT
*/
}
}
This is the class Accepter from contacts_classe s.inc.php and while it
is now identical in code structure to the Accepter classe in
placement_class es.inc.php, whenever this class method is invoked, all
processes stop (no errors), arrays are unfinished, objects are
unfinished, HTTP never produces, Apache goes down, literally
everything crashes!
PHP:
// contacts_classe s.inc.php - THIS ONE PRODUCES A POSSIBLE SEG
FAULT!
class Accepter {
function Accepter() {
// NEW 8/17/2004: SURROUND validate() METHOD WITH
INSTANTIATION OF $this->dbAP OBJECT PROPERTY
$this->dbAP =& new DBActionPerform er();
$this->dbAP->connect();
$this->validate();
$this->dbAP->disconnect() ;
$this->dbAP = null;
}
/**
* Main method. Will perform all other validation methods and
set isValid boolean property
*
* @access public
*/
function &validate() { //
STATIC VOID METHOD
foreach ($_POST as $key => $val) if (!isset(${$key} ))
${$key} = $val;
$varErrArray = array();
array_push($var ErrArray,
'placement_name |setMandatory~s etMinLength~set MaxLe
ngth~setPattern |You must enter a location name~Your location name
must be 2 or more characters~Your location name must be 50 or fewer
characters in length~^(?!.*<[^>]+> )|Your location name configuration
is unrecognizable by our system, please re-enter with legitimate
characters|');
array_push($var ErrArray, 'unique_key|set Mandatory|You must
have a unique key prior to posting||');
/*---------------------------------------------------------------------------------------------------------------------
createErrorMsgC ollection function from
formvalidation. inc standalone function returns an array of
ErrorMsgCollect ion
objects
-----------------------------------------------------------------------------------------------------------------------*/
$this->errorMsgObjArr ay =&
createErrorMsgC ollection($varE rrArray);
// CREATE FORM OBJECT PASSING ARRAY OF OBJECTS AS
PARAMETER
$this->formValidato r =& new FormValidator(' ',
$this->errorMsgObjArr ay);
$this->isValid = $this->formValidato r->isValid();
$this->setErrorArray( $this->formValidato r->getErrorArray( ));
$this->formValidato r = null;
$this->errorMsgObjArr ay = null;
/*
if (strcmp(strtolo wer($action), 'delete_select' ) == 0 &&
@sizeof($delete _selected) == 0) {
$this->isValid = false;
$this->setErrorArray( array('action' => 'You must select
at least one contact for deletion'));
}
*/
}
}
I've been trying to debug this for days now to no avail. I can verify
every object property is present and accounted for (and identical in
every way), but if you evoke one it's fine, the other and a segfault!
Help!
Thanx
Phil 1 1579
Take out all the references (replacing =& with =) and see what happens.
"Phil Powell" <ph************ **@gmail.com> wrote in message
news:b5******** *************** ***@posting.goo gle.com... Consider these two classes. Class Accepter in placement_class es.inc.php works as a form validation object, and it works like a charm:
PHP: // placement_class es.inc.php - THIS ONE WORKS!
class Accepter {
function Accepter() { $this->dbAP =& new DBActionPerform er(); $this->dbAP->connect(); $this->validate(); $this->dbAP->disconnect() ; $this->dbAP = null; }
/** * Perform validation * * @access private */ function &validate() { // STATIC VOID METHOD foreach ($_POST as $key => $val) if (!isset(${$key} )) ${$key} = $val; $varErrArray = array(); array_push($var ErrArray, 'placement_name |setMandatory~s etMinLength~set MaxLe ngth~setPattern |You must enter a location name~Your location name must be 2 or more characters~Your location name must be 50 or fewer characters in length~^(?!.*<[^>]+> )|Your location name configuration is unrecognizable by our system, please re-enter with legitimate characters|'); array_push($var ErrArray, 'unique_key|set Mandatory|You must have a unique key prior to posting||');
/*--------------------------------------------------------------------------
------------------------------------------- createErrorMsgC ollection function from formvalidation. inc standalone function returns an array of ErrorMsgCollect ion objects --------------------------------------------------------------
---------------------------------------------------------*/ $this->errorMsgObjArr ay =& createErrorMsgC ollection($varE rrArray);
// CREATE FORM OBJECT PASSING ARRAY OF OBJECTS AS PARAMETER $this->formValidato r =& new FormValidator(' ', $this->errorMsgObjArr ay); $this->isValid = $this->formValidato r->isValid(); $this->setErrorArray( $this->formValidato r->getErrorArray( )); $this->formValidato r = null; $this->errorMsgObjArr ay = null;
/* if (strcmp(strtolo wer($action), 'add') == 0 || (strcmp(strtolo wer($action), 'edit') == 0 && $placement_name !== $origPlacementN ame)) $this->checkDuplicate Placement($plac ement_name); // CHECK FOR DUPLICATE PLACEMENT */ }
} This is the class Accepter from contacts_classe s.inc.php and while it is now identical in code structure to the Accepter classe in placement_class es.inc.php, whenever this class method is invoked, all processes stop (no errors), arrays are unfinished, objects are unfinished, HTTP never produces, Apache goes down, literally everything crashes!
PHP: // contacts_classe s.inc.php - THIS ONE PRODUCES A POSSIBLE SEG FAULT!
class Accepter {
function Accepter() { // NEW 8/17/2004: SURROUND validate() METHOD WITH INSTANTIATION OF $this->dbAP OBJECT PROPERTY $this->dbAP =& new DBActionPerform er(); $this->dbAP->connect(); $this->validate(); $this->dbAP->disconnect() ; $this->dbAP = null; }
/** * Main method. Will perform all other validation methods and set isValid boolean property * * @access public */ function &validate() { // STATIC VOID METHOD foreach ($_POST as $key => $val) if (!isset(${$key} )) ${$key} = $val; $varErrArray = array(); array_push($var ErrArray, 'placement_name |setMandatory~s etMinLength~set MaxLe ngth~setPattern |You must enter a location name~Your location name must be 2 or more characters~Your location name must be 50 or fewer characters in length~^(?!.*<[^>]+> )|Your location name configuration is unrecognizable by our system, please re-enter with legitimate characters|'); array_push($var ErrArray, 'unique_key|set Mandatory|You must have a unique key prior to posting||');
/*--------------------------------------------------------------------------
------------------------------------------- createErrorMsgC ollection function from formvalidation. inc standalone function returns an array of ErrorMsgCollect ion objects --------------------------------------------------------------
---------------------------------------------------------*/ $this->errorMsgObjArr ay =& createErrorMsgC ollection($varE rrArray);
// CREATE FORM OBJECT PASSING ARRAY OF OBJECTS AS PARAMETER $this->formValidato r =& new FormValidator(' ', $this->errorMsgObjArr ay); $this->isValid = $this->formValidato r->isValid(); $this->setErrorArray( $this->formValidato r->getErrorArray( )); $this->formValidato r = null; $this->errorMsgObjArr ay = null;
/* if (strcmp(strtolo wer($action), 'delete_select' ) == 0 && @sizeof($delete _selected) == 0) { $this->isValid = false; $this->setErrorArray( array('action' => 'You must select at least one contact for deletion')); } */ }
} I've been trying to debug this for days now to no avail. I can verify every object property is present and accounted for (and identical in every way), but if you evoke one it's fine, the other and a segfault!
Help!
Thanx Phil This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phil Powell |
last post by:
<?
class ErrorMsgCollection {
var $name;
var $mandatory;
var $emptyErr;
var $maxLength;
var $maxLengthErr;
var $minLength;
var $minLenghtErr;
|
by: Phil Powell |
last post by:
URL: http://valsignalandet.com/cookiegrab.php?name=valIdentifier
This page produces a cookie value and sends it back as HTML using PHP
and Javascript to obtain it. This URL will be used as the value for a
URLConnection object in a Java class to obtain the results of this
page to get, of all things, a cookie value.
Simply put: it's the ONLY way I know of where I can use Java to
ultimately obtain a cookie since this is an application...
|
by: Jing You |
last post by:
hi every one,
I have got some confused problem when I try to write some custom object
by javascript.
Look at the example code here:
<BODY>
<script language="jscript">
|
by: LAvoisieR |
last post by:
Following test code behaviour suprised me and I dont know what's wrong
with this. I have two overloaded constructors within base class and
virtual destructor implemented. Derived class uses protected
non-parametrized constructor of base class which DOES NOT initialize
private member 'value'. But by calling both destructors virtually,
binary does not complaint about deleting uninitialized pointer. WHY ??
C++ compiler used: G++ 3.4.3 ...
|
by: Peter Speybrouck |
last post by:
I have a little problem with a webservice. I reproduced the problem in the
following simplified example.
I just create a new C# ASP.NET webservice and a c# console application.
I added a new class test to the namespace of the webservice which I try to
access from the console
application.
//Service1.asmx.cs
| |
by: phillip.s.powell |
last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't
ask)
I have database Spring with table Students
I have database Summer with table Students
I am tasked to produce a query of all students in both tables with no
duplicates. No clue whatsoever.
|
by: ad |
last post by:
I have a web application which refer a class library project.
The web application have a web.config and the class library project have a
app.config.
They all have connection string defined in them.
I set both connection strings identical in VS2005.
But after publish it to web site, I can just set the connection in the web
application.
|
by: comp.lang.php |
last post by:
<?
class EditResultGenerator extends MethodGeneratorForActionPerformer {
/**
* Create an instance of itself if $this does not yet exist as an
EditResultGenerator class object
*
* @access private
* @see is_class
*/
|
by: Stephen Torri |
last post by:
Below is a class that is suppose to represent a segment of memory or a
contents of a binary image (e.g. ELF executable). I have started to read
Modern C++ Design and thought the best way to ensure I was understanding
the chapter on policy classes was to attempt to apply them to my project.
I understand the general concept of policies but I lack the knowledge and
wisdom of how to identify them in an existing project. So I figured to get
an...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |