#1
  1. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,534
    Rep Power
    595

    # within a comment produces deprecated error


    Why would the following code:
    PHP Code:
    <?php
    /*------------------------------------------------------------------------
    # mod_susnet_likebox
    # ------------------------------------------------------------------------
    # author Susnet
    # copyright Copyright (C) 2012 http://www.susnet.co.uk. All Rights Reserved.
    # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
    # Websites: http://www.susnet.co.uk/
    # Technical Support: http://www.susnet.co.uk/extensions/item/susnet-like-box-joomla-module.html
    -------------------------------------------------------------------------*/
    // no direct access
    defined'_JEXEC' ) or die( 'Restricted access' );

    // Include the syndicate functions only once
    require_once dirname(__FILE__).'/helper.php';

    $document = &JFactory::getDocument();
    $document->addStyleSheetJURI::base() . 'modules/mod_susnet_likebox/css/style.css' );


    require 
    JModuleHelper::getLayoutPath('mod_susnet_likebox'$params->get('layout''default'));
    Produce the following error:

    Comments starting with '#' are deprecated in ...

    It appears that # cannot be used within /* ... */ which makes no sense. TIA.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,179
    Rep Power
    9398
    Odd. What version of PHP? My 5.3.26 doesn't seem to do that.
  4. #3
  5. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    And the full error message relates to a PHP file and not an ini file?

    If my research is correct, as of PHP 5.4 the # in php.ini files are deprecated in favour of ;

    EDIT

    The only problems I see reported are relating to PHP CLI on ubuntu OSs
    Last edited by Northie; July 25th, 2013 at 04:08 AM.
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,534
    Rep Power
    595
    Thanks for the replies. I am using PHP version 5.3.3 with Joomla and OpenCart/JooCart. The location of the actual error is partially a guess. The full text of the error message really makes no sense.
    Code:
    <b>Unknown</b>: Comments starting with '#' are deprecated in Unknown on line 4 in <b>/var/www/html/libraries/joomla/language/language.php</b> on line <b>818</b>
    Line 818 is:
    PHP Code:
    $strings=parse_ini_string($contents); 
    When I surround this statement with some debug the result implies parse_ini_string is trying to execute the string or something.
    PHP Code:
    echo "before parse_ini_string\n";
    echo 
    "$contents\n";
                    
    $strings = @parse_ini_string($contents);
    echo 
    "after parse_ini_string\n"
    Code:
    before parse_ini_string
    
    <?php
    /*------------------------------------------------------------------------
    # mod_susnet_likebox 
    # ------------------------------------------------------------------------
    # author Susnet
    # copyright Copyright (C) 2012 http://www.susnet.co.uk. All Rights Reserved.
    # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
    # Websites: http://www.susnet.co.uk/
    # Technical Support:  http://www.susnet.co.uk/extensions/item/susnet-like-box-joomla-module.html
    -------------------------------------------------------------------------*/
    
    
    MOD_LIKEBOX="Susnet Like Box"
    MOD_LIKEBOX_XML_DESCRIPTION="<p><strong>Susnet Facebook Likebox</strong></p><p>Enter your full Facebook Page URL, for example:</p><p>http://www.facebook.com/platform</p><p>or</p><p>http://www.facebook.com/19292868552</p><p>For more information please visit <a href="http://www.susnet.co.uk/" title="Susnet Joomla Extensions">Susnet</a>."
    
    after parse_ini_string
    Note that the error disappears when the debug is added (how many times has that happened to every programmer) but the resulting page symptom is the same.
    Last edited by gw1500se; July 25th, 2013 at 07:21 AM.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    So, this is obviously a syntax issue with the ini files format data you are using, not php comment syntax - understand the difference!

    the parse_ini_string function is taking the $content variable

    in the $content variable there will be a # comment. This is now deprecated and should be a ;

    So where is the data for $content coming from? This is where your error lies

    ini files (like php.ini) are an incredibly fast way to parse structured data from a text file into php as PHP has been optimised to read .ini files (esp php.ini).

    These are plain text files that match variable/value pairs (tuples).

    The # symbol has been allowed as an inline comment in the past, although the default inline comment character is ;

    eg, if your string looks like this

    Code:
    #settings for module
    setting1=value1
    foo=bar
    enable=0
    #unused=yes

    you will need to change it to

    Code:
    ;settings for module
    setting1=value1
    foo=bar
    enable=0
    ;unused=yes
    note - this is not php syntax but ini file syntax

    Comments on this post

    • ManiacDan agrees
    Last edited by Northie; July 25th, 2013 at 07:54 AM.
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,534
    Rep Power
    595
    So it has nothing to do with the posted Susenet code. Why does the error go away when I add the debug? Worse yet, there are hundreds of ini files and I have no idea which to look at.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  12. #7
  13. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    So, this is obviously a syntax issue with the ini files format data you are using, not php comment syntax - understand the difference!
    I really don't think that the fact that this is a syntax error with the ini file and not with the PHP code is obvious. Nothing in the error message actually indicates the problem is in the ini file and the error message is incredibly ambiguous and incomplete; the only reason I know it's a problem with the ini file is because I've seen the error message before in a better context. I also see nothing indicating that gw1500se is confused about the difference; for some reason it looks like this module is trying to parse PHP code as an ini file.

    Worse yet, there are hundreds of ini files and I have no idea which to look at.
    Something is screwy with the module if it's trying to parse PHP code as an ini file. You'll probably want to trace backwards in the code and figure out where $contents is being loaded and why it's loading a PHP file instead of an ini file.

    Comments on this post

    • Northie agrees
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,534
    Rep Power
    595
    I was able for echo the file name it was reading that contained the bogus comments. It was indeed an ini file but for some reason contained the <?php tag and the incorrect comment syntax. Fixing that eliminated the errors. Thanks for pointing me in the right direction.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  16. #9
  17. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    Originally Posted by E-Oreo
    I really don't think that the fact that this is a syntax error with the ini file and not with the PHP code is obvious.
    I meant "is now obvious" as I had shown the error to be based on ini file syntax and then the line number of the error shows the function parse_ini_file.

    Sorry for any patronising tone
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

IMN logo majestic logo threadwatch logo seochat tools logo