Categories > TinyButStrong general >

Class name being corrupted

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alan Lake
Date: 2012-08-30
Time: 03:55

Class name being corrupted

I am using TBS Version  : 3.7.0 for PHP 5, PHP is version 5.3.16.

In moving my site to a new web server, I have an issue that I don't have on my local server.  On line #6 below, I have confirmed that the input to LoadTemplate is correct.  I promise that I have no classes called 5eo5730, but am mystified as to how such a class name was submitted as in line #0.  Any ideas to help with my debugging.  (I'm using UTF-8 character encoding throughout.)

<b>Fatal error</b>:  Uncaught exception 'Exception' with message 'Class 5eo5730 not found!' in /home/alake/public_html/tinyMVC/lib/autoLoad.php:26
Stack trace:
#0 [internal function]: AutoLoader::autoLoad('5eo5730')
#1 [internal function]: spl_autoload_call('5eo5730')
#2 /home/alake/public_html/tinyMVC/vendor/tbs/tbs_class.php(1098): call_user_func_array(Array, Array)
#3 /home/alake/public_html/tinyMVC/vendor/tbs/tbs_class.php(2121): clsTinyButStrong-&gt;meth_Locator_Replace('&lt;!DOCTYPE HTML ...', Object(clsTbsLocator), 'home', 1)
#4 /home/alake/public_html/tinyMVC/vendor/tbs/tbs_class.php(2447): clsTinyButStrong-&gt;meth_Merge_AutoVar('&lt;!DOCTYPE HTML ...', true, 'onload')
#5 /home/alake/public_html/tinyMVC/vendor/tbs/tbs_class.php(615): clsTinyButStrong-&gt;meth_Merge_AutoOn('&lt;!DOCTYPE HTML ...', 'onload', true, true)
#6 /home/alake/public_html/main/app/controllers/TbsView.class.php(48): clsTinyButStrong-&gt;LoadTemplate('/home/alake/pub...')
#7 /home/alake/public_html/main/app/controllers/HomeController.class.php(18): TbsView-&gt;__construct(' in <b>/home/alake/public_html/tinyMVC/lib/autoLoad.php</b> on line <b>26</b><br />
By: Alan Lake
Date: 2012-09-01
Time: 15:56

Re: Class name being corrupted

I put a couple of echos in my code:
TbsView::__construct:$frame = string(53) "/home/alake/public_html/main/app/views/main_page.html"
TbsView::__construct:LoadTemplate

The error is occurring within TBS->LoadTemplate($frame).  As main_page.html has no PHP code in it, autoload.php should not be called.  main_page.html does have css class references in it.  If LoadTemplate interprets "<div class="example_style_1"></div>" as PHP, then I can see where the error might come from.

I should be most happy to share this code with you, but I think it might need to be in context.  I will put it in a Dropbox folder if you want to see it.
By: Alan Lake
Date: 2012-09-01
Time: 17:30

Re: Class name being corrupted

The error occurs in the call_user_fuc_array instruction.  I think that your code requires PHP 5.4, whereas my web server is using PHP 5.3.: Here's a note included from the manual in call_user_func_array:
Before PHP 5.4, referenced variables in param_arr are passed to the function by reference, regardless of whether the function expects the respective parameter to be passed by reference. This form of call-time pass by reference does not emit a deprecation notice, but it is nonetheless deprecated, and has been removed in PHP 5.4. Furthermore, this does not apply to internal functions, for which the function signature is honored. Passing by value when the function expects a parameter by reference results in a warning and having call_user_func() return FALSE (there is, however, an exception for passed values with reference count = 1, such as in literals, as these can be turned into references without ill effects — but also without writes to that value having any effect —; do not rely in this behavior, though, as the reference count is an implementation detail and the soundness of this behavior is questionable).

Do you agree?
By: Alan Lake
Date: 2012-09-01
Time: 19:05

Re: Class name being corrupted

What version of PHP 5 does TinyButStrong v 3.8.1 assume is in use?  (I've updated my copy of TBS, but still have the error.)
By: Alan Lake
Date: 2012-09-02
Time: 17:03

Re: Class name being corrupted

I updated to PHP 5.4.6.  The problem has gone away.

Lesson: This malfunction in call_user_func_array can be expected with PHP 5.3.16.  Updating to PHP 5.4.6 eliminates this problem.

Case closed.