{"id":6539,"date":"2014-04-20T08:17:51","date_gmt":"2014-04-20T08:17:51","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/phpsymfony2related-issues-collection-of-common-programming-errors-2\/"},"modified":"2022-08-30T15:47:12","modified_gmt":"2022-08-30T15:47:12","slug":"phpsymfony2related-issues-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/phpsymfony2related-issues-collection-of-common-programming-errors-2\/","title":{"rendered":"php,symfony2Related issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/93014b46925f5e8ac33e144bd2eabb4e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJ0HN<br \/>\nphp<br \/>\nI am trying to use PHP to grap some information from the webpage. I have found recommendations to use htmlSQL which makes easy to get specific value from HTML. I have read all the examples coming with it, hovewer, I&#8217;ve got a very simple issue. When I execute my script, the output showsPHP Fatal error: Class &#8216;htmlsql&#8217; not found in \/home\/jeff\/htmlsql2.php on line 5I have downloaded the htmlsql.class.php document from the website and put it in the HOME. could anyone can help me fix this issue?Th<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/eadebf2bf096f4e870d18b7c400ea58e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nskripted<br \/>\nphp symfony2 composer-php<br \/>\nI&#8217;m getting the following fatal error when trying to update my vendors with composer.phar:$ php bin\/composer.phar update Loading composer repositories with package information Updating dependencies (including require-dev) Generating autoload filesFatal error: Interface &#8216;Metadata\\AdvancedMetadataFactoryInterface&#8217; not found in \/sf2path\/vendor\/jms\/metadata\/src\/Metadata\/MetadataFactory.php on line 26 PHP Fatal error: Interface &#8216;Metadata\\AdvancedMetadataFactoryInterface&#8217; not found in \/sf2path\/vendor<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/11af8601946773463c77715ca0144f30?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nCorbin<br \/>\nphp oop classes<br \/>\nI&#8217;m open to any advice to help improve this code for general use. \/** * * This code was created by Joshua Getner. * @license http:\/\/opensource.org\/licenses\/bsd-license.php BSD * * *\/namespace Blacksmith;class Autoloader {\/\/ an array that maps classnames to there filepathsprotected static $classes = array();\/*** register your classnames and class paths to the autoloader.* keeps the loading quick and accurate.* @param string $class* @param string $path* @return null*\/public static function set<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a18aef4161b4125f1232b7b4d4d626ab?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nstringCode<br \/>\nphp gmail-imap<br \/>\nRight gentelmen, I have been at this liturary the whole day by now I&#8217;m desperate ! Here is the situation. I am using free webhosting, whenever I try to use imap_open this message comes up : Fatal error: Call to undefined function imap_open(). I obiosly dont have any access to a server setting and it would appear that php does not have the imap module installed, even though I contacted my provider (web000) with a direct question: Do you support imap functions ? He replied yes. I did send him an e<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/606ecd83db7d5f8c1835e6c1e0cab10b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nViszinisA<br \/>\nphp doctrine2 symfony2<br \/>\nSymfony2. I cleared cache throu console. And now I get Fatal error: Using $this when not in object context in \/var\/www\/symfony\/vendor\/symfony\/src\/Symfony\/Bundle\/DoctrineBundle\/DoctrineBundle.php on line 52I don&#8217;t really understand how those two things are connected.Any help?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bb5230985aa2c9ea7d022d1a16890f16?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmiku<br \/>\nphp<br \/>\nWhen I attempt to use the problem class I get the following error:Fatal error: Class &#8216;database&#8217; not found in path\/problem.php on line 25I don&#8217;t understand why I got this error, at the top of problem.php I require database.php. What is happening?problem.php&lt;?php require(&#8220;common.php&#8221;); require(&#8220;database.php&#8221;);class problem {\/\/ variable declarationprotected $question;protected $answer;protected $tags;protected $problem_id;protected $commonStuff;protected $userID;protected $db;\/\/ parameters for $<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b990c8263bd35faf59663d598499d0b1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nunholysampler<br \/>\nphp xml<br \/>\nI am getting information from an XML document and for the most part everything runs as it should. Occasionally, I get a php fatal error Call to a member function children() on a non-object. I have tried to use thisif(isset($current-&gt;AttributeSets-&gt;children(&#8216;ns2&#8217;, true)-&gt;ItemAttributes-&gt;ListPrice-&gt;Amount)) {$listPrice = $current-&gt;AttributeSets-&gt;children(&#8216;ns2&#8217;, true)-&gt;ItemAttributes-&gt;ListPrice-&gt;Amount; } else {$listPrice = 0; }to catch any times there is no informatio<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d12b129bc2dc755a6b21d9fa9fb3d148?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPhil<br \/>\nphp json zend-framework wamp<br \/>\nTrying to have a look on zend2 I&#8217;m working on the zend skeleton.On the Controller, I&#8217;m adding the following code:\/\/ Decode JSON objects as PHP objects $data = $request-&gt;getPost(&#8216;album&#8217;); $result = Zend\\Json\\Json::decode($data); \/\/ line 82And I get the following error:Fatal error: Class &#8216;Album\\Controller\\Zend\\Json\\Json&#8217; not found in C:\\wamp\\www\\zf2-skeleton\\module\\Album\\src\\Album\\Controller\\AlbumController.php on line 82Having a look on the official documentation, but I don&#8217;t find anything t<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5f8dfb1530475449020d465b94031150?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJonatan<br \/>\nphp facebook facebook-graph-api<br \/>\nPHP Fatal error: Class &#8216;Facebook&#8217; not found in \/mnt\/releases\/server\/asrivastava\/first-task\/390f5294f2b74ffbbe729e1ce9773c39573973b8\/public\/subscribe.php on line 36&lt;?php try{include_once &#8220;.\/php-sdk\/src\/facebook.php&#8221;; } catch(Exception $o){echo &#8216;&lt;pre&gt;&#8217;;print_r($o);echo &#8216;&lt;\/pre&gt;&#8217;; }error_log(&#8220;Subscribe.php&#8221;); error_log(&#8220;included facebook classes&#8221;); define (&#8220;FB_APPID&#8221; ,&#8221;APPID&#8221;) ; define (&#8220;FB_SECRET&#8221;, &#8220;KEY&#8221;); define (&#8220;VERIFY_TOKEN&#8221; ,&#8221;myFirstFB&#8221;);$access_token = &#8220;MyAccessToken&#8221;; $user =<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fffc1134d980d7919816d3e5d5dc0bbd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nShades88<br \/>\nphp<br \/>\nI am getting this error: Access to undeclared static property: DBug::$errorMsgFollowing is the codeclass DBug {private static $errorMsg = array(1 =&gt; &#8216;inv-req&#8217;,2 =&gt; &#8216;inv-reqPrm&#8217;,3 =&gt; &#8216;no-set&#8217;,4 =&gt; &#8216;less-h&#8217;,5 =&gt; &#8216;less-w&#8217;);public static function showTinyErrMsg($errCode=0) {if(SHOW_ERROR_MSG_IN_RESPONSE === TRUE) {if(array_key_exists($errCode, self::$errorMsg)) {echo &#8220;\/\/ &#8220;.self::$errMsg[$errCode].&#8221;;\\n&#8221; ;}}} }I call this function by DBug::showTinyErrMsg(1);. I get the above mentioned e<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/eadebf2bf096f4e870d18b7c400ea58e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nskripted<br \/>\nphp symfony2 composer-php<br \/>\nI&#8217;m getting the following fatal error when trying to update my vendors with composer.phar:$ php bin\/composer.phar update Loading composer repositories with package information Updating dependencies (including require-dev) Generating autoload filesFatal error: Interface &#8216;Metadata\\AdvancedMetadataFactoryInterface&#8217; not found in \/sf2path\/vendor\/jms\/metadata\/src\/Metadata\/MetadataFactory.php on line 26 PHP Fatal error: Interface &#8216;Metadata\\AdvancedMetadataFactoryInterface&#8217; not found in \/sf2path\/vendor<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/606ecd83db7d5f8c1835e6c1e0cab10b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nViszinisA<br \/>\nphp doctrine2 symfony2<br \/>\nSymfony2. I cleared cache throu console. And now I get Fatal error: Using $this when not in object context in \/var\/www\/symfony\/vendor\/symfony\/src\/Symfony\/Bundle\/DoctrineBundle\/DoctrineBundle.php on line 52I don&#8217;t really understand how those two things are connected.Any help?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/333e1db8f46b789bebf0bc8cad1aee28?s=128&amp;d=identicon&amp;r=PG\" \/><br \/>\nTouki<br \/>\nsymfony2 bundle snappy<br \/>\nI have a fatal error when I try to install Knp Snappy BundleFatal error: Interface &#8216;Knp\\Bundle\\SnappyBundle\\Snappy\\GeneratorInterface&#8217; not found in \/&#8230;\/vendor\/bundles\/Knp\/Bundle\/SnappyBundle\/Snappy\/LoggableGenerator.php on line 13 Any idea?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/WxGsO.jpg?s=32&amp;g=1\" \/><br \/>\ncampagnolo_1<br \/>\nclass symfony2<br \/>\nThe project works in my local environment but when I deploy it on shared web server it doesn&#8217;t work.Server\/home\/app\/src\/gestor\/UsuarioBundle&#8230; \/vendors&#8230;.\/public_html\/webapp.php&#8230;If I go to host\/app.php -&gt;Fatal error:Class &#8216;Gestor\\UsuarioBundle\\UsuarioBundle&#8217; not found in \/home\/esdrhazc\/app\/AppKernel.php on line 19AppKernel.phpuse Symfony\\Component\\HttpKernel\\Kernel; use Symfony\\Component\\Config\\Loader\\LoaderInterface;class AppKernel extends Kernel {public function registerBundles(){$bundle<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f0def25f69a114e8f9b7e79eca23005a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrichsage<br \/>\nsymfony2<br \/>\nI&#8217;m trying to install symfony for a week now and i have plenty of errors everytime !!! i couldn&#8217;t find a solution to this specific error :Fatal error: Class &#8216;Doctrine\\Common\\Annotations\\AnnotationRegistry&#8217; not found in C:\\wamp\\www\\Symfony\\app\\autoload.php on line 35here&#8217;s what i have in the autoload.php file :$loader-&gt;register();AnnotationRegistry::registerLoader(function($class) use ($loader) { $loader-&gt;loadClass($class);return class_exists($class, false);});Any ideas please?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2dbd93a1c63c93bf5ff77c47387b3acc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKevinM1<br \/>\nsymfony2 doctrine2<br \/>\nNames changed due to NDA.I&#8217;m trying to come up with a survey form. Each survey question can have multiple answers\/scores, so there&#8217;s a natural 1:* relationship to them. That said, for the public-facing form, I need to have a 1:1 relationship between the score and the question it relates to, which is what I&#8217;m working on now. Right now, the survey is open to the public, so each completed survey is not related to a user.The interesting parts of my current setup are as follows&#8230;Question:namespac<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/MGhY2.png?s=32&amp;g=1\" \/><br \/>\nhakre<br \/>\nphp symfony2 assetic<br \/>\nwhen I dump my assets using the following commandapp\/console assetic:dump &#8211;env=dev &#8211;watchI receive this errorFatal error: Method Symfony\\Bundle\\AsseticBundle\\Factory\\Resource\\FileResource::__toString() must not throw an exception in vendor\/assetic\/src\/Assetic\/Factory\/Loader\/CachedFormulaLoader.php on line 0It doesn&#8217;t happen when dumping using app\/console assetic:dump &#8211;env=prod &#8211;no-debug<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/50e808be74d583c9e58b67586e100c40?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\navowkind<br \/>\nsymfony2 phpunit<br \/>\nusing the classical phpunit style I generate:test with the symfony2 helper. I can get the service and I can assert it ok. \/\/ testspublic function testGetServiceUrl() {$ecservice = $this-&gt;getModule(&#8216;Symfony2&#8217;)-&gt;grabServiceFromContainer(&#8220;ecservice&#8221;);$this-&gt;assertEquals(&#8220;https:\/\/ecoconnect2.niwa.co.nz\/services&#8221;, $ecservice-&gt;getServiceUrl());$this-&gt;assertEquals(&#8220;xxx&#8221;, $ecservice-&gt;getServiceUrl());}However in the second case where the assertion fails I get an exception:Trying to test get<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d77fe1e52b32256e3c5f57e6db0c7c6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMattia Premoli<br \/>\nsymfony2 doctrine2 entity classnotfound<br \/>\nThis is NewEventController.php:namespace Passtuff\\RestBundle\\Controller;use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller; use Symfony\\Component\\HttpFoundation\\Response; use Passtuff\\RestBundle\\Entity\\Event;class NewEventController extends Controller { public function createAction(){$event = new Event(); \/\/line 14\/\/&#8230;}}and this is Event.phpnamespace Passtuff\\RestBundle\\Entity;use Doctrine\\ORM\\Mapping as ORM;\/*** @ORM\\Entity* @ORM\\Table(name=&#8221;event&#8221;)*\/ class Event {\/\/&#8230; }I get this<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/331582449435f5efa35be870ab76f1a9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWouter J<br \/>\nphp symfony2 symfony-cmf<br \/>\nI&#8217;m trying to install Symfony CMF but I&#8217;m getting the following error while creating the database:Fatal error: Class &#8216;PHPCR\\Util\\Console\\Command\\MoveCommand&#8217; not foundin\/vendor\/doctrine\/phpcr-bundle\/Doctrine\/Bundle\/PHPCRBundle\/Command\/NodeMoveCommand.phpon line 34My composer.json is as follows:&#8221;require&#8221;: {&#8220;php&#8221;: &#8220;&gt;=5.3.3&#8243;,&#8221;symfony\/symfony&#8221;: &#8220;2.2.*&#8221;,&#8221;doctrine\/orm&#8221;: &#8220;2.3.*&#8221;,&#8221;doctrine\/doctrine-bundle&#8221;: &#8220;1.2.*&#8221;,&#8221;twig\/extensions&#8221;: &#8220;1.0.*&#8221;,&#8221;symfony\/assetic-bundle&#8221;: &#8220;2.1.*&#8221;,&#8221;symfony\/swiftmailer-bund<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>J0HN php I am trying to use PHP to grap some information from the webpage. I have found recommendations to use htmlSQL which makes easy to get specific value from HTML. I have read all the examples coming with it, hovewer, I&#8217;ve got a very simple issue. When I execute my script, the output showsPHP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,8],"tags":[],"class_list":["post-6539","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-zend-framework"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6539"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6539\/revisions"}],"predecessor-version":[{"id":8926,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6539\/revisions\/8926"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}