cvs: phpdoc-sk /appendices migration4.xml
| From: | Joseph Drake | Date: | Wed, 04 Sep 2002 00:14:23 +0000 |
| Subject: | cvs: phpdoc-sk /appendices migration4.xml | ||
| Groups: | php.doc.sk | ||
| Request: | Send a blank email to doc-sk+get-32@lists.php.net to get a copy of this message | ||
joseph Tue Sep 3 20:14:23 2002 EDT
Modified files:
/phpdoc-sk/appendices migration4.xml
Log:
finished translation
Index: phpdoc-sk/appendices/migration4.xml diff -u phpdoc-sk/appendices/migration4.xml:1.1 phpdoc-sk/appendices/migration4.xml:1.2 --- phpdoc-sk/appendices/migration4.xml:1.1 Sun Sep 1 18:58:04 2002 +++ phpdoc-sk/appendices/migration4.xml Tue Sep 3 20:14:23 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.24 Maintainer: joseph Status: working --> +<!-- EN-Revision: 1.24 Maintainer: joseph Status: ready --> <appendix id="migration4"> <title>Migrácia z PHP 3 do PHP 4</title> @@ -36,7 +36,7 @@ Aby ste ju aktivovali, nakonfigurujte PHP3 a PHP4 na pou¾ívanie APXS (--with-apxs) a nevyhnutné linkové roz¹írenia (--enable-versioning). Inak sa aplikujú v¹etky ¹tandardné - in¹talaèné int¹trukcie. Na príklad: + in¹talaèné in¹trukcie. Na príklad: <informalexample> <programlisting role="configure"> <![CDATA[ @@ -52,15 +52,14 @@ </section> <section id="migration4.configuration"> - <title>Migrating Configuration Files</title> + <title>Migrácia konfiguraèných súborov</title> <para> - The global configuration file, <filename>php3.ini</filename>, - has changed its name to &php.ini;. + Globálny konfiguraèný súbor, <filename>php3.ini</filename>, + sa premenoval na &php.ini;. </para> <para> - For the Apache configuration file, there are slightly more - changes. The MIME types recognized by the PHP module have - changed. + Pre konfiguraèný súbor Apache sa urobilo o nieèo viac + zmien. Typy MIME rozpoznávané PHP modulom sa zmenili. <informalexample> <programlisting role="apache"> <![CDATA[ @@ -71,9 +70,9 @@ </informalexample> </para> <para> - You can make your configuration files work with both versions - of PHP (depending on which one is currently compiled into the - server), using the following syntax: + Mô¾ete svoj konfiguraèný súbor urobi» tak, aby pracoval s oboma + verziami PHP (závisiac na akej je práve skompilovaný na serveri), + pomocou následujúceho syntaxu: <informalexample> <programlisting> <![CDATA[ @@ -87,11 +86,11 @@ </informalexample> </para> <simpara> - In addition, the PHP directive names for Apache have changed. + Okrem toho sa zmenili direktívne názvy pre Apache. </simpara> <para> - Starting with PHP 4.0, there are only four Apache directives - that relate to PHP: + Poènúc PHP 4.0, existujú iba ¹tyri Apache direktívy, + ktoré súvisia s PHP: <informalexample> <programlisting role="apache"> <![CDATA[ @@ -104,17 +103,17 @@ </informalexample> </para> <simpara> - There are two differences between the Admin values and the non admin values: + Sú dva rozdiely medzi hodnotami Adminovskými a ne-adminovskými: </simpara> <itemizedlist> - <listitem><simpara>Admin values (or flags) can only appear in the server-wide apache configuration files (e.g., httpd.conf).</simpara></listitem> - <listitem><simpara>Standard values (or flags) cannot control certain PHP directives, for example - safe mode (if you could override safe mode settings in .htaccess files, it would defeat safe-mode's purpose). In contrast, Admin values can modify the value of any PHP directive.</simpara></listitem> + <listitem><simpara>Admin hodnoty (alebo flagy) sa objavujú len na konfiguraèných súboroch Apache roz¹írených po serveri (t.j. httpd.conf).</simpara></listitem> + <listitem><simpara>©tandardné hodnoty (alebo flagy) nedoká¾u spoµahlivo kontrolova» PHP direktívy, napr. - núdzový re¾im (ak by ste dokázali prejs» cez nastavenia núdzového re¾imu v súboroch .htaccess, zamietlo by to známer núdzového re¾imu). Naopak, Admin hodnoty mô¾u pozmeni» hodnoty akejkoµvek PHP direktívy.</simpara></listitem> </itemizedlist> <simpara> - To make the transition process easier, PHP 4 is bundled with scripts that automatically convert your Apache configuration and .htaccess files to work with both PHP 3 and PHP 4. These scripts do NOT convert the mime type lines! You have to convert these yourself. + Aby sa proces prekladania uµahèil, PHP 4 je vybavené skriptami, ktoré automaticky konvertujú va¹u Apache kofiguráciu a súbory .htaccess, aby pracovali s PHP 3 aj s PHP 4. Tieto skripty NEKONVERTUJÚ napodobnené typové riadky! Tieto musíte prekonvertova» sami. </simpara> <para> - To convert your Apache configuration files, run the apconf-conv.sh script (available in the scripts/apache/ directory). For example: + Aby ste prekonvertovali svoje konfiguraèné súbory Apache, spustite skript apconf-conv.sh (dostupný v adresári /scripts/apache/). Na príklad: <informalexample> <programlisting role="shell"> <![CDATA[ @@ -124,10 +123,10 @@ </informalexample> </para> <simpara> - Your original configuration file will be saved in httpd.conf.orig. + Pôvodný konfiguraèný súbor bude ulo¾ený do httpd.conf.orig. </simpara> <para> - To convert your .htaccess files, run the aphtaccess-conv.sh script (available in the scripts/apache/ directory as well): + Aby ste prekonvertovali svoje .htaccess súbory, spustite skript aphtaccess-conv.sh (tie¾ dostupný v adresári scripts/apache/): <informalexample> <programlisting role="shell"> <![CDATA[ @@ -137,305 +136,297 @@ </informalexample> </para> <simpara> - Likewise, your old .htaccess files will be saved with an .orig prefix. + Rovnako sa aj va¹e staré .htaccess súbory ulo¾ia s prefixom .orig. </simpara> <simpara> - The conversion scripts require awk to be installed. + K in¹talácii konverzných skriptov sa vy¾aduje trocha zruènosti. </simpara> </section> <section id='migration4.parser'> - <title>Parser behavior</title> + <title>Správanie parsera</title> <para> - Parsing and execution are now two completely separated steps, no - execution of a files code will happen until the complete file and - everything it requires has completely and successfully been - parsed. + Analýza a spracovanie sú teraz dva úplne oddelené kroky, nespracuje + sa ¾iaden kód súboru pokým sa celý súbor a v¹etko, èo vy¾aduje, + kompletne a úspe¹ne neanalyzovalo. </para> <para> - One of the new requirements introduced with this split is that - required and included files now have to be syntactically - complete. You can no longer spread the different controlling parts - of a control structure across file boundaries. That is you cannot - start a <literal>for</literal> or <literal>while</literal> loop, - an <literal>if</literal> statement or a <literal>switch</literal> - block in one file and have the end of loop, + Jedna z nových po¾iadaviek predstavených s týmto rozdelením je, + ¾e potrebné a zahrnuté súbory musia teraz by» syntakticky + kompletné. U¾ viac nemô¾ete roz¹irova» kontrolné èasti kontrolnej + ¹truktúry cez hranice súboru. To je, ¾e nemô¾ete zaèa» + <literal>for</literal> alebo <literal>while</literal> sluèku, + príkaz <literal>if</literal> alebo <literal>switch</literal> + blok v jednom súbore a ukonèenie sluèky, príkazy <literal>else</literal>, <literal>endif</literal>, - <literal>case</literal> or <literal>break</literal> statements in - a different file. + <literal>case</literal> alebo <literal>break</literal> v + rozlièných súboroch. </para> <para> - It still perfectly legal to include additional code within loops - or other control structures, only the controlling keywords and - corresponding curly braces <literal>{...}</literal> have to be - within the same compile unit (file or <function>eval</function>ed - string). + Je stále úplne dovolené zahàòa» dodatoèný kód alebo iné kontrolné + ¹truktúry, jedine kontrolné kµúèové slová a príslu¹ne zlo¾ené + zátvorky <literal>{...}</literal> musia by» v rovnakej kompilaènej + jednotke (súbore alebo <function>eval</function>ovanom re»azci). </para> <para> - This should not harm to much as spreading code like this should be - considered as very bad style anyway. + Toto by nemalo veµmi vadi», nakoµko roz¹irujúci kód ako tento by sa + rozhodne mal poklada» ako veµmi zlý ¹týl. </para> <para> - Another thing no longer possible, though rarely seen in PHP 3 - code is returning values from a required file. Returning a value - from an included file is still possible. + Ïal¹ia, u¾ nemo¾ná vec, i keï v PHP 3 videná len zriedkavo, je + vrátenie hodnôt z vy¾adovaného súboru. Vrátenie hodnoty zo + zahrnutého súboru je stále mo¾né. </para> </section> <section id='migration4.error-reporting'> - <title>Error reporting</title> + <title>Hlásenie chýb</title> <section id='migration4.error-reporting.config'> - <title>Configuration changes</title> + <title>Konfiguraèné zmeny</title> <para> - With PHP 3 the error reporting level was set as a simple - numeric value formed by summing up the numbers related to - different error levels. Usual values where 15 for reporting all - errors and warnings or 7 for reporting everything but simple - notice messages reporting bad style and things like that. - </para> - <para> - PHP 4 has a larger set of error and warning levels and comes with a - configuration parser that now allows for symbolic constants to be used - for setting the intended behavior. - </para> - <para> - Error reporting level should now be configured by explicitly - taking away the warning levels you do not want to generate error - messages by x-oring them from the symbolic constant - <literal>E_ALL</literal>. Sounds complicated? Well, lets say you - want the error reporting system to report all but the simple - style warnings that are categorized by the symbolic constant - <literal>E_NOTICE</literal>. Then you'll put the following into - your &php.ini;: <literal>error_reporting = - E_ALL & ~ ( E_NOTICE )</literal>. If you want to suppress - warnings too you add up the appropriate constant within the - braces using the binary or operator '|': + V PHP 3 bola úroveò hlásenia chýb nastavená ako jednoduchá + èíselná hodnota vytvorená sèítaním èísel, ktoré súvisia s + rôznymi úrovòami chýb. Be¾nými hodnotami boli 15 pre hlásenie + v¹etkých chýb a upozornení alebo 7 pre hlásenie v¹etkého + ako sú varovné správy a podobné veci. + </para> + <para> + PHP 4 má väè¹iu sadu úrovní chýb a upozornení a prichádza s + konfiguraèným parserom, ktorý dovoµuje pou¾itie symbolických kon¹tánt + pre nastavovanie plánovaného správania. + </para> + <para> + Úroveò hlásenia chýb by sa teraz mala konfigurova» výluène + odobratím úrovní upozornenia, ktoré nechcete, aby generovali + chybové hlásenia x-oringovaním zo symbilickej kon¹tanty + <literal>E_ALL</literal>. Znie to zlo¾ito? Teda, povedzme, ¾e + chcete,aby systém hlásenia chýb hlásil v¹etko, okrem jednoduchých + ¹týlových upozornení, ktoré sú kategorizované symbolickou + kon¹tantou <literal>E_NOTICE</literal>. Potom vlo¾íte následovné do + vá¹ho &php.ini;: <literal>error_reporting = + E_ALL & ~ ( E_NOTICE )</literal>. Ak chcete tie¾ zakáza» + upozornenia , pridajte vhodnú kon¹tantu do zátvoriek binárne + alebo pomocou operátora '|': <literal>error_reporting= E_ALL & ~ ( E_NOTICE | E_WARNING )</literal>. </para> <warning> <para> - Using the old values 7 and 15 for setting up error reporting is - a very bad idea as this suppresses some of the newly added error - classes including parse errors. This may lead to very strange - behavior as scripts might no longer work without error messages - showing up anywhere. + Pou¾ívanie starých hodnôt 7 a 15 pre nastavovanie hlásenia chýb je + veµmi zlý nápad, nakoµko toto odstavuje niektoré novo pridané + triedy chýb vrátane chýb analýzy. Toto mô¾e vies» k veµmi divnému + správaniu, preto¾e skript by mohol pracova» bez zobrazovania + chybových hlásení. </para> <para> - This has lead to a lot of unreproducible bug reports in the - past where people reported script engine problems they were not - capable to track down while the &true; case was usually some - missing '}' in a required file that the parser was not able to - report due to a misconfigured error reporting system. + Toto v minulosti viedlo k veµkému mno¾stvu nereprodukovateµných + chybových hlásení, kde µudia hlásili problémy so skriptovým enginom, + ktoré nevedeli vystopova», keï boli &true;, príèinou zvyèajne bola + chýbajúca '}' vo vy¾adovanom súbore, ktorú parser nevedel hlási» + kvôli zlej konfigurácii systému hlásenia chýb. </para> <para> - So checking your error reporting setup should be the first thing - to do whenever your scripts silently die. The Zend engine can - be considered mature enough nowadays to not cause this kind of - strange behavior. + Tak¾e kontrola nastavenia hlásenia chýb je prvá vec, ktorá by sa + mala urobi» v¾dy, keï sa va¹e skripty neèinne zaseknú. Zend + Engine sa dnes dá posudzova» ako dostatoène vypracovaný, aby + nespôsobil tento druh zlá¹tneho správania. </para> </warning> </section> <section id='migration4.error-reporting.additions'> - <title>Additional warning messages</title> + <title>Dodatoèné výstra¾né hlásenia</title> <para> - A lot of existing PHP 3 code uses language constructs that - should be considered as very bad style as this code, while doing - the intended thing now, could easily be broken by changes in - other places. PHP 4 will output a lot of notice messages in - such situations where PHP 3 didn't. The easy fix is to just - turn off E_NOTICE messages, but it is usually a good idea to fix - the code instead. - </para> - <para> - The most common case that will now produce notice messages is the - use of unquoted string constants as array indices. Both PHP 3 - and 4 will fall back to interpret these as strings if no - keyword or constant is known by that name, but whenever a - constant by that name had been defined anywhere else in the code - it might break your script. This can even become a security risk - if some intruder manages to redefine string constants in a way - that makes your script give him access rights he wasn't intended - to have. So PHP 4 will now warn you whenever you use unquoted - string constants as for example in - <literal>$_SERVER[REQUEST_METHOD]</literal>. Changing it - to <literal>$_SERVER['REQUEST_METHOD']</literal> will - make the parser happy and greatly improve the style and security - of your code. + Veµa existujúceho PHP 3 kódu vyu¾íva jazkové kon¹trukcie, èo + by sa malo posudzova» za veµmi zlý ¹týl, preto¾e tento kód, poèas + urèenej úlohy, mô¾e zlyha» kvôli zmenám na iných miestach. + PHP 4 vyrába veµa výstra¾ných správ v situáciách, v ktorých + PHP 3 nie. Dá sa to jednoducho opravi» vypnutím E_NOTICE správ, + ale namiesto toho je lep¹ie kód opravi». + </para> + <para> + Najbe¾nej¹í prípad, ktorý bude teraz vyrába» výstra¾né správy, je + pou¾itie re»azcových kon¹tánt bez apostrofov ako indexov polí. + PHP 3 a 4 ich bude interpretova» ako re»azce ak pod takým menom + nie sú známe ¾iadne kµúèové slová alebo kon¹tanty, ale kedykoµvek + bola pod takým menom definovaná kon¹tanta, mô¾e sa vá¹ skript + kdekoµvek v kóde preru¹i». Toto sa mô¾e dokonca sta» rizikom + nebezpeèia ak nejaký votrelec predefinuje re»azcové kon¹tanty + spôsobom, ktorým mu vá¹ skript dáva prístupové práva, ktoré nemal + ma». Tak¾e PHP 4 vás teraz bude varova» v¾dy, keï pou¾ijete + re»azcové kon¹tanty bez apostrofov ako napríklad v + <literal>$_SERVER[REQUEST_METHOD]</literal>. Jeho zmena + na <literal>$_SERVER['REQUEST_METHOD']</literal> 'ute¹í' + parser a významne zlep¹í ¹týl a bezpeènos» vá¹ho kódu. </para> <para> - Another thing PHP 4 will now tell you about is the use of - uninitialized variables or array elements. + Ïal¹ia vec, o ktorej vám PHP 4 povie, je pou¾itie neinicializovaných + premenných alebo elementov polí. </para> </section> </section> <section id='migration4.initializers'> - <title>Initializers</title> + <title>Inicializátory</title> <para> - Static variable and class member initializers only accept scalar - values while in PHP 3 they accepted any valid expression. This - is, once again, due to the split between parsing and execution as - no code has yet been executed when the parser sees the - initializer. + Statická premenná a inicializátory èlenov triedy akceptujú iba + skalárne hodnoty, zatial èo v PHP 3 akceptovali hocijaké platné + výrazy. To je, zas a znova, kvôli rozdeleniu analýzy a spracovania, + preto¾e sa e¹te ¾iadny kód nespracoval, keï parser vidí + inicializátor. </para> <para> - For classes you should use constructors to initialize member - variables instead. For static variables anything but a simple - static value rarely makes sense anyway. + Namiesto toho by ste mali k inicializovaniu èlenských premenných + pre triedy pou¾i» kon¹truktérov. Pre statické premenné + zvyèajne nemá zmysel niè iné, len jednoduché statické hodnoty. </para> </section> <section id='migration4.empty'> <title><literal>empty("0")</literal></title> <para> - The perhaps most controversial change in behavior has happened to the - behavior of the <function>empty</function>. A String containing - only the character '0' (zero) is now considered empty while it - wasn't in PHP 3. + Pravdepodobne najkontroverznej¹ia zmena sa stala v správaní funkcie + <function>empty</function>. Re»azec, ktorý obsahuje iba znak '0' + (nula) sa teraz pova¾uje za prázdny, zatiaµ èo v PHP 3 nie. </para> <para> - This new behavior makes sense in web applications, with all input - fields returning strings even if numeric input is requested, and - with PHP's capabilities of automatic type conversion. But on the - other had it might break your code in a rather subtle way, - leading to misbehavior that is hard to track down if you do not - know about what to look for. + Toto nové správanie má zmysel vo web aplikáciách, vo v¹etkých + vstupných poliach, ktoré vracajú re»azec dokonca aj keï je po¾adovaný + èíselný vstup, a v PHP schopnostiach automatickej typovej konverzie. + Ale, na druhej strane, to mô¾e vá¹ kód zákerným spôsobom poru¹i», + èo vedie k divnému správaniu, ktoré je »a¾ké vystopova» ak + neviete, èo máte hµada». </para> </section> <section id='migration4.missing'> - <title>Missing functions</title> + <title>Chýbajúce funkcie</title> <para> - While PHP 4 comes with a lot of new features, functions and - extensions, you may still find some functions from version 3 - missing. A small number of core functions has vanished because - they do not work with the new scheme of splitting parsing and - execution as introduced into 4 with the Zend engine. Other - functions and even complete extensions have become obsolete as - newer functions and extensions serve the same task better and/or - in a more general way. Some functions just simply haven't been - ported yet and finally some functions or extensions may be missing - due to license conflicts. + Zatiaµ èo PHP 4 prichádza s mnohými vlastnos»ami, funkciami + a roz¹íreniami, mô¾ete zisti», ¾e niektoré funkcie z verzie 3 + chýbajú. Malé mno¾stvo jadrových funkcií zmyzlo, preto¾e + nepracujú s novou schémou rozdelenia analýzy a spracovania + ako to bolo predstavené v 4 so Zend engineom. Iné funkcie a + e¹te kompletnej¹ie roz¹írenia zastarali, preto¾e nové funkcie + a roz¹írenia plnia niektoré úlohy lep¹ie a/alebo v¹eobecnej¹ím + spôsobom. Niektoré funkcie jednoducho e¹te neboli prenesené a, + nakoniec, niektoré funkcie mô¾u chýba» kvôli licenèným konfliktom. </para> <section id='migration4.missing.concept'> - <title>Functions missing due to conceptual changes</title> + <title>Funkcie chýbajúce kvôli koncepèným zmenám</title> <para> - As PHP 4 now separates parsing from execution it is no longer - possible to change the behavior of the parser (now embedded in - the Zend engine) at runtime as parsing already happened by - then. So the function <function>short_tags</function> no longer - exists. You can still change the parsers behavior by setting - appropriate values in the &php.ini; file. + Keï¾e PHP 4 teraz oddeµuje analýzu od spracovania, u¾ nie je + mo¾né meni» správanie parsera (teraz vlo¾eného v Zend Engine) + poèas runtime, nakoµko analýza u¾ prebehla. Tak¾e funkcia + <function>short_tags</function> u¾ viac neexistuje. Stále + v¹ak mô¾ete zmeni» správanie parsera nastavením príslu¹ných + hodnôt v súbore &php.ini;. </para> <para> - Another feature of PHP 3 that is not a part of PHP 4 is the bundled - debugging interface. There are third-party add-ons for the Zend engine - which add similar functionality. + Ïal¹ia vlastnos» PHP 3, ktorá u¾ nie je súèas»ou PHP 4, je zbalené + ladiace rozhranie. Existuje v¹ak menej významná skupina add-onov pre + Zend Engine, ktorá pridáva podobné funkènosti. </para> </section> <section id='migration4.deprecate'> - <title>Deprecate functions and extensions</title> + <title>Neschvaµované funkcie a roz¹írenia</title> <para> - The Adabas and Solid database extensions are no more. Long live - the unified ODBC extension instead. + Databázové roz¹írenia Adabas a Solid u¾ nie sú. Namiesto nich + sa pou¾íva pretrvávajúce ODBC roz¹írenie. </para> </section> <section id='migration4.unset'> - <title>Changed status for <function>unset</function></title> + <title>Zmeneny stav <function>unset</function></title> <para> - <function>unset</function>, although still available, is - implemented as a language construct rather than a function. + Funkcia <function>unset</function> je síce stále dostupná, ale + je implementovaná ako jazyková kon¹trukcia, nie ako funkcia. </para> <para> - This does not have any consequences on the behavior of - <function>unset</function>, but testing for "unset" using - <function>function_exists</function> will return &false; as it would with - other language constructs that look like functions such as + To nemá ¾iadne dôsledky na správanie funkcie + <function>unset</function>, ale testovanie "unset" pou¾itím + <function>function_exists</function> vráti &false; ako by vrátili + aj iné jazykové kon¹trukcie, ktoré vypadajú ako funkcie, napr. <function>echo</function>. </para> <para> - Another more practical change is that it is no longer possible to - call <function>unset</function> indirectly, that is - <literal>$func="unset"; $func($somevar)</literal> won't work - anymore. + Ïal¹ia praktickej¹ia zmena je, ¾e u¾ sa <function>unset</function> + nedá vola» nepriamo, t. j. <literal>$func="unset"; $func($somevar)</literal> + u¾ nebude fungova». </para> </section> </section> <section id='migration4.extensions'> - <title>PHP 3 extension</title> + <title>Roz¹írenia PHP 3</title> <para> - Extensions written for PHP 3 will not work with PHP 4, neither as binaries - nor at the source level. It is not difficult to port extensions to PHP 4 - if you have access to the original source. A detailed description of the - actual porting process is not part of this text. + Roz¹írenia napísané pre PHP 3 nebudú fungova» v PHP 4 ani ako bináre ani + na úrovni zdroja. Prenesenie roz¹írenia do PHP 4 nie je zlo¾ité, ak máte + prístup k pôvodnému zdroju. Detailný popis súèasného prenosného procesu + nie je súèas»ou tohto manuálu. </para> </section> <section id='migration4.strings'> - <title>Variable substitution in strings</title> + <title>Substitúcia premenných v re»azcoch</title> <para> - PHP 4 adds a new mechanism to variable substitution in - strings. You can now finally access object member variables and - elements from multidimensional arrays within strings. + PHP 4 k substitúcii premenných v re»azcoch pridáva nový + mechanizmus. Koneène mô¾ete ma» prístup k premenným èlena objektu + a elementov z multidimenzionálnych polí v re»azcoch. </para> <para> - To do so you have to enclose your variables with curly braces with - the dollar sign immediately following the opening brace: - <literal>{$...}</literal> + Aby ste tak uèinili, musíte uzavrie» va¹e premenné uzavrie» do + zlo¾ených zátvoriek. Znak dolára musí následova» hneï po otvorenej + zátvorke <literal>{$...}</literal>. </para> <para> - To embed the value of an object member variable into a string you - simply write <literal>"text {$obj->member} text"</literal> while - in PHP 3 you had to use something like <literal>"text + Ak chcete hodnotu premennej objektu èlena vlo¾i» do re»azca, + jednoducho napí¹te <literal>"text {$obj->member} text"</literal> + prièom v PHP 3 ste museli pou¾i» nieèo ako <literal>"text ".$obj->member." text"</literal>. </para> <para> - This should lead to more readable code, while it may break - existing scripts written for PHP 3. But you can easily check for - this kind of problem by checking for the character combination - <literal>{$</literal> in your code and by replacing it with - <literal>\{$</literal> with your favorite search-and-replace - tool. + Toto by malo vies» k èitateµnému kódu, i keï by to mohlo + poru¹i» existujúce skripty napísané pre PHP 3. Ale tento druh + problému mô¾ete vo svojom kóde µahko opravi» nájdením kombinácie + znakov <literal>{$</literal> a ich nahradením s <literal>\{$</literal> + pomocou svojho obµúbeného nástroja nájde-a-nahraï. </para> </section> <section id='migration4.cookies'> <title>Cookies</title> <para> - PHP 3 had the bad habit of setting cookies in the reverse order - of the <function>setcookie</function> calls in your code. PHP 4 - breaks with this habit and creates the cookie header lines in - exactly the same order as you set the cookies in the code. + PHP 3 malo zlý zvyk po volaní <function>setcookie</function> nastavova» + cookies v opaènom poradí. PHP 4 tento zvyk zru¹il a vytvára + hlavièky cookie presne v tom istom poradí, ako ste si ich nastavili + v kóde. </para> <para> - This might break some existing code, but the old behaviour was so - strange to understand that it deserved a change to prevent further - problems in the future. + To síce mô¾e poru¹i» existujúci kód, ale staré správanie bolo tak + divné, ¾e si to zaslú¾ilo zmenu ako prevenciu voèi ïal¹ím problémom + v budúcnosti. </para> </section> <section id='migration4.variables'> - <title>Handling of global variables</title> + <title>Zaobchádzanie s globálnymi premennými</title> <para> - While handling of global variables had the focus on to be easy in - PHP 3 and early versions of PHP 4, the focus has changed to be more - secure. While in PHP 3 the following example worked fine, in PHP 4 it - has to be unset($GLOBALS["id"]);. This is only one issue of global - variable handling. You should always have used $GLOBALS, with - newer versions of PHP 4 you are forced to do so in most cases. - Read more on this subject in the <link linkend="references.global"> - <literal>global</literal> references section</link>. + Zatial èo zaobchádzanie s globálnymi premennými malo v PHP 3 a + prvých verziách PHP 4 jednoduchý fokus, fokus sa zmenil, aby aby bol + bezpeènej¹í. Zatial èo následujúci príklad v PHP 3 fungoval v pohode, + v PHP 4 to musí by» ($GLOBALS["id"]);. Toto je len jeden problém + zaobchádzania s globálnymi premennými. Mali by ste v¾dy pou¾íva» + $GLOBALS, pri nových verziách PHP 4 ste tak nútení urobi» vo väè¹ine + prípadov. O tejto téme sa viac doèítate v <link linkend="references.global"> + referenènej sekcii <literal>global</literal></link>. </para> <example> - <title>Migration of global variables</title> + <title>Migrácia globálnych premenných</title> <programlisting role="php"> <![CDATA[ <?php @@ -446,7 +437,7 @@ unset($id); } test(); -echo($id); // This will print out 1 in PHP 4 +echo($id); // Toto v PHP 4 vypí¹e 1 ?> ]]> </programlisting>
Index: phpdoc-sk/appendices/migration4.xml diff -u phpdoc-sk/appendices/migration4.xml:1.1 phpdoc-sk/appendices/migration4.xml:1.2 --- phpdoc-sk/appendices/migration4.xml:1.1 Sun Sep 1 18:58:04 2002 +++ phpdoc-sk/appendices/migration4.xml Tue Sep 3 20:14:23 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- EN-Revision: 1.24 Maintainer: joseph Status: working --> +<!-- EN-Revision: 1.24 Maintainer: joseph Status: ready --> <appendix id="migration4"> <title>Migrácia z PHP 3 do PHP 4</title> @@ -36,7 +36,7 @@ Aby ste ju aktivovali, nakonfigurujte PHP3 a PHP4 na pou¾ívanie APXS (--with-apxs) a nevyhnutné linkové roz¹írenia (--enable-versioning). Inak sa aplikujú v¹etky ¹tandardné - in¹talaèné int¹trukcie. Na príklad: + in¹talaèné in¹trukcie. Na príklad: <informalexample> <programlisting role="configure"> <![CDATA[ @@ -52,15 +52,14 @@ </section> <section id="migration4.configuration"> - <title>Migrating Configuration Files</title> + <title>Migrácia konfiguraèných súborov</title> <para> - The global configuration file, <filename>php3.ini</filename>, - has changed its name to &php.ini;. + Globálny konfiguraèný súbor, <filename>php3.ini</filename>, + sa premenoval na &php.ini;. </para> <para> - For the Apache configuration file, there are slightly more - changes. The MIME types recognized by the PHP module have - changed. + Pre konfiguraèný súbor Apache sa urobilo o nieèo viac + zmien. Typy MIME rozpoznávané PHP modulom sa zmenili. <informalexample> <programlisting role="apache"> <![CDATA[ @@ -71,9 +70,9 @@ </informalexample> </para> <para> - You can make your configuration files work with both versions - of PHP (depending on which one is currently compiled into the - server), using the following syntax: + Mô¾ete svoj konfiguraèný súbor urobi» tak, aby pracoval s oboma + verziami PHP (závisiac na akej je práve skompilovaný na serveri), + pomocou následujúceho syntaxu: <informalexample> <programlisting> <![CDATA[ @@ -87,11 +86,11 @@ </informalexample> </para> <simpara> - In addition, the PHP directive names for Apache have changed. + Okrem toho sa zmenili direktívne názvy pre Apache. </simpara> <para> - Starting with PHP 4.0, there are only four Apache directives - that relate to PHP: + Poènúc PHP 4.0, existujú iba ¹tyri Apache direktívy, + ktoré súvisia s PHP: <informalexample> <programlisting role="apache"> <![CDATA[ @@ -104,17 +103,17 @@ </informalexample> </para> <simpara> - There are two differences between the Admin values and the non admin values: + Sú dva rozdiely medzi hodnotami Adminovskými a ne-adminovskými: </simpara> <itemizedlist> - <listitem><simpara>Admin values (or flags) can only appear in the server-wide apache configuration files (e.g., httpd.conf).</simpara></listitem> - <listitem><simpara>Standard values (or flags) cannot control certain PHP directives, for example - safe mode (if you could override safe mode settings in .htaccess files, it would defeat safe-mode's purpose). In contrast, Admin values can modify the value of any PHP directive.</simpara></listitem> + <listitem><simpara>Admin hodnoty (alebo flagy) sa objavujú len na konfiguraèných súboroch Apache roz¹írených po serveri (t.j. httpd.conf).</simpara></listitem> + <listitem><simpara>©tandardné hodnoty (alebo flagy) nedoká¾u spoµahlivo kontrolova» PHP direktívy, napr. - núdzový re¾im (ak by ste dokázali prejs» cez nastavenia núdzového re¾imu v súboroch .htaccess, zamietlo by to známer núdzového re¾imu). Naopak, Admin hodnoty mô¾u pozmeni» hodnoty akejkoµvek PHP direktívy.</simpara></listitem> </itemizedlist> <simpara> - To make the transition process easier, PHP 4 is bundled with scripts that automatically convert your Apache configuration and .htaccess files to work with both PHP 3 and PHP 4. These scripts do NOT convert the mime type lines! You have to convert these yourself. + Aby sa proces prekladania uµahèil, PHP 4 je vybavené skriptami, ktoré automaticky konvertujú va¹u Apache kofiguráciu a súbory .htaccess, aby pracovali s PHP 3 aj s PHP 4. Tieto skripty NEKONVERTUJÚ napodobnené typové riadky! Tieto musíte prekonvertova» sami. </simpara> <para> - To convert your Apache configuration files, run the apconf-conv.sh script (available in the scripts/apache/ directory). For example: + Aby ste prekonvertovali svoje konfiguraèné súbory Apache, spustite skript apconf-conv.sh (dostupný v adresári /scripts/apache/). Na príklad: <informalexample> <programlisting role="shell"> <![CDATA[ @@ -124,10 +123,10 @@ </informalexample> </para> <simpara> - Your original configuration file will be saved in httpd.conf.orig. + Pôvodný konfiguraèný súbor bude ulo¾ený do httpd.conf.orig. </simpara> <para> - To convert your .htaccess files, run the aphtaccess-conv.sh script (available in the scripts/apache/ directory as well): + Aby ste prekonvertovali svoje .htaccess súbory, spustite skript aphtaccess-conv.sh (tie¾ dostupný v adresári scripts/apache/): <informalexample> <programlisting role="shell"> <![CDATA[ @@ -137,305 +136,297 @@ </informalexample> </para> <simpara> - Likewise, your old .htaccess files will be saved with an .orig prefix. + Rovnako sa aj va¹e staré .htaccess súbory ulo¾ia s prefixom .orig. </simpara> <simpara> - The conversion scripts require awk to be installed. + K in¹talácii konverzných skriptov sa vy¾aduje trocha zruènosti. </simpara> </section> <section id='migration4.parser'> - <title>Parser behavior</title> + <title>Správanie parsera</title> <para> - Parsing and execution are now two completely separated steps, no - execution of a files code will happen until the complete file and - everything it requires has completely and successfully been - parsed. + Analýza a spracovanie sú teraz dva úplne oddelené kroky, nespracuje + sa ¾iaden kód súboru pokým sa celý súbor a v¹etko, èo vy¾aduje, + kompletne a úspe¹ne neanalyzovalo. </para> <para> - One of the new requirements introduced with this split is that - required and included files now have to be syntactically - complete. You can no longer spread the different controlling parts - of a control structure across file boundaries. That is you cannot - start a <literal>for</literal> or <literal>while</literal> loop, - an <literal>if</literal> statement or a <literal>switch</literal> - block in one file and have the end of loop, + Jedna z nových po¾iadaviek predstavených s týmto rozdelením je, + ¾e potrebné a zahrnuté súbory musia teraz by» syntakticky + kompletné. U¾ viac nemô¾ete roz¹irova» kontrolné èasti kontrolnej + ¹truktúry cez hranice súboru. To je, ¾e nemô¾ete zaèa» + <literal>for</literal> alebo <literal>while</literal> sluèku, + príkaz <literal>if</literal> alebo <literal>switch</literal> + blok v jednom súbore a ukonèenie sluèky, príkazy <literal>else</literal>, <literal>endif</literal>, - <literal>case</literal> or <literal>break</literal> statements in - a different file. + <literal>case</literal> alebo <literal>break</literal> v + rozlièných súboroch. </para> <para> - It still perfectly legal to include additional code within loops - or other control structures, only the controlling keywords and - corresponding curly braces <literal>{...}</literal> have to be - within the same compile unit (file or <function>eval</function>ed - string). + Je stále úplne dovolené zahàòa» dodatoèný kód alebo iné kontrolné + ¹truktúry, jedine kontrolné kµúèové slová a príslu¹ne zlo¾ené + zátvorky <literal>{...}</literal> musia by» v rovnakej kompilaènej + jednotke (súbore alebo <function>eval</function>ovanom re»azci). </para> <para> - This should not harm to much as spreading code like this should be - considered as very bad style anyway. + Toto by nemalo veµmi vadi», nakoµko roz¹irujúci kód ako tento by sa + rozhodne mal poklada» ako veµmi zlý ¹týl. </para> <para> - Another thing no longer possible, though rarely seen in PHP 3 - code is returning values from a required file. Returning a value - from an included file is still possible. + Ïal¹ia, u¾ nemo¾ná vec, i keï v PHP 3 videná len zriedkavo, je + vrátenie hodnôt z vy¾adovaného súboru. Vrátenie hodnoty zo + zahrnutého súboru je stále mo¾né. </para> </section> <section id='migration4.error-reporting'> - <title>Error reporting</title> + <title>Hlásenie chýb</title> <section id='migration4.error-reporting.config'> - <title>Configuration changes</title> + <title>Konfiguraèné zmeny</title> <para> - With PHP 3 the error reporting level was set as a simple - numeric value formed by summing up the numbers related to - different error levels. Usual values where 15 for reporting all - errors and warnings or 7 for reporting everything but simple - notice messages reporting bad style and things like that. - </para> - <para> - PHP 4 has a larger set of error and warning levels and comes with a - configuration parser that now allows for symbolic constants to be used - for setting the intended behavior. - </para> - <para> - Error reporting level should now be configured by explicitly - taking away the warning levels you do not want to generate error - messages by x-oring them from the symbolic constant - <literal>E_ALL</literal>. Sounds complicated? Well, lets say you - want the error reporting system to report all but the simple - style warnings that are categorized by the symbolic constant - <literal>E_NOTICE</literal>. Then you'll put the following into - your &php.ini;: <literal>error_reporting = - E_ALL & ~ ( E_NOTICE )</literal>. If you want to suppress - warnings too you add up the appropriate constant within the - braces using the binary or operator '|': + V PHP 3 bola úroveò hlásenia chýb nastavená ako jednoduchá + èíselná hodnota vytvorená sèítaním èísel, ktoré súvisia s + rôznymi úrovòami chýb. Be¾nými hodnotami boli 15 pre hlásenie + v¹etkých chýb a upozornení alebo 7 pre hlásenie v¹etkého + ako sú varovné správy a podobné veci. + </para> + <para> + PHP 4 má väè¹iu sadu úrovní chýb a upozornení a prichádza s + konfiguraèným parserom, ktorý dovoµuje pou¾itie symbolických kon¹tánt + pre nastavovanie plánovaného správania. + </para> + <para> + Úroveò hlásenia chýb by sa teraz mala konfigurova» výluène + odobratím úrovní upozornenia, ktoré nechcete, aby generovali + chybové hlásenia x-oringovaním zo symbilickej kon¹tanty + <literal>E_ALL</literal>. Znie to zlo¾ito? Teda, povedzme, ¾e + chcete,aby systém hlásenia chýb hlásil v¹etko, okrem jednoduchých + ¹týlových upozornení, ktoré sú kategorizované symbolickou + kon¹tantou <literal>E_NOTICE</literal>. Potom vlo¾íte následovné do + vá¹ho &php.ini;: <literal>error_reporting = + E_ALL & ~ ( E_NOTICE )</literal>. Ak chcete tie¾ zakáza» + upozornenia , pridajte vhodnú kon¹tantu do zátvoriek binárne + alebo pomocou operátora '|': <literal>error_reporting= E_ALL & ~ ( E_NOTICE | E_WARNING )</literal>. </para> <warning> <para> - Using the old values 7 and 15 for setting up error reporting is - a very bad idea as this suppresses some of the newly added error - classes including parse errors. This may lead to very strange - behavior as scripts might no longer work without error messages - showing up anywhere. + Pou¾ívanie starých hodnôt 7 a 15 pre nastavovanie hlásenia chýb je + veµmi zlý nápad, nakoµko toto odstavuje niektoré novo pridané + triedy chýb vrátane chýb analýzy. Toto mô¾e vies» k veµmi divnému + správaniu, preto¾e skript by mohol pracova» bez zobrazovania + chybových hlásení. </para> <para> - This has lead to a lot of unreproducible bug reports in the - past where people reported script engine problems they were not - capable to track down while the &true; case was usually some - missing '}' in a required file that the parser was not able to - report due to a misconfigured error reporting system. + Toto v minulosti viedlo k veµkému mno¾stvu nereprodukovateµných + chybových hlásení, kde µudia hlásili problémy so skriptovým enginom, + ktoré nevedeli vystopova», keï boli &true;, príèinou zvyèajne bola + chýbajúca '}' vo vy¾adovanom súbore, ktorú parser nevedel hlási» + kvôli zlej konfigurácii systému hlásenia chýb. </para> <para> - So checking your error reporting setup should be the first thing - to do whenever your scripts silently die. The Zend engine can - be considered mature enough nowadays to not cause this kind of - strange behavior. + Tak¾e kontrola nastavenia hlásenia chýb je prvá vec, ktorá by sa + mala urobi» v¾dy, keï sa va¹e skripty neèinne zaseknú. Zend + Engine sa dnes dá posudzova» ako dostatoène vypracovaný, aby + nespôsobil tento druh zlá¹tneho správania. </para> </warning> </section> <section id='migration4.error-reporting.additions'> - <title>Additional warning messages</title> + <title>Dodatoèné výstra¾né hlásenia</title> <para> - A lot of existing PHP 3 code uses language constructs that - should be considered as very bad style as this code, while doing - the intended thing now, could easily be broken by changes in - other places. PHP 4 will output a lot of notice messages in - such situations where PHP 3 didn't. The easy fix is to just - turn off E_NOTICE messages, but it is usually a good idea to fix - the code instead. - </para> - <para> - The most common case that will now produce notice messages is the - use of unquoted string constants as array indices. Both PHP 3 - and 4 will fall back to interpret these as strings if no - keyword or constant is known by that name, but whenever a - constant by that name had been defined anywhere else in the code - it might break your script. This can even become a security risk - if some intruder manages to redefine string constants in a way - that makes your script give him access rights he wasn't intended - to have. So PHP 4 will now warn you whenever you use unquoted - string constants as for example in - <literal>$_SERVER[REQUEST_METHOD]</literal>. Changing it - to <literal>$_SERVER['REQUEST_METHOD']</literal> will - make the parser happy and greatly improve the style and security - of your code. + Veµa existujúceho PHP 3 kódu vyu¾íva jazkové kon¹trukcie, èo + by sa malo posudzova» za veµmi zlý ¹týl, preto¾e tento kód, poèas + urèenej úlohy, mô¾e zlyha» kvôli zmenám na iných miestach. + PHP 4 vyrába veµa výstra¾ných správ v situáciách, v ktorých + PHP 3 nie. Dá sa to jednoducho opravi» vypnutím E_NOTICE správ, + ale namiesto toho je lep¹ie kód opravi». + </para> + <para> + Najbe¾nej¹í prípad, ktorý bude teraz vyrába» výstra¾né správy, je + pou¾itie re»azcových kon¹tánt bez apostrofov ako indexov polí. + PHP 3 a 4 ich bude interpretova» ako re»azce ak pod takým menom + nie sú známe ¾iadne kµúèové slová alebo kon¹tanty, ale kedykoµvek + bola pod takým menom definovaná kon¹tanta, mô¾e sa vá¹ skript + kdekoµvek v kóde preru¹i». Toto sa mô¾e dokonca sta» rizikom + nebezpeèia ak nejaký votrelec predefinuje re»azcové kon¹tanty + spôsobom, ktorým mu vá¹ skript dáva prístupové práva, ktoré nemal + ma». Tak¾e PHP 4 vás teraz bude varova» v¾dy, keï pou¾ijete + re»azcové kon¹tanty bez apostrofov ako napríklad v + <literal>$_SERVER[REQUEST_METHOD]</literal>. Jeho zmena + na <literal>$_SERVER['REQUEST_METHOD']</literal> 'ute¹í' + parser a významne zlep¹í ¹týl a bezpeènos» vá¹ho kódu. </para> <para> - Another thing PHP 4 will now tell you about is the use of - uninitialized variables or array elements. + Ïal¹ia vec, o ktorej vám PHP 4 povie, je pou¾itie neinicializovaných + premenných alebo elementov polí. </para> </section> </section> <section id='migration4.initializers'> - <title>Initializers</title> + <title>Inicializátory</title> <para> - Static variable and class member initializers only accept scalar - values while in PHP 3 they accepted any valid expression. This - is, once again, due to the split between parsing and execution as - no code has yet been executed when the parser sees the - initializer. + Statická premenná a inicializátory èlenov triedy akceptujú iba + skalárne hodnoty, zatial èo v PHP 3 akceptovali hocijaké platné + výrazy. To je, zas a znova, kvôli rozdeleniu analýzy a spracovania, + preto¾e sa e¹te ¾iadny kód nespracoval, keï parser vidí + inicializátor. </para> <para> - For classes you should use constructors to initialize member - variables instead. For static variables anything but a simple - static value rarely makes sense anyway. + Namiesto toho by ste mali k inicializovaniu èlenských premenných + pre triedy pou¾i» kon¹truktérov. Pre statické premenné + zvyèajne nemá zmysel niè iné, len jednoduché statické hodnoty. </para> </section> <section id='migration4.empty'> <title><literal>empty("0")</literal></title> <para> - The perhaps most controversial change in behavior has happened to the - behavior of the <function>empty</function>. A String containing - only the character '0' (zero) is now considered empty while it - wasn't in PHP 3. + Pravdepodobne najkontroverznej¹ia zmena sa stala v správaní funkcie + <function>empty</function>. Re»azec, ktorý obsahuje iba znak '0' + (nula) sa teraz pova¾uje za prázdny, zatiaµ èo v PHP 3 nie. </para> <para> - This new behavior makes sense in web applications, with all input - fields returning strings even if numeric input is requested, and - with PHP's capabilities of automatic type conversion. But on the - other had it might break your code in a rather subtle way, - leading to misbehavior that is hard to track down if you do not - know about what to look for. + Toto nové správanie má zmysel vo web aplikáciách, vo v¹etkých + vstupných poliach, ktoré vracajú re»azec dokonca aj keï je po¾adovaný + èíselný vstup, a v PHP schopnostiach automatickej typovej konverzie. + Ale, na druhej strane, to mô¾e vá¹ kód zákerným spôsobom poru¹i», + èo vedie k divnému správaniu, ktoré je »a¾ké vystopova» ak + neviete, èo máte hµada». </para> </section> <section id='migration4.missing'> - <title>Missing functions</title> + <title>Chýbajúce funkcie</title> <para> - While PHP 4 comes with a lot of new features, functions and - extensions, you may still find some functions from version 3 - missing. A small number of core functions has vanished because - they do not work with the new scheme of splitting parsing and - execution as introduced into 4 with the Zend engine. Other - functions and even complete extensions have become obsolete as - newer functions and extensions serve the same task better and/or - in a more general way. Some functions just simply haven't been - ported yet and finally some functions or extensions may be missing - due to license conflicts. + Zatiaµ èo PHP 4 prichádza s mnohými vlastnos»ami, funkciami + a roz¹íreniami, mô¾ete zisti», ¾e niektoré funkcie z verzie 3 + chýbajú. Malé mno¾stvo jadrových funkcií zmyzlo, preto¾e + nepracujú s novou schémou rozdelenia analýzy a spracovania + ako to bolo predstavené v 4 so Zend engineom. Iné funkcie a + e¹te kompletnej¹ie roz¹írenia zastarali, preto¾e nové funkcie + a roz¹írenia plnia niektoré úlohy lep¹ie a/alebo v¹eobecnej¹ím + spôsobom. Niektoré funkcie jednoducho e¹te neboli prenesené a, + nakoniec, niektoré funkcie mô¾u chýba» kvôli licenèným konfliktom. </para> <section id='migration4.missing.concept'> - <title>Functions missing due to conceptual changes</title> + <title>Funkcie chýbajúce kvôli koncepèným zmenám</title> <para> - As PHP 4 now separates parsing from execution it is no longer - possible to change the behavior of the parser (now embedded in - the Zend engine) at runtime as parsing already happened by - then. So the function <function>short_tags</function> no longer - exists. You can still change the parsers behavior by setting - appropriate values in the &php.ini; file. + Keï¾e PHP 4 teraz oddeµuje analýzu od spracovania, u¾ nie je + mo¾né meni» správanie parsera (teraz vlo¾eného v Zend Engine) + poèas runtime, nakoµko analýza u¾ prebehla. Tak¾e funkcia + <function>short_tags</function> u¾ viac neexistuje. Stále + v¹ak mô¾ete zmeni» správanie parsera nastavením príslu¹ných + hodnôt v súbore &php.ini;. </para> <para> - Another feature of PHP 3 that is not a part of PHP 4 is the bundled - debugging interface. There are third-party add-ons for the Zend engine - which add similar functionality. + Ïal¹ia vlastnos» PHP 3, ktorá u¾ nie je súèas»ou PHP 4, je zbalené + ladiace rozhranie. Existuje v¹ak menej významná skupina add-onov pre + Zend Engine, ktorá pridáva podobné funkènosti. </para> </section> <section id='migration4.deprecate'> - <title>Deprecate functions and extensions</title> + <title>Neschvaµované funkcie a roz¹írenia</title> <para> - The Adabas and Solid database extensions are no more. Long live - the unified ODBC extension instead. + Databázové roz¹írenia Adabas a Solid u¾ nie sú. Namiesto nich + sa pou¾íva pretrvávajúce ODBC roz¹írenie. </para> </section> <section id='migration4.unset'> - <title>Changed status for <function>unset</function></title> + <title>Zmeneny stav <function>unset</function></title> <para> - <function>unset</function>, although still available, is - implemented as a language construct rather than a function. + Funkcia <function>unset</function> je síce stále dostupná, ale + je implementovaná ako jazyková kon¹trukcia, nie ako funkcia. </para> <para> - This does not have any consequences on the behavior of - <function>unset</function>, but testing for "unset" using - <function>function_exists</function> will return &false; as it would with - other language constructs that look like functions such as + To nemá ¾iadne dôsledky na správanie funkcie + <function>unset</function>, ale testovanie "unset" pou¾itím + <function>function_exists</function> vráti &false; ako by vrátili + aj iné jazykové kon¹trukcie, ktoré vypadajú ako funkcie, napr. <function>echo</function>. </para> <para> - Another more practical change is that it is no longer possible to - call <function>unset</function> indirectly, that is - <literal>$func="unset"; $func($somevar)</literal> won't work - anymore. + Ïal¹ia praktickej¹ia zmena je, ¾e u¾ sa <function>unset</function> + nedá vola» nepriamo, t. j. <literal>$func="unset"; $func($somevar)</literal> + u¾ nebude fungova». </para> </section> </section> <section id='migration4.extensions'> - <title>PHP 3 extension</title> + <title>Roz¹írenia PHP 3</title> <para> - Extensions written for PHP 3 will not work with PHP 4, neither as binaries - nor at the source level. It is not difficult to port extensions to PHP 4 - if you have access to the original source. A detailed description of the - actual porting process is not part of this text. + Roz¹írenia napísané pre PHP 3 nebudú fungova» v PHP 4 ani ako bináre ani + na úrovni zdroja. Prenesenie roz¹írenia do PHP 4 nie je zlo¾ité, ak máte + prístup k pôvodnému zdroju. Detailný popis súèasného prenosného procesu + nie je súèas»ou tohto manuálu. </para> </section> <section id='migration4.strings'> - <title>Variable substitution in strings</title> + <title>Substitúcia premenných v re»azcoch</title> <para> - PHP 4 adds a new mechanism to variable substitution in - strings. You can now finally access object member variables and - elements from multidimensional arrays within strings. + PHP 4 k substitúcii premenných v re»azcoch pridáva nový + mechanizmus. Koneène mô¾ete ma» prístup k premenným èlena objektu + a elementov z multidimenzionálnych polí v re»azcoch. </para> <para> - To do so you have to enclose your variables with curly braces with - the dollar sign immediately following the opening brace: - <literal>{$...}</literal> + Aby ste tak uèinili, musíte uzavrie» va¹e premenné uzavrie» do + zlo¾ených zátvoriek. Znak dolára musí následova» hneï po otvorenej + zátvorke <literal>{$...}</literal>. </para> <para> - To embed the value of an object member variable into a string you - simply write <literal>"text {$obj->member} text"</literal> while - in PHP 3 you had to use something like <literal>"text + Ak chcete hodnotu premennej objektu èlena vlo¾i» do re»azca, + jednoducho napí¹te <literal>"text {$obj->member} text"</literal> + prièom v PHP 3 ste museli pou¾i» nieèo ako <literal>"text ".$obj->member." text"</literal>. </para> <para> - This should lead to more readable code, while it may break - existing scripts written for PHP 3. But you can easily check for - this kind of problem by checking for the character combination - <literal>{$</literal> in your code and by replacing it with - <literal>\{$</literal> with your favorite search-and-replace - tool. + Toto by malo vies» k èitateµnému kódu, i keï by to mohlo + poru¹i» existujúce skripty napísané pre PHP 3. Ale tento druh + problému mô¾ete vo svojom kóde µahko opravi» nájdením kombinácie + znakov <literal>{$</literal> a ich nahradením s <literal>\{$</literal> + pomocou svojho obµúbeného nástroja nájde-a-nahraï. </para> </section> <section id='migration4.cookies'> <title>Cookies</title> <para> - PHP 3 had the bad habit of setting cookies in the reverse order - of the <function>setcookie</function> calls in your code. PHP 4 - breaks with this habit and creates the cookie header lines in - exactly the same order as you set the cookies in the code. + PHP 3 malo zlý zvyk po volaní <function>setcookie</function> nastavova» + cookies v opaènom poradí. PHP 4 tento zvyk zru¹il a vytvára + hlavièky cookie presne v tom istom poradí, ako ste si ich nastavili + v kóde. </para> <para> - This might break some existing code, but the old behaviour was so - strange to understand that it deserved a change to prevent further - problems in the future. + To síce mô¾e poru¹i» existujúci kód, ale staré správanie bolo tak + divné, ¾e si to zaslú¾ilo zmenu ako prevenciu voèi ïal¹ím problémom + v budúcnosti. </para> </section> <section id='migration4.variables'> - <title>Handling of global variables</title> + <title>Zaobchádzanie s globálnymi premennými</title> <para> - While handling of global variables had the focus on to be easy in - PHP 3 and early versions of PHP 4, the focus has changed to be more - secure. While in PHP 3 the following example worked fine, in PHP 4 it - has to be unset($GLOBALS["id"]);. This is only one issue of global - variable handling. You should always have used $GLOBALS, with - newer versions of PHP 4 you are forced to do so in most cases. - Read more on this subject in the <link linkend="references.global"> - <literal>global</literal> references section</link>. + Zatial èo zaobchádzanie s globálnymi premennými malo v PHP 3 a + prvých verziách PHP 4 jednoduchý fokus, fokus sa zmenil, aby aby bol + bezpeènej¹í. Zatial èo následujúci príklad v PHP 3 fungoval v pohode, + v PHP 4 to musí by» ($GLOBALS["id"]);. Toto je len jeden problém + zaobchádzania s globálnymi premennými. Mali by ste v¾dy pou¾íva» + $GLOBALS, pri nových verziách PHP 4 ste tak nútení urobi» vo väè¹ine + prípadov. O tejto téme sa viac doèítate v <link linkend="references.global"> + referenènej sekcii <literal>global</literal></link>. </para> <example> - <title>Migration of global variables</title> + <title>Migrácia globálnych premenných</title> <programlisting role="php"> <![CDATA[ <?php @@ -446,7 +437,7 @@ unset($id); } test(); -echo($id); // This will print out 1 in PHP 4 +echo($id); // Toto v PHP 4 vypí¹e 1 ?> ]]> </programlisting>