_cm_post_getData [message #1096] |
Fri, 14 September 2007 12:40 |
interop
Messages: 45 Registered: October 2006
|
Member |
|
|
This may be a bug but I'm not sure so I'll put it here.
The _cm_post_getData is not getting called sometimes. I think it is only in classes which do not directly inherit from Default_table. i.e., dict_table_s02.
It appears as though getEntryPoint() may be the cause. On line 1053 of std.table.class.inc getEntryPoint() returns null and prevents the call to _cm_post_getData.
This prevents dict_table_s02 from writing my dictionary files when exporting tables to php.
Can you reproduce this problem?
version 1.28.0, php5, mysql5
|
|
|
Re: _cm_post_getData [message #1097 is a reply to message #1096] |
Fri, 14 September 2007 13:34 |
AJM
Messages: 2373 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Very strange. I have just tried this with PHP 5.2.4 and MySQL 5.0.45 on Windows XP without any problems. It also works with PHP 4.4.7 and MySQL 4.1.22
Can you step through getEntryPoint() to see where it is going wrong? It is supposed to step backwards through debug_backtrace() to find the first method used to access the current class.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: _cm_post_getData [message #1098 is a reply to message #1097] |
Fri, 14 September 2007 14:45 |
interop
Messages: 45 Registered: October 2006
|
Member |
|
|
If it matters I'm using linux OS
Here are the values I get while in getEntryPoint() during the "export table to php" procedure
$classname = 'dict_table_s02'
$parentclass = 'dict_table'
$array[0]['file'] = '...std.table.class.inc'
$array[0]['function'] = 'getEntryPoint'
$array[0]['class'] is not set
$array[0]['type'] is not set
$array[1]['file'] = '...std.update4.inc'
$array[1]['function'] = 'getData'
$array[1]['class'] = 'Default_Table'
$array[1]['type'] = '->'
$array[2]['file'] = '...table_export.php'
$array[2]['function'] = 'require_once'
$array[2]['class'] is not set
$array[2]['type'] is not set
'type' is only set for $array[1] so this is the only entry that gets checked and $array[1]['class'] doesn't match $classname or $parentclass so $method never gets set.
I verified that I did upgrade include.general.inc to version 1.28.0 but here's getEntryPoint() in case:
function getEntryPoint ($object)
// get the name of the first method that was used to access the specified object.
{
if (is_object($object)) {
// get class name for the current object
$classname = get_class($object);
$parentclass = get_parent_class($object);
} else {
// assume input is a string
$classname = $object;
$parentclass = '';
} // if
$method = null; // initialise
$array = debug_backtrace(); // get trace data
// start at the end of the array and move backwards
for ($i = count($array)-1; $i >= 0; $i--) {
// is this entry for a method call?
if (isset($array[$i]['type'])) {
if ($array[$i]['class'] == $classname) {
$method = $array[$i]['function'];
break;
} // if
if ($array[$i]['class'] == $parentclass) {
$method = $array[$i]['function'];
break;
} // if
if (isset($array[$i]['object'])) {
if (is_a($array[$i]['object'], $classname)) {
$method = $array[$i]['function'];
break;
} // if
if (is_a($array[$i]['object'], $parentclass)) {
$method = $array[$i]['function'];
break;
} // if
} // if
// if ($array[$i]['class'] != 'Default_Table') {
// if (is_subclass_of($object, $array[$i]['class'])) {
// $method = $array[$i]['function'];
// break;
// } // if
// } // if
} // if
} // for
return $method;
} // getEntryPoint
[Updated on: Fri, 14 September 2007 14:59] Report message to a moderator
|
|
|
Re: _cm_post_getData [message #1099 is a reply to message #1098] |
Fri, 14 September 2007 16:26 |
AJM
Messages: 2373 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The problem lies in the line
$array[1]['class'] = 'Default_Table'
This should be reporting 'dict_table_s02' instead, which is the name of the current class.
'dict_table_s02' extends 'dict_table' which extends 'Default_Table'.
It is 'dict_table_s02' which is being accessed from 'std.update4.inc', so neither 'dict_table' nor 'Default_Table' should appear in this array at all.
Which version of PHP are you running? Are you using Zend Accelerator?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: _cm_post_getData [message #1100 is a reply to message #1099] |
Fri, 14 September 2007 16:56 |
AJM
Messages: 2373 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If you are running PHP5 can you do 'print_r($array)' just after the call to debug_backtrace. There should be an entry which reads
[object] => dict_table_s02 Object
This should then be detected with the lines
if (is_a($array[$i]['object'], $classname)) {
$method = $array[$i]['function'];
break;
} // if
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|